Why does Fastscripts take so long to start up
  • When I occasionally reboot my machine, I'm always surprised by how long it is before the FastScripts menu icon switches from a spinner to the FS icon and I can key in a script call. Admittedly, there's a bunch of stuff going on, but other apps seem to get on with it.

    It occurred to me that it might be searching 4 partitions of a large hard disk instead of just the boot volume, but there is no preference to prevent that.

    The following script takes under a second to find all of nearly 2500 scripts on my boot volume - and they are not all in the same place, either. Would something like this help FastScripts start up?

    set PsxPath to paragraphs of (do shell script \"mdfind -onlyin / 'kMDItemContentType == \\"com.apple.applescript.script\\"c'\")
    (*
    -- Or for HFS paths, convert:
    set HFSPath to {}
    repeat with F in PsxPath
    set HFSPath's end to POSIX file F as Unicode text
    end repeat
    *)
  • Most of the time is spent in actually validating the script-ness of everything in your scripts folder. FastScripts does this all at launch time so that it can cache information about each item such as whether it really is an AppleScript, whether it is a shell script, an application, etc. For instance to determine whether a file is a shell script or not it has to peek inside the file to see whether it has the "shebang" prefix (e.g. #!/usr/bin/perl).

    There might be room for optimizing this further, and I'll look into that. But I wouldn't want to diminish the user experience of being able to see up-front what is a script and what isn't.

    Daniel
  • However - your point about using mdfind if it's available is well taken. I might be able to avoid determining the script-ness of everything if Apple has already done it for me. I will just have to be sure to have a good way of checking whether it's done or not.

    Thanks for the idea I'll look into this more carefully.

    Daniel
  • mdls shows that Unix executables have this attribute: kMDItemKind = "Unix Executable File", so only shebang documents have to be checked. mdfind doesn't find #!/ however. The only ones I have are perl scripts written by others.
  • Bump. Any action here?
  • Sorry, no. The last update to FastScripts focused on solving the long-standing problem of aliases to folders. I still have this on my radar but I don't have an estimate for when it might happen.
  • A shortcut that would solve the problem for some of us would be an off by default preference to assert that all non-directory files are AppleScripts. Don't know about others, but I only use it for AppleScripts!

    I can imagine huge support headaches, though! Maybe a hidden pref :)

    r
  • rickybuchanan: that's an idea ... but yeah it does sort of sound like a distasteful split in behavior...
Start a New Discussion

Howdy, Stranger!

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