Re: How am I doing? (Thanks, Brennan)
Re: How am I doing? (Thanks, Brennan)
- Subject: Re: How am I doing? (Thanks, Brennan)
- From: Mr Tea <email@hidden>
- Date: Wed, 25 Sep 2002 14:28:35 +0100
This from Brennan - dated 24-9-02 11.26 pm:
>
How is that for you?
Oh yes. That feels real good.
I wasn't able to implement all your suggestions, but the central section of
the script has been transformed from Marlon Brando in 'The Island of Dr
Moreau' to Marlon Brando in 'On the Waterfront'. A major achievement.
>
set startupItems to (path to "strt")
Not available in X, sadly. Sorry, I should have specified the OS more
explicitly.
>
In this case, use instead
>
>
set onList to (list folder startupItems)
I started with that (adding the 'without invisibles' clause), but my startup
items folder also contains the disabled items folder, and I didn't want the
extra step of weeding the folder out of the returned list. Asking the Finder
to get 'every file' seemed the most streamlined approach here.
>
Ugh! Here's a nicer way to build a list of 10 'false' values...
Yup. That's a lot nicer.
>
how about doing the iterative parts of both step 5 and 6 together in one fell
>
swoop
Magic! 273 words of script boiled down to 59. That's what I'm talkin' about!
One little thing - I found that the line:
set theFields to theFields & {kind:check box, name:iname, selected:selState}
...needed double braces around the list of properties to work as required.
>
that hardcoded 8 makes me wonder whether it shouldn't be a variable instead
Done. Counting the combined list of enabled & disabled startup items gives
the correct number every time.
>
Huh? Why are you telling the Finder to display the dialog?
Why? Because this is a compiled script running from a DragThing button, and
DragThing will display the dialog in the background and hop around in the
dock if I don't tell something else to display it. Eventually, I'll probably
save the script as an applet and put it in my Apple Menu (courtesy of
'FruitMenu'), so this won't be an issue.
>
--tell application "Logout Script" to activate
>
--why not run these scripts as script objects? It will be faster.
Again, this is how I started out, but there were problems with a utility
(DesktopCalendar) that refused to quit, giving an incomprehensible
'connection not valid' error. No such problem when the 'Logout Script' ran
as an application. However, I tweaked it a bit so it runs happily either way
(same with the restart script) and now it's 'run script' instead of
'activate'.
Phew! That was some makeover. Thanks again for your insights, Brennan. Your
tips for setting up a list of fields and their values in a concise and
efficient manner were solid gold.
How am I doing? A lot better than before.
Cheers
Nick
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.