Questions tagged [applescript]

AppleScript is an end user scripting language that has been available in Mac computers since System 7 Pro (7.1.1). It allows for automation of system tasks, communication between processes, and creation of workflows, amongst other functions.

AppleScript is a inter-application scripting language, designed to control and exchange data between scriptable applications. Users can use AppleScript to combine the functionality of multiple scriptable Mac applications to form a new application to meet their special need or demand without "reinventing the wheel".

Resources

8740 questions
43
votes
7 answers

Applescript equivalent of "continue"?

I have a simple 'repeat with' in an AppleScript, and would like to move on to the next item in the "repeat" conditionally. Basically I'm looking for something similar to "continue" (or break?) in other languages. I'm not well versed in AppleScript…
danieljimenez
  • 1,390
  • 4
  • 17
  • 26
42
votes
1 answer

How to add launch parameter to Google Chrome on Mac?

I wanna run Chrome on Mac with the parameter --enable-speech-input. Can anyone tell me the steps to do this and the steps to undo this? (If one day I wanna run Chrome without the launch parameter)
weilou
  • 4,419
  • 10
  • 43
  • 56
37
votes
6 answers

Is there a quick and easy way to dump the contents of a MacOS X keychain?

I'm looking for a way to dump (export) the contents of an OS X keychain into a file that I can easily process elsewhere, such as tab-delimited plaintext or something of the sort. The Keychain Access app does not offer any such functionality, and…
Niels Heidenreich
  • 1,257
  • 1
  • 9
  • 20
37
votes
3 answers

How do I add Applescript support to my Cocoa application?

I am new to the world of Cocoa programming, and I want to add Applescript support to my application. The examples at Apple's website seem out of date. How do I add Applescript support to my Cocoa application?
shreyasva
  • 13,126
  • 25
  • 78
  • 101
36
votes
5 answers

Send a key code to an application without activating it first?

I'm trying to send the spacebar key to an application without activating it first. The following code almost does what I want but it brings the application to the foreground first. tell application "X" activate tell application "System…
devin_s
  • 3,345
  • 1
  • 27
  • 32
36
votes
4 answers

How can one invoke a keyboard shortcut from within an AppleScript?

I need to invoke a keyboard shortcut from within an AppleScript code, e.g. Cmd+Ctrl+Opt+E.
Barton
  • 363
  • 1
  • 3
  • 4
34
votes
1 answer

How to automate creation of new Xcode targets from Applescript/Automator/Shell Script

I am currently working on a way to automate the process of adding new targets to my Xcode projects. One target has to be added to multiple Xcode projects and each target in the different project needs the same source files to be added, same groups…
orgazoid
  • 539
  • 1
  • 6
  • 10
34
votes
2 answers

Using Applescript to Execute a Complicated Keystroke

I'm trying to write an Applescript in Automator that will press the left arrow button while holding down control, option, and command. The code I have so far is: on run {input, parameters} tell application "System Events" tell…
user2620625
33
votes
5 answers

AppleScript Application is not allowed to send keystrokes

I made an app with AppleScript called FRIDAY. When I tell it to 'open chrome', it opens google chrome, this is working on Script Editor and out side of script editor. I can also tell it to 'open a new tab' and it opens a new tab using keystrokes: --…
33
votes
3 answers

AppleScript Editor record doesn't work

I have opened the AppleScript Editor and pressed Record button. Then I run TextEdit, create a file and put some text there. When I click the Stop button in AppleScript Editor, nothing was recorded, the window is blank. What is the problem?
never_had_a_name
  • 90,630
  • 105
  • 267
  • 383
32
votes
8 answers

is there something akin to regEx in applescript, and if not, what's the alternative?

I need to parse the first 10 chars of a file name to see if they are all digits. The obvious way to do this is fileName =~ m/^\d{10}/ but I'm not seeing anything regExy in the applescript reference, so, I'm curious what other options I have to do…
Yevgeny Simkin
  • 27,946
  • 39
  • 137
  • 236
32
votes
6 answers

open programs with applescript

2 part question: I'm simply trying to run programs using applescript from the terminal, so I tried: $ osascript tell application "iTunes" to activate and get the error: osascript: tell: No such file or directory Giving the full path to the program…
sabajt
  • 426
  • 1
  • 6
  • 11
31
votes
6 answers

Programmatically launch Terminal.app with a specified command (and custom colors)

I can launch an xterm from the command line (or a program, via a system call) like so: /usr/X11/bin/xterm -fg SkyBlue -bg black -e myscript That will launch an xterm with blue text and a black background, and run an arbitrary script inside it. My…
dreeves
  • 26,430
  • 45
  • 154
  • 229
31
votes
4 answers

Applescript code completion shortcut

I'm new with applescript and this may seems dumb... but I have no clue at how to auto complete the code completion in the editor!? I checked the option Use Script Assistant in the preferences. For exemples When I create a new variable then I start…
user2496478
  • 313
  • 3
  • 4
30
votes
4 answers

How would you put an AppleScript script under version control?

I was wondering if this was the best solution: Put the .applescript files under version control Create an installation script to compile the files with osacompile But there is also the .scptd directory. Or I could put both .applescript and .scpt…
charlax
  • 25,125
  • 19
  • 60
  • 71