applescript

Applescript Universal application

烂漫一生 提交于 2019-12-23 01:57:18
问题 Is there a way for me to create an Applescript as a run only application that would work on 10.5 and above? I am running Lion. Whenever I save my script as a run only application it does not work with 10.5 and gives me a "does not work with this architecture" error. The weird thing is that I saved it once and successfully launched it on the 10.5 machine but when I went to edit it and re-save it did not work anymore. Thx 回答1: You can't and Apple's documentation isn't clear. My experience,

Running python from VBA word and returning a value

◇◆丶佛笑我妖孽 提交于 2019-12-23 01:44:12
问题 Trying to figure out how to open python from word vba, on mac computers, and return a value using the code below. I need to be able to run this code from word vba without calling a specific python file, this will be run on multiple computers so I can't assume they have my premade python file downloaded. All I've seen is people calling a premade file with the script already in it. Here is my Python Code: import urllib2 web1 = urllib2.urlopen('website.com') #website url print(web1.read()) Any

How can I convert a series of words into camel case in AppleScript?

╄→尐↘猪︶ㄣ 提交于 2019-12-23 01:01:07
问题 I'm trying to modify Dragon Dictate, which can execute AppleScript with a series of words that have been spoken. I need to find out how I can take a string that contains these words and convert it to camel case. on srhandler(vars) set dictatedText to varDiddly of vars say dictatedText end srhandler So if I set up a macro to execute the above script, called camel, and I say "camel string with string", dictatedText would be set to "string with string". It's a cool feature of DD. However I don't

AppleScriptTask throwing an error 5 - invalid procedure call or argument

南笙酒味 提交于 2019-12-22 14:59:51
问题 I'm facing a problem on Mac 2016 Powerpoint. In my VBA module I need to run an applescript. As we cannot use MacScript anymore I followed RonDeBruin's explanation to use AppleScriptTask. My Applescript is working fine on his own but when I try to call it like this : AppleScriptTask("hello.scpt", "myhandler", "hello") With in my apple script on myhandler(paramString) say paramString End myhandler It gives me an error 5 - Invalid procedure call or argument my script is placed in Library

AppleScript that reads active application name, title and URL

青春壹個敷衍的年華 提交于 2019-12-22 14:04:33
问题 I need AppleScript that, when lunched from command line, will return three things: current active application name; ex. "Google Chrome", "Safari", "Steam", "iTunes", "Atom" ect. current active application title, if there is one if current active application is a browser, I want the current active tab URL examples: Google Chrome; AppleScript: How to get URL of Safari tab which failed to load? - Stack Overflow; https://stackoverflow.com/ iTunes; iTunes iTerm2; 1. node test.js (sleep) Safari,

AppleScript : How to get files in folder without hidden files?

大憨熊 提交于 2019-12-22 11:28:17
问题 I actually have two questions. How to exclude hidden files like .DS_STORE, Icon when I try to get files in folder ? I've tried " without invisibles " but it seems not working. How to set my var the_new_folder as an existing folder if already exists ? Thanks for answers. My code: -- -- Get all files in a selected folder -- For each file, create a folder with the same name and put the file in -- tell application "Finder" set the_path to choose folder with prompt "Choose your folder..." my file

OS X Applescript to Check if Drive Mounted and Mount It If Not

我的梦境 提交于 2019-12-22 11:13:41
问题 I am trying to write an AppleScript that will check if a network drive (in this case, my Time Capsule) is mounted and, if not, mount it. I've figured out how to mount the Time Capsule, but I am at a loss over how to have the script check whether it is mounted first and just exit if it is, or mount it if not. tell application "Finder" mount volume "afp://AirPort%20Time%20Capsule._afpovertcp._tcp.local" end tell 回答1: Does that the job? set mountedDiskName to "AirPort Time Capsule" set

Send key down / up events for number keys using AppleScript

流过昼夜 提交于 2019-12-22 09:39:30
问题 I need to send a key down / key up event for number keys to an application using AppleScript. However, the commands: key down "6" delay 1 key up "6" send the keystrokes as if they were coming from the number pad. I need them to be interpreted as coming from the number row at the top of the keyboard. I’ve also tried using (ASCII character 54) instead of a literal, without success. Note I need key down to be sent – sending a keystroke or key code will not do. 回答1: Try sending key down the

How to reload a Safari Extension from the command line?

两盒软妹~` 提交于 2019-12-22 09:17:19
问题 I need to "Reload" a Safari extension from the command line (and also build the package later). How can this be done? Why? I'd like to build in one step - my code is in CoffeeScript and thus I'm compiling it anyway. What have I tried? Apart from googling hopelessly I tried using this AppleScript: tell application "System Events" tell process "Safari" click the button "Reload" of window "Extension Builder" end tell end tell Which errors out with: System Events got an error: Can’t get button

Using Python with Scriptable Applications (on a Mac)

删除回忆录丶 提交于 2019-12-22 09:07:31
问题 I'm quite new to programming, but I've learned some basic Python programming in a university course. I'm looking for a way to run very simple Python scripts on Mac applications (mainly iTunes), in lieu of AppleScript. I've read up on using AppScript for Python, but it is no longer in development and is broken as of iTunes 10.6.3. On my Windows computer, I was easily able to script applications with Python using a module called PyWin32. Since switching to a Mac, however, I haven't been able to