Newbie script question (About the Finder)

Hi. I’m just getting in this thing of writing scripts in AppleScript and I began to write a script. The script right now is functional but needs to be launched each time you want to use it and this is painfully slow and I wanted to accelerate it. The script is this.


Tell application "Finder"
      select startup disk
end tell

This script right now when launched opens the “Computer” folder and quits. What I want it to do is this.
Launch.
Wait for the user to doubleclick in the script.
Open the “Computer” folder.
and stay open.

By doing this it would remove the startup delay because you launch it only once (at login) and it remains ready, when you want to access the “Computer” folder you click on it and the folder open right away since the folder opens when you click the script you don’t need to launch it everytime you want to open the “computer” folder the downside is that you need to set an special event which I don’t know which is and how to use it.

Hi,

You can add a reopen handler to your stay open script app. Something like this:

on run
tell application “Finder”
activate
select startup disk
end tell
end run

on reopen
run
end reopen

gl,

Thanks, it works like a charm. Now a last one. How can I make a script that closes the toolbar in the trash folder without opening it (I would put this one as a login item so that when I open the trash either through the dock (which is hidden) or the konfabulator “trash widget” the window comes with the toolbar closed, even if this is the first time I open the trash after a logout/restart.

P.d: Here’s the completed “Computer” script, I added a command to close the toolbar (unfortunatelly the current implementation requires the window to be opened before the event can be carried out, I havent figured out yet how to tell the finder to close the toolbar on a folder without opening it first, that’s why I asked) and another to move the window to a more confortable part of the screen and change it’s size so the icons that are used the most are visible without scrolling:


on run
	tell application "Finder"
		activate
		select startup disk
		set toolbar visible of Finder window 1 to false
		set position of Finder window 1 to {102, 106}
		set bounds of Finder window 1 to {102, 106, 501, 363}
	end tell
end run

on reopen
	run
end reopen

As you see it includes your suggestions, which are greatly appreciated.

Model: eMac G4 1.42GHz maxed out in everything
AppleScript: the one with Tiger 10.4.2
Browser: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8b4) Gecko/20050718 Camino/0.9a2
Operating System: Mac OS X (10.4)