Kill/Stop a specific running script
Kill/Stop a specific running script
- Subject: Kill/Stop a specific running script
- From: Bryan Harris <email@hidden>
- Date: Wed, 22 Jan 2014 01:02:52 +0000 (GMT)
Hello all,
I have come up with a very simple & cheesy script to help me at work. I guess you can tell what it does, but I'll go ahead and describe it anyway. I think to arrive at this script I must have started with google searches for people doing something similar, and just modified their scripts. In any case it seems to work okay most of the time.
So anyway, the script switches to my remote desktop session and just presses the F5 key to refresh my IE page. Then it switches me back to whatever I was doing (⌘-Tab). I tried
doing this with PowerShell but we are not allowed to execute PowerShell commands on that server, so this AppleScript is the best I could think of.
tell application "System Events"
repeat
if exists process "Microsoft Remote Desktop" then
set myApp to the name of the first application process whose frontmost is true
if myApp is not equal to "Microsoft Remote Desktop" then
activate application "Microsoft Remote Desktop"
tell application "System Events" to key code 96
keystroke tab using command down
-- display notification "beginning 240 second timer" with title "FooBar Refresh"
delay 240
else
repeat
if (the name of the first application process whose frontmost is true) is equal to "Microsoft Remote Desktop" then
delay 1
else
exit repeat
end if
end repeat
end if
end if
end repeat
end tell
What I would like to do is kill this script by running another script that just simply runs a killal "Refresh FooBar". I have tried many variations of escaping my quote marks or using single quotes but I could not figure it out. Instead this is what I've been using. It's not limited to just my script but I also know that's the only script running, so it works even though it would kill other scripts (if they were running, which they aren't).
do shell script "killall osascript"
Does anyone have advice for how to kill just a specific AppleScript? E.g. I have tried things like below but could not quite get it right.
do shell script "killall \\"FooBar Refresh\\""
do shell script "killall 'FooBar Refresh'"
Bryan
PS - When I tried to use pkill, AppleScript tells me it cannot find pkill. If I could use that then maybe I would not need quotes?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden