Non-affected apps include: Google Chrome, iTunes, Preview, Mail, Terminal, Address Book, Echofon.Affected apps include: Safari, TextEdit, iPhoto, AppleScript Editor, iTerm.This still always launches Safari, even though tell is inside an if false block after the return statement! (But again, this is fine in AppleScript Editor.)īTW, this behaviour isn't limited to Safari, but it also isn't universal: In fact, here's another, madder, version with similar behaviour: on is_running(appName) So it seems to me like the tell is what's causing Safari to be launched, but it doesn't need to be actually executed, just present in the script.? For a while I wondered if maybe this was just how tell is supposed to work, but since it doesn't work like this in AppleScript Editor, I guess not. If you comment out the tell / end tell lines, it behaves as I'd expect: if Safari is not running, it doesn't launch it, and prints "Not running". Is this an osascript bug / known issue? Or is it somehow intended behaviour for reasons I'm missing? Can anyone get it to work as desired? (BTW I'm running OSX 10.7.5 I can't see how to get osascript to report a version number). Note that it works as desired/expected when run within AppleScript Editor. This is not the behaviour I desire or would expect. The problem: when I run this via the osascript command line utility, if Safari is not running, it gets launched and the script reports "Running". Stuff I only want executed if Safari is running goes here. Tell application "System Events" to (name of processes) contains appName Consider the following AppleScript: on is_running(appName)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |