applescript

Set text of a Growl Notification using Automator?

孤人 提交于 2019-12-11 08:31:34
问题 I have an Automator Application containing the action "Show Growl Notification", which is always empty when it appears. I've tried using the "Get Specified Text" and "Get Value Of Variable" actions directly before it, but nothing I've tried seems to work. 回答1: The code sample from gadgetmo is almost correct but won't work as is with Growl 1.4 An application must be registered and enabled and must provide a list of notifications it will present and also a list of which of those notifications

Run applescript from C

做~自己de王妃 提交于 2019-12-11 07:54:19
问题 How can I run an AppleScript from within an C commandline utility? Googling didn't work, it only gave me Objective -C solutions... EDIT: Oops, I should have googled for 'run shell script C'... Now i found the system() function... 回答1: I would use the exec family of functions, which is safer than system : int exitCode = execlp("osascript", "osascript", "-e", "say \"Hello World\"", NULL); 来源: https://stackoverflow.com/questions/9957672/run-applescript-from-c

How to get a list of the desktops in applescript

删除回忆录丶 提交于 2019-12-11 07:52:08
问题 I'm trying to make an applescript that let's me change the desktop picture to a random picture in a folder on my hard drive tell application "Finder" set desktopPictures to folder "Path:To:Desktop:Pictures:" set fileList to name of every file of desktopPictures set theNum to random number from 1 to (count fileList) with seed ((time of (current date)) * 4) set fileName to item theNum of fileList set desktop picture to file fileName in desktopPictures end tell So far it works perfectly, the

How do you do an include in applescript?

六眼飞鱼酱① 提交于 2019-12-11 07:34:00
问题 I have a bunch of code I want to to use in several different applescripts so I would like to put it into it's own applescript that I can reference from other applescripts. Basically I want to do an include. How is this done in applescript? 回答1: Here is the best way I have found to accomplish this. You can call a function on another script like so: script a.scpt set myScript to load script "b.scpt" set foo to myScript's theTest() script b.scpt on theTest() return true end theTest As you can

Using ASObjC Runner to abort a shell script command in Applescript

馋奶兔 提交于 2019-12-11 07:16:48
问题 I've got ASObjC Runner code in my AppleScript that shows a progress window once a do shell script is run. How do I make the button on the progress window kill the shell script? Heres a sampling of my code: tell application "ASObjC Runner" reset progress set properties of progress window to {button title:"Abort", button visible:true, indeterminate:true} activate show progress end tell set shellOut to do shell script "blahblahblah" display dialog shellOut tell application "ASObjC Runner" to

System environment is different between AppleScript editor and running my script standalone under Mac OS Mavericks

冷暖自知 提交于 2019-12-11 06:56:06
问题 There is a lot of information on Stack Overflow about how to set environment variables (like this question and this one). Unfortunately it seems that Apple has been playing with this process a lot over the last few years and so much of the discussion online seems to have been rendered obsolete by Mountain Lion and Mavericks. There are two methods discussed in more recent posts: editing launchd.conf and modifying ~/.MacOSX/environment.plist . I've tried both and am still not getting my new

AppleScript how to find pattern and set it to a record or list?

别来无恙 提交于 2019-12-11 06:55:05
问题 In AppleScript I know how to do a typical find with something like: tell application "BBEdit" activate open find window find "memberFunction\\(\\)" searching in text 1 of text document "theFile" options {search mode:grep, wrap around:true} with selecting match end tell and I can do a multi file search find: tell application "BBEdit" activate find "memberFunction\\(\\)" searching in {file "path:to:project.bbprojectd:"} options {search mode:grep, showing results:true} end tell but I'd like to

“POSIX file” works in Applescript Editor, not in XCode

旧时模样 提交于 2019-12-11 06:46:48
问题 Try this: Make a new XCode4 Applescript project. In the delegate, paste this code: on doIt_(sender) set goodHFSLoc to (path to desktop folder) set test1 to (POSIX path of goodHFSLoc) log "test1:"&test1 set theJSPath to "/Users/dave/Desktop/MakeTSLabels.js" set jsHFSFile to (POSIX file theJSPath) set test2 to (POSIX path of jsHFSFile) end doIt_ Hook this method up to a button in the UI window. Run the program Click the button, and you should get this error: Can’t get POSIX path of class

Apple script simulate key events

拥有回忆 提交于 2019-12-11 06:44:48
问题 I want to know the key codes for all the function keys from F1-F12. From previous search queries I have found keycode 107 to turn brightness down by running this echo "tell application \"System Events\" key code 107 end tell" | osascript And I'm guessing that simulates the F1 key but the weird thing is 113 turns the brightness up. I haven't been able to find key codes for any other Fn keys. Any help? Is there a nice table made for this where I can get the keycodes. In the end I want to be

Remove multiple PDF passwords with workflow or applescript in a folder

允我心安 提交于 2019-12-11 06:43:01
问题 How do I remove passwords from multiple PDF files using Applescript or by creating a Workflow in OS X ? My scenario is that I have multiple password protected PDF files in a folder . I know the passwords for all, which is same. I want to be able to run a Workflow on this folder so that all PDFs inside it are unlocked by the workflow. OR run an Applescript shell code on all these files at once I also preferably want to be able to create a way where putting / moving / pasting any PDF in the