applescript

How can I determine whether or not a contact with a given e-mail address exists in the Address Book?

空扰寡人 提交于 2021-02-19 08:52:08
问题 I'm attempting to create a script that "walks" through a mailbox, checks the Address Book to see if the e-mail's sender is already there, and adds the contact to an Address Book group if found. If the e-mail's sender isn't found, a new contact would be created before it was added to the group. So far, I've got this for the group adding part: on addPersonToGroup(person) tell application "Address Book" add person to group "wedding guests" end tell save addressbook end addPersonToGroup and this

Which user is AppleScript using when executing scripts

拥有回忆 提交于 2021-02-11 15:52:06
问题 • Here is the script to be executed via AppleScript: bash-3.2$ cd /Users/jack/Desktop/ bash-3.2$ ls -l | grep static -rwxrwxrwx 1 jack admin 65 5 May 08:10 static-routes.sh bash-3.2$ cat static-routes.sh #!/bin/bash sudo route -n add -net 192.168.3.0/24 172.16.254.134 ~ • AppleScript contains the following: do shell script "~/Desktop/static-routes.sh" • When executing the script from within an AppleScript, by clicking on "Run" button, pop up window saying: Script Error sudo: a terminal is

Which user is AppleScript using when executing scripts

走远了吗. 提交于 2021-02-11 15:51:00
问题 • Here is the script to be executed via AppleScript: bash-3.2$ cd /Users/jack/Desktop/ bash-3.2$ ls -l | grep static -rwxrwxrwx 1 jack admin 65 5 May 08:10 static-routes.sh bash-3.2$ cat static-routes.sh #!/bin/bash sudo route -n add -net 192.168.3.0/24 172.16.254.134 ~ • AppleScript contains the following: do shell script "~/Desktop/static-routes.sh" • When executing the script from within an AppleScript, by clicking on "Run" button, pop up window saying: Script Error sudo: a terminal is

How Do I Activate a specific Safari Window using rb-appscript?

流过昼夜 提交于 2021-02-11 15:25:46
问题 I can't get rb-appscript to activate a specific Safari window. It is always activating the most recently active window. (in irb, assuming rb-appscript is already installed) require 'appscript' include Appscript safari = app 'Safari' safari.open_location "http://www.google.com" safari.open_location "http://www.apple.com" safari.open_location "http://www.bing.com" safari.documents.URL.get => ["http://www.bing.com/", "http://www.apple.com/", "http://www.google.com.ph/", "http://www.apple.com

Why am I getting an error using replace in AppleScript for BBEdit?

非 Y 不嫁゛ 提交于 2021-02-11 13:50:50
问题 I'm trying to make an AppleScript for BBEdit to move everything up one hour on a schedule by replacing each hour with the next hour. I've used AppleScript and BBEdit quite a bit before, but this is my first time using them together and I don't know what's going wrong. Here's the first two lines of my script. tell application "BBEdit" replace text "12:" using text "{#pl}:" "{#pl}:" is a placeholder. I've tried this first without the "text" keywords and got the same error. Whenever I run this I

Using double quotes in Applescript command Do Shell Script Echo

梦想的初衷 提交于 2021-02-10 05:13:48
问题 I'm trying to use applescript to run a command line process. A simplified version of the Applescript looks like this do shell script "echo bwfmetaedit --INAM=\"name\" --IART=\"artist\" --ICRD=\"date\" /desktop/filepath.wav" with the expected result being bwfmetaedit --INAM="name" --IART="artist" --ICRD="date" /desktop/filepath.wav If I were to just to run that command in Terminal, I get the correct output. However with applescript I get the following result. Note the missing double quotes

Using double quotes in Applescript command Do Shell Script Echo

我们两清 提交于 2021-02-10 05:12:37
问题 I'm trying to use applescript to run a command line process. A simplified version of the Applescript looks like this do shell script "echo bwfmetaedit --INAM=\"name\" --IART=\"artist\" --ICRD=\"date\" /desktop/filepath.wav" with the expected result being bwfmetaedit --INAM="name" --IART="artist" --ICRD="date" /desktop/filepath.wav If I were to just to run that command in Terminal, I get the correct output. However with applescript I get the following result. Note the missing double quotes

Using double quotes in Applescript command Do Shell Script Echo

谁说胖子不能爱 提交于 2021-02-10 05:08:49
问题 I'm trying to use applescript to run a command line process. A simplified version of the Applescript looks like this do shell script "echo bwfmetaedit --INAM=\"name\" --IART=\"artist\" --ICRD=\"date\" /desktop/filepath.wav" with the expected result being bwfmetaedit --INAM="name" --IART="artist" --ICRD="date" /desktop/filepath.wav If I were to just to run that command in Terminal, I get the correct output. However with applescript I get the following result. Note the missing double quotes

Using double quotes in Applescript command Do Shell Script Echo

谁都会走 提交于 2021-02-10 05:05:58
问题 I'm trying to use applescript to run a command line process. A simplified version of the Applescript looks like this do shell script "echo bwfmetaedit --INAM=\"name\" --IART=\"artist\" --ICRD=\"date\" /desktop/filepath.wav" with the expected result being bwfmetaedit --INAM="name" --IART="artist" --ICRD="date" /desktop/filepath.wav If I were to just to run that command in Terminal, I get the correct output. However with applescript I get the following result. Note the missing double quotes

How find the file name of an executing AppleScript

烈酒焚心 提交于 2021-02-08 20:55:21
问题 How do I find the name of an executing AppleScript? REASON: I want to create a script that changes its behavior based on its filename. Something like: if myname is "Joe" then ACTION1 else if myname is "Frank" then ACTION2 else ACTION3 回答1: The normal way to get the name is by using "name of me". However applescripts are run by applescript runner so when you use that on a script you get "Applescript Runner" as the name. If you compile your script as an application then "name of me" will work.