Hot answers tagged applescript
6
You can use...
open dict://my_word
...which will open the Dictionary application and lookup the string my_word. If you want to use multiple words use something like open dict://"Big Bang Theory".
There's no output in the Terminal though.
3
Rather than using the in-line form to give the username and password, you can specify them as parameters for the mount volume command. Changing the final line to the following will work with passwords with special characters:
mount volume "smb://" & server_name & "/" & share_name & "/" & user_name as user name user_name with password ...
2
You could take advantage of the fact that 44 is evenly divisible by 5.5 and use an inner and outer loop:
repeat
keystroke "i"
repeat 8 times
keystroke "o"
delay 5.5
end repeat
end repeat
Note that for the keystroke command to work, you need to be in a tell block for the System Events application.
2
I don't know how it compares against other options, but you could use pdfotext. It can be installed with brew install xpdf.
do shell script "/usr/local/bin/pdftotext /usr/share/doc/bash/bash.pdf -" without altering line endings
Calibre also comes with some command line utilities:
/Applications/calibre.app/Contents/MacOS/ebook-convert ...
2
Using the Python Objective-C bindings, you could create just a small python script to get it from the built in OS X Dictionary. Here's a post that details this script"
#!/usr/bin/python
import sys
from DictionaryServices import *
def main():
try:
searchword = sys.argv[1].decode('utf-8')
except IndexError:
errmsg = 'You did not ...
2
I was also going to suggest open dict://word, but Google's dictionary API also uses the New Oxford American Dictionary:
#!/usr/bin/env ruby
require "open-uri"
require "json"
require "cgi"
ARGV.each { |word|
response = ...
2
The load script command loads a script as an object to be run, rather than as text to read or manipulate.
If you want to access the actual text of your script, you can use osadecompile:
do shell script "osadecompile ~/Library/Scripts/test.scpt"
word 2 of result
Compiled scripts saved with AppleScript Editor usually have LF line endings in strings but CR ...
1
You can combine AirPlay in iTunes 11 and up with something like AirSever to accomplish this with good results and very little effort. (Note: For more options on how to turn your Mac in to an AirPlay receiver please see: Can I use a Mac Mini as an Airplay audio receiver?)
Install the AirPlay receiver software of your choice on the machine you want to stream ...
1
You could repeat key code commands until the frontmost application changes:
delay 1
activate application "TextEdit"
tell application "System Events"
repeat while (path to frontmost application) is (path to application "TextEdit")
repeat 3 times
key code 123
delay 0.3
end repeat
repeat 3 times
...
1
I just did some tests : AppleScript is not well suited for what you ask since it is Single Threaded. Therefore exiting the loop in such situation does not seem possible.
Here is a code that do what you want but without exiting the loop.
tell application "VisualBoyAdvance" to activate
repeat while true
set mydate to current date
repeat while ...
1
This should do what you asked for. It will ask you to choose from a list if the user name you enter matches more than one contact and also if the selected contact has more than one email address to choose from.
set recipientList to {}
tell application "Mail"
activate
repeat
set userResponse to display dialog "who would you like to send the ...
1
I would suggest that you visit the Chrome store, get the GMail extension made by GMail, install it. Research how you find and open Chrome extension files on your disk. If I remember correctly the GMail extension has the option to make Chrome + Gmail the default Mac email application. You may learn something by exploring the code of that extension. It may ...
1
Unless you're dying to program this yourself, you should probably check out Webmailer. It does pretty much exactly what you're looking for — a handler for mailto links and other system email actions that will redirect them to Gmail, or whatever else you want (it can work with scripts or any URL you want to give it). It's no longer maintained, but I believe ...
1
I only tested this with the normal version of the preference pane, and it doesn't probably work if you have a Magic Mouse:
tell application "System Preferences"
reveal pane "com.apple.preference.mouse"
end tell
tell application "System Events" to tell process "System Preferences"
tell radio group 1 of window 1
if value of radio button 1 is 1 ...
1
By "main", do you mean the Info.plist file of your .app ?
That's Apple recommandation so far: https://developer.apple.com/library/mac/#documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW1
1
It's a problem that i have brought to their attention on multiple occasions. and as of right now, they still haven't even fixed the problem in v9 betas. so, if this is a deal breker for you (as it was for me), keep using parallels v7. it's the last one that they have that applescripting still works properly in.
1
I use an AppleScript that toggles through 3 of the 'scale' options depending on the current option...
local index1, index2, index3
set index1 to 3 -- 1440 x 900 (Best for Retina)
set index2 to 4 -- 1680 x 1050
set index3 to 5 -- 1920 x 1200 (More Space)
-- Launch "System Preferences", open the "Displays" options and change to the "Display" tab
tell ...
Only top voted, non community-wiki answers of a minimum length are eligible
