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

You can open an app by bundle id too, and give other parameters. If there’s an executable script test.sh in the current directory, the following command will open and run it in Terminal.app open -b com.apple.terminal test.sh The only down side that I can find is that Terminal doesn’t appear to inherit your current environment, … Read more

Can you execute an Applescript script from a Swift Application

As Kamaros suggests, you can call NSApplescript directly without having to launch a separate process via NSTask (as CRGreen suggests.) Swift Code let myAppleScript = “…” var error: NSDictionary? if let scriptObject = NSAppleScript(source: myAppleScript) { if let output: NSAppleEventDescriptor = scriptObject.executeAndReturnError( &error) { print(output.stringValue) } else if (error != nil) { print(“error: \(error)”) } … Read more

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

Don’t despair, since OSX you can also access sed and grep through “do shell script”. So: set thecommandstring to “echo \”” & filename & “\”|sed \”s/[0-9]\\{10\\}/*good*(&)/\”” as string set sedResult to do shell script thecommandstring set isgood to sedResult starts with “*good*” My sed skills aren’t too crash hot, so there might be a more … Read more

open programs with applescript

Try this. Notice you use “-e” when you are writing the command. Without “-e” you would give a path to an applescript to run. Also notice the string command must be in quotes. osascript -e “tell application \”iTunes\” to activate” And if you have a multi-line applescript you use “-e” before each line like this… … Read more

AppleScript Editor record doesn’t work

You can use the Record feature of the Automator to record the UI interaction steps needed to do the relevant workflow. Then you can then literally select and copy the recorded steps in automator and paste them into a new Applescript Editor window. This will give you applescript which may or may not work. You’ll … Read more

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

let me start with this script (for Xcode 4.2.1), Open an XCode project at /this/path/project.xcodeproj (done) Duplicate an existing target and rename it (not implemented) Edit the Build Settings of the new target (done) Add a group to the Source and Resources section, then rename them (done) Add source files to the groups, and add … Read more

techhipbettruvabetnorabahisbahis forumuedueduedusedusedueduseduseduedusedu