|
|
simple applescript question
|
|
|
|
Forum Regular
Join Date: Oct 2000
Location: Roanoke, VA USA
Status:
Offline
|
|
I'm super new to this. i want to write a script to close all applications that are running. I thought it would be:
tell application "finder"
close all applications
end tell
but this didn't work. it didn't recognize the word applications on the second line.
what's wrong with my code here?
if this question is out of place, please redirect me to the appropriate forum. thanks.
|
I want the ability to sleep in the snow, if I have to. I want the ability to want to.
|
|
|
|
|
|
|
|
Registered User
Join Date: Apr 2000
Status:
Offline
|
|
I'm not on my Mac at the moment, but try SOMETHING like this:
on run
put openApps into apps
quit apps
end run
I dunno... thats off the top my my aching head and it will not work, but its something of that sort.
Cipher13
|
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: May 2000
Location: Chattanooga, TN
Status:
Offline
|
|
tell application "Finder"
set theProcs to every process whose (file type is "APPL")
repeat with theApp in theProcs
set appName to name of theApp
if appName is not "Finder" then
tell application appName
quit
end tell
end if
end repeat
end tell
[edit: This should be in the Programming forum.]
[This message has been edited by tonymac (edited 12-06-2000).]
|
|
|
|
|
|
|
|
|
Forum Regular
Join Date: Oct 2000
Location: Roanoke, VA USA
Status:
Offline
|
|
nope that didn't work. and I'm still trying to figure it out. wish me luck. anyone else have any ideas? I need to find an Apple Script message board.
|
I want the ability to sleep in the snow, if I have to. I want the ability to want to.
|
|
|
|
|
|
|
|
Forum Regular
Join Date: Oct 2000
Location: Roanoke, VA USA
Status:
Offline
|
|
sorry, this "nope" was to cipher's response. must have posted almost at the same time tonymac was posting and I got second. however, the nope goes out to tony too. I tried yours and it just managed on closing the actual finder! which I didn't think was even possible. when I closed all the other apps (manually), the finder, the startup disk, and desktop icons, all appeared again. hmmmm.... this is interesting.
note: can the administrator shift this thread on over to the programming forum?
|
I want the ability to sleep in the snow, if I have to. I want the ability to want to.
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: May 2000
Location: Chattanooga, TN
Status:
Offline
|
|
Apologies. I took that from another, more complex script that I wrote, and adapted it. The correct script is:
tell application "Finder"
set theProcs to every process whose (file type is "APPL")
end tell
repeat with theApp in theProcs
set appName to name of theApp
if appName is not "Finder" then
tell application appName
quit
end tell
end if
end repeat
The problem was that the quit was nested in the tell "Finder" block. This should work. If you're saving this as an application, you may have to substitute the name of your applet for "Finder" in the if then statement.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|