Questions tagged [applescript-objc]

AppleScriptObjC is a framework that allows Cocoa applications to be written in AppleScript. It obsoletes AppleScript Studio as of Mac OS X 10.6.

274 questions
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: --…
25
votes
4 answers

Can AppleScript access browser tabs and execute javascript in them?

I'm curious if AppleScript can access each specific tab in a browser and execute some javascript in them. Anyone have ideas?
Allan
  • 2,586
  • 5
  • 26
  • 22
16
votes
2 answers

Converting to one line AppleScript

I have a series of AppleScript commands I need to implement into a single line of AppleScript. The code is below. delay 2 tell application "System Events" to keystroke "foo" tell application "System Events" to keystroke return
walrifirir
  • 163
  • 1
  • 4
6
votes
4 answers

Swift and scriptingbridge object initialization

I'm trying to write an application for swift control iTunes. But when initializing the application returns an object of type AnyObject, but must iTunesApplication. This object does not respond to methods and variables iTunes. Who knows how to make…
WE-St0r
  • 61
  • 1
  • 5
6
votes
3 answers

How to connect a button's Sent Action in Xcode for a custom Automator Action project

I'm in the Interface Builder of Xcode, creating an Cocoa-Applescript custom Automator Action. I have a Button and a ComboBox menu in the interface. I'd like to fill the content values of the ComboBox's menu when the user clicks the Button. I've…
jweaks
  • 3,674
  • 1
  • 19
  • 32
5
votes
4 answers

How to enumerate the keys and values of a record in AppleScript

When I use AppleScript to get the properties of an object, a record is returned. tell application "iPhoto" properties of album 1 end tell ==> {id:6.442450942E+9, url:"", name:"Events", class:album, type:smart album, parent:missing value,…
Bryan Kyle
  • 13,361
  • 4
  • 40
  • 45
4
votes
2 answers

Click menu item on Mac OSX Lion using AppleScript

I have a problem using a simple AppleScript on Mac OSX 10.7.3. With the following simple AppleScript which I find everywhere OSX raises an error 'The action "Run AppleScript" encountered an error' I open up the Automator, create a Service, drop in a…
Martin Stolz
  • 5,176
  • 3
  • 21
  • 19
4
votes
1 answer

Cocoa Scripting: Accept and return NSData

In order to support binary data exchange in my scriptable Mac app, I like to make it possible to receive and deliver data as NSData, using the AS-ObjC bridge, if that's possible. For instance, I like to make this code possible in AppleScript: use…
Thomas Tempelmann
  • 11,045
  • 8
  • 74
  • 149
4
votes
0 answers

Getting window title of frontmost window everytime it changes, in Swift for macOS

Goal I want to print out to console in Swift, full window title of the frontmost window of the frontmost active application, whenever the title (or the active app of course) changes. I am quite new to both Swift/Objective-C, so I'd be also very glad…
m41w4r3.exe
  • 393
  • 2
  • 15
4
votes
1 answer

Entitlement Keys/Access Groups for Scripting Targets

I can't seem to figure out how to identify what entitlement keys are available for a given app. How does one query an application for its entitlement keys? Example: iTunes has these entitlement keys: com.apple.iTunes.playerInfo,…
4
votes
1 answer

Best Way to Handle Errors with AppleScript-ObjC embedded in Cocoa App?

I'm invoking a small AppleScript handler from within a larger Cocoa/Objective-C app (using the AppleScript-ObjC framework to call the AppleScript methods directly from the Objective-C code). I originally tried using Scripting Bridge, but that didn't…
mnemia
  • 1,549
  • 2
  • 12
  • 14
3
votes
0 answers

Passing an NSArray populated with NSDictionaries to a NSAppleScript

So I have an Apple Script that is running one of the functions of my program like so: [ NSThread detachNewThreadSelector:@selector(runAppleScriptTask) toTarget:self withObject:nil]; Using this…
3
votes
3 answers

Cocoa/Objective-C get a HFS path (path:to:desktop) from a posix path (path/to/desktop)

I am on OSX, Objective-C. I have a path/NSURL like /Users/xxx/Desktop/image2.png But i pass it to a third party application that excpects finder pathes like Harddisk:Users:Desktop:image2.png Is there any method (i can't find) to convert pathes…
Pat_Morita
  • 3,355
  • 3
  • 25
  • 36
3
votes
0 answers

Activate Personal Hotspot with AppleScript (on a Mac)

On a Mac, how do I activate the "Personal Hotspot" feature using a script? These are the steps I need to take without the script: (have your iPhone near you, connected to your Apple ID) (have your Mac/MacBook logged into the same AppleID) . click…
oa-
  • 361
  • 1
  • 3
  • 14
3
votes
1 answer

Struggling to open a file from an Objective-C path in ApplescriptObjC

I am an experienced Cocoa programmer and an Applescript newbie. I need to program a Microsoft-based report generator. I started with the Applescript bridge and basically hit a wall with Word. I am now trying with ApplescriptObjC, and I am struggling…
1
2 3
18 19