Fastscript crashes with -600 error on my script
  • G'day from Oz

    I've written a script to save & retore icon positions.

    Unfortunately the script crashes (on save, not restore) with Fastscript...

    Error number: -600
    Message: System Events got an error: Process not found.

    The script can be downloaded from...

    http://scriptbuilders.net/files/restoredesktopicons1.5.html

    It works fine as a script or as an App, as long as it's not called from Fastscript via keypress.

    Any thoughts appreciated.

    Regards

    Santa
  • Hi Santa - thanks for letting me know about the problem. I've downloaded your script and run it through FastScripts without incident, so I hope you can give me some more details so I can accurately reproduce the problem.

    Can you give me a specific list of instructions for how I should reproduce the problem? I.e. tell me which options to click when the script runs, and perhaps what kind of window I should be looking at when I press the keystroke to run the script.

    Thanks! We'll get to the bottom of this...

    Daniel
  • G'day Daniel

    I'm using Fascripts Lite. and my App is called as a saved script.

    I've got a saved list, (which was created by running the script via Apples script editor) and a keypress on Command-R to run the script via Fastscripts lite, which is saved in folder '~Library/Scripts/my scripts'.

    When I try to use the 'Save positions' menu option (after selecting 'manage' from the first window), the script crashes.

    Running the script, • as a script •, via FastScript might be problematic anyway, as it really relies on it's name as an App to save the hidden file.

    •• Update •• In fact, I've just realized, and run a trial to prove it, that my script works as long as it's saved and run from Fastscripts as a named App, not a script.

    I think as a script the name of the path used for the hidden file is the App. Fastscript Lite itself, rather than the name of the script.

    •• Further testing •• As a script, it works under Apples Script Editor, but uses the Script Editor name as the name of the hidden file. It only crashes under Fastscripts under the same circumstances.

    Regards

    Brian Christmas (Santa)
  • G'day again

    •• Further testing.

    I ran a duplicate of my App, renamed Trial, under fastscripts lite, Command-R call, and it worked ok.

    I deleted the App, and replaced it with a copy of the script, also called Trial, (although I suspected it would not use the same hidden file name, but something else).

    I re-built the Command-R call.

    I ran it, and it crashed, possibly trying to access an old file from the work above.

    Then, Command-R did nothing, zilch, nada, except flicker the menu bar icon for fastscripts lite.

    I've used File Buddy to look for a hidden Launch file belonging to the script 'Trial' and found one with .scpt in the name, so I re-wrote my script to remove it from future saves.

    Re-tried above procedure, after removing old hidden file, and Command-R worked, up until I chose a file to add to the list. It wrote to a new hidden file, then crashed as per above.

    Remove the hidden file, then it worked again until creating new & writing to file, crashed, ad infinitum.

    I've logged out & in, but stiil the above situation. The file had data written to it, so it may be occurring on the Read.

    Notably, the hidden file created starts with 'Trial', unlike the when the script is called from the Script Editor, which starts the file with 'Script Editor'

    However, the file created, '.Trial LaunchFile.dat' cannot be moved to the Trash by File Buddy, but has to be Deleted by it.

    Perhaps it's somehow being read/write locked, or something weird, when created via Fastscripts.

    Whatever I've done to the script, or to Fastscripts, it has replaced the -600 error with crashes/lock out when accessing the file.

    Regards

    Santa
  • Some more detective work.

    If I use a copy of my App called 'Trial' the same as the script, then it can access the file created by the script, with one item in it.

    If I use the App to delete the item, the script still appears not to run with Command-R.

    It's obviously crashing on the 'read', even with no data in the file (its first job is a 'read').

    If you want, I can send you a copy of the latest version, that has a few minor twiddles, and the ability to strip the '.scpt' out of the file path when used as a script. There's not enough changes to warrant posting as an update on scriptbuilders, as there does not seem to be any major errors, (except for this bit of the collywobbles)

    bec9@tpg.com.au
  • Damn, I've made a blue (Aussie for mistake). I've actually found the above errors (not the first query, just the added detective work) using this latest App, but suspect they're one and the same problems.

    http://scriptbuilders.net/files/launcher1.0.html

    I'm so tired I forgot to mention I was trying to trap another error in my latest creation 'Launcher'. The abovementioned error still stands for 'Restore Desktop Icons', but I think in 'Launcher' the error is pinpointed as a read error.

    Sorry for the confusion, but it boils down to

    • Fastscripts crashing under two of my Apps, both of which access hidden "." files, and
    • crash when hot key accessed as scripts, but not as Apps.

    Now I'm gonna try and get some sleep.

    Santa
  • Good morning.

    Now I've had some sleep, I was thinking straight.

    First thing I did this morning was to re-boot without fastscripts, and restore and run the two scripts via Apples menu bar icon.

    Both crashed as per above, except under Apples script utility (or whatever runs the scripts) there was no -600 error in 'Restore Desktop Icons'. It just plain ol' crashed.

    Looks like the fault lies in my scripts. Why they work as scripts in Script Editor, or as Apps,is beyond me.

    Any suggestions welcome.

    Santa
  • Santa - I haven't really had a chance to fully digest the details yet, but from your description it sounds like there might be some difference in behavior due to the "path to me" command. Historically the functionality of this command in AppleScript has been inconsistent, but as of 10.4 it basically works like this:

    Script Editor - Returns a path to the Script Editor app itself.
    Script Application - Returns a path to the application itself
    (Almost) Everywhere else - Returns a path to the *script* itself.

    Does this help clarify anything? I will take a closer look at this soon if this doesn't cause any lightbulbs to go off!

    Daniel
  • No lightbulbs unfortunately Daniel.

    What's got me beat is why the script writes ok, but crashes on 'read'. The same subroutine is called for 'Path to me' to get the name of the App/script in both cases.

    The saved write file from the script reads fine from the App.

    As long as both work as Apps, then they should be fine. I'll just post a suitable warning on the downloads pages.

    Thanks

    Santa
  • Found it!

    The fault was in this bit

    on BringMeToFront()
    tell application "Finder"
    tell application "System Events"
    tell process (my GetMyLongName())
    set frontmost to true
    end tell
    end tell
    end tell
    end BringMeToFront

    I had to include a try statement. Obviously running as a script precludes setting the frontmost.

    A script must not have a process? or just the frontmost?

    on BringMeToFront()
    tell application "Finder"
    tell application "System Events"
    tell process (my GetMyLongName())
    try
    set frontmost to true
    end try
    end tell
    end tell
    end tell
    end BringMeToFront

    Sorry to be a bother.

    Santa
  • Glad to hear you found the problem! As you've discovered, AppleScript is a land of voodoo incantations and crossed-fingers. Wish it was more reliably but it's the best we've got, I guess :)
Start a New Discussion

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!