Hey, I was wondering how can I make a if statment, because I was having problems just doing this:
do shell script "killall "hybrid.app""
do shell script "killall "online.app""
do shell script "killall "ivn.app""
do shell script "killall "on_campus.app""
do shell script "killall "jmstn.app""
the problem with that is if one of those scripts werent open then the scrip would fail, and i tried writing a if statment like
if "hybrid.app" is active then
do shell script "killall "hybrid.app""
end if
But I couldnt even get that one if to work, can someone help me on this issue? Thanks a lot.
property killList : {"hybrid", "online", "ivn", "on_campus", "jmstn"}
tell application "Finder"
set appList to name of every application process
end tell
repeat with killApp in killList
if appList contains killApp then
set killScript to ("killall "" & killApp & """) as string
do shell script killScript
end if
end repeat
Slaps himself silly Damnit, now I have just learned not to post anything in morning, because I talk out of my ass. I figured out a super duper solution.
do shell script "killall "Script Editor""
lol that solves everything, I always try the hardest way possiable, then figure out there is a super easy soloution. Thanks again guys. DAMNIT :x
LOL thanks, that works too, I will put that one in the archive of my shit just incase i need certain apple scripts to keep running. Thanks man, sorry to take your damn time, since I found a dumbass easy solution.
Ok i have found a prob. I had to modify that code somewhat to get it to work:
property killList : {"hybrid.app", "online.app", "ivn.app"}
tell application "Finder"
set appList to name of every application process
end tell
repeat with appList in killList
if killList contains killList then
set killScript to ("killall "" & appList & """) as string
do shell script killScript
end if
end repeat
But I still cant get that code to make it work like i want it, so lets say if online.app wasnt activated, well then code above would give me an error saying that it has a problem because it could not find “online.app” and would shut it self down without going through the other *.app files and close them down. Any ideas on that? thanks again majolry.
set itsFolder to "documents folder from user domain"
set shellScript to "cd " & itsFolder
do shell script (shellScript)
This does not:
set itsFolder to "iMac\\ Internal\\ HD/Users/johnlove/Library/Application\\ Support/SuperDuper!/Saved\\ Settings"
set shellScript to "cd " & itsFolder
do shell script (shellScript)
I get “Finder got an error: sh: line 1: cd: iMac Internal HD/Users/johnlove/Library/Application Support/SuperDuper!/Saved Settings: No such file or directory”
It appears that I have properly escaped the spaces, so what have I done wrong ???
Even if I escape the “!” via “\!”, same error message.
POSIX paths always start at “/” (the root); It does not use the hard drive name.
This should also work:
quoted form of POSIX path of ((path to application support folder from user domain as Unicode text) & "SuperDuper!:Saved Settings:")
do shell script "cd " & result -- and whatever else
Unless of course its a secondary drive in which case its going to be “/Volumes//blah blah” or depending on how you actually mounted the volume some other place.
return character 1 of "/Volumes/<drive name>/blah blah"
--> "/"
Technically, POSIX path would include the drive’s mount point. (Which falls underneath “/” still, as I jokingly pointed out above.) So if you were to connect to, say, a SMB share, the POSIX path would actually be: “/Volumes/”
set chosenScript to ¬
choose file default location (path to application support from user domain) ¬
with prompt "Finally choose the Applescript you want to run"
chosenScript comes back looking like:
startup drive name:Users:johnlove:Library:Application Support:etc etc
but I don’t want to always count on the fact that the script file is in my Application Support folder … so it turns out that thanks to you I have learned about the leading “/”, but also I can avoid depending on the script being in the App Support Folder via:
if (character 1 of chosenScript as string ≠"/") then set chosenScript to "/Volumes/" & chosenScript
Problem solved.
P.S. if I type one more time “chosenScript = ‘whatever’”, I am going to scream