er, not working like a charm

With help from the bbs, I was able to make a simple script to launch then hide my DSL software… or so I thought. Here’s the script:

tell application "MacPoET"
launch
end tell
tell application "Finder"
set visible of process "MacPoET" to false
end tell

When I saved it as an application and tried it out with a double click, all worked as desired, hurrah! But once it was placed in the Startup Items folder, it would launch okay, then return this error message:
can’t set <> “MacPoET” of application “Finder” to false.
Any ideas why this script works when clicked but not as a startup item?
Thanks!

Hi,
No ideas. Maybe, by putting in the startut items folder a script which tell the MacPoet app to run may helps

cya

Well, I couldn’t figure out why the script worked as a double-click and not as a startup item, but my needs were met by Lawrence D’Oliveiro’s scripting addition “application menu.” I had the script launch my two desired programs (both of which can be set to do their tasks immediately upon launch) then used his “hide all” which took care of the rear app and “hide front” which took care of the other. FYI, though “hide front” will bring the next app in line forward (rather than the Finder) simply repeating “hide front” didn’t do the trick. I’m guessing that I’d have to build a delay into the script to give the rear app time to move up, but it’s moot since I could just hide the rear app first using his addition. Thanks Laurence for the osax, and thanks to others for suggesting new ways of approaching the problem which led me to find the addition I needed.

Hi, David.
I see you’ve already found an alternative solution, but for what it’s worth, I think that in the original script, the Finder was trying to set the ‘visible’ to false while MacPoET was still launching and wasn’t yet installed as a process. I got the same message in Script Editor the first time I tried it (with a different application). The second time - when the application was already open - there was no problem. This seems to be the cure:

tell application "MacPoET"
launch
end tell
tell application "Finder"
repeat until process "MacPoET" exists
end repeat
set visible of process "MacPoET" to false
end tell

NG

I suspected a problem something along those lines but didn’t know how to get around it. That’s a very useful tip that I know I’ll be able to use. My first real foray into scripting, comparatively simple as it was, has gotten me excited about the possibilities with AS.

Thanks!