applescript-objc

How to use NSAutoreleasePool in AppleScriptObjC

旧城冷巷雨未停 提交于 2019-12-20 04:37:18
问题 I am wondering how to stop another function from a background function. In addition, I have to drain NSAutoreleasePool, but I don't know how to do it. I think this app sometimes freeze if I don't release pool. property i : 0 property myLabel : missing value on myStartButtonHandler_(sender) my performSelectorInBackground_withObject_("start", missing value) -- This code prevents "Stop" Button from freezing. end myStartButtonHandler_ on myStopButtonHandler_(sender) -- I want to stop start()

Save a user popup selection in a custom Automator Action

梦想与她 提交于 2019-12-13 15:31:39
问题 Using Xcode 5.* for a cocoa-applescript automator action. Interface is a a simple popup menu that gets populated using an outlet with: tell thePopupMenu to removeAllItems() tell thePopupMenu to addItemsWithTitles_(theList) When the action is used in a workflow (a Service actually), I want the next time it is run and the action dialog shows up (I will have "Options:Show when run" selected), I want the popup menu to change the selection to the last one that was selected. Right now, the default

cocoa-applescript: Determinate progress indicator

女生的网名这么多〃 提交于 2019-12-12 06:19:21
问题 I am making an application using Cocoa-Applescript which identifies local IP addresses which are up and running, by pinging x.y.z.[1-255] and appends running IPs to a text file. I already have a GUI for choosing x, y and z and have already made the script to ping each address: repeat 255 times try do shell script "ping -o -t 1 -c 1 " & ipstamp & num4 do shell script "echo " & ipstamp & num4 & " >>/Users/DJ/Desktop/GoodIPs.txt" end try set num4 to (num4 + 1) end repeat Where ipstamp is x.y.z

AppleScript works wonders on its own but does not work when called from the plugin

a 夏天 提交于 2019-12-11 17:58:57
问题 I know that using AppleScript cannot get access to the content of the newly created user-writing, so I use GUI Scripting. But I want Mail.app to contain its own button, which has added to the newly created files I send from my desired directory. I have a plugin for Mail.app have a script that is called by my own button. The script works wonders on its own, but it does not work when called from the plugin. What am I doing wrong? error { NSAppleScriptErrorAppName = "System Events";

Using ApplescriptObjC to convert color spaces of an image using NSColorSpace and iccProfileData

空扰寡人 提交于 2019-12-11 15:59:51
问题 I have some code that will change an images colorspace from RGB to a GenericCMYK profile. I would like to be able to use an ICC Profile to convert the image to a CMYK colorspace. There is a way to do this in Photoshop, but the process takes too much of a users time when you are dealing with 100's of images, I am trying to create an AppleScript droplet that will do this for them. I have already looked at the page for NSColorspace and there looks like there is a way to do this. I just have no

set volume not working in xcode with applescript cocoa objc

前提是你 提交于 2019-12-11 11:46:21
问题 I have an applescript xcode project in xcode 3.2 and am trying to change the system volume...however it doesn't work...it either stops the nstimer or doesnt do anything at all... Is there a way to log the errors so that I can pinpoint the issue? Here is my code set newVolume to 50 set volume output volume newVolume textName's setStringValue_(currentVolume) set currentVolume to newVolume obv this is a much more condense version but this literally does not work...it is inside of an NSTimer but,

How do I interprete a record returned as a NSAppleScript result

£可爱£侵袭症+ 提交于 2019-12-11 10:53:24
问题 I run an applescript from an objective-c application using NSAppleScript the executeAndReturnError method. This returns an NSAppleEventDescriptor object containing the result of the script. My script returns an applescript record. How do interpret the record in objective-c? For instance if the returned script record is { name:"Jakob", phone:"12345678" } how do I get the string "Jakob" in the name property? 回答1: Here's a method to convert the record to a dictionary. Note that I didn't try this

“POSIX file” works in Applescript Editor, not in XCode

旧时模样 提交于 2019-12-11 06:46:48
问题 Try this: Make a new XCode4 Applescript project. In the delegate, paste this code: on doIt_(sender) set goodHFSLoc to (path to desktop folder) set test1 to (POSIX path of goodHFSLoc) log "test1:"&test1 set theJSPath to "/Users/dave/Desktop/MakeTSLabels.js" set jsHFSFile to (POSIX file theJSPath) set test2 to (POSIX path of jsHFSFile) end doIt_ Hook this method up to a button in the UI window. Run the program Click the button, and you should get this error: Can’t get POSIX path of class

NSImage release() in AppleScriptObjC

◇◆丶佛笑我妖孽 提交于 2019-12-11 04:29:16
问题 I'm creating a Table View with small images displayed in each row. The data source holds an image for each row of an table. I create images thru set img to NSImage()'s alloc()'s initWithContentsOfFile_(thePath) . Next I display the image of selected row in bigger, browser view thru set imageView's image to img . Problem is that I'm running out of memory because I use the same representation for both views. (Images are around 500x400). I'm trying to figure out how to make a smaller version

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

本秂侑毒 提交于 2019-12-10 21:14:02
问题 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 like that or get them out of an NSURL (if possible without string modifying)? In AppleScript it is return POSIX file "/Users/xxx/Desktop/image2.png" --> Harddisk:Users:xxx:Desktop:image2.png EDIT : This is pretty much the same: Cocoa path string