2

We are developing an application for the Mac App Store using Qt 5.2.0.Framework on Mac OS X 10.9.

Here is a simple AppleScript which convert a .PNG image to .jpeg image.

tell application "Image Events"
    lanuch
    set theImageRef to POSIX file ":private:var:root:Desktop:1.png"
        tell theImageRef
              save in ":private:var:root:Desktop:save.jpeg"
              close
        end tell
end tell

This AppleScript works in a non-sandboxed application. It fails in a sandboxed application.

My question is: How do you use an AppleScript in a sandboxed application? Or is there an alternative to this?

pkamb
  • 33,281
  • 23
  • 160
  • 191
A_kumar
  • 401
  • 1
  • 4
  • 12

1 Answers1

0

There are several alternatives to this:

To use AppleScript within a sandboxed Application you want to use Target Access Groups as described here. But you will have problems to find an App that supports Target Access Groups unless you write your own. But then why use AppleScript for image processing?

The bundle-identifier to use in the entitlements is "com.apple.imageevents".

Community
  • 1
  • 1
mahal tertin
  • 3,239
  • 24
  • 41
  • I have a multiple apple script for image which convert to one format to another format(.png,.pnb,.sd,.tiff,.pdf etc.) which possible only for using apple script .I am not identify the entitlements keys for run my apple script. your above link is work successfully in case of MSExcel file. but i am not get the entitlements key.define the entitlements key with value which run my apple script. – A_kumar Apr 29 '14 at 03:13
  • @anuj You would need to add com.apple.imageevents to the entitlements. Either for another Item in the temporary-exceptions or the scripting-targets. – mahal tertin Apr 29 '14 at 10:46
  • This key (com.apple.imageevents) is not work for convert the image one format to another .Above,see the screen shot for entitlements file. – A_kumar Apr 30 '14 at 03:21
  • what's the error you see in the sandbox violations in Console.app? – mahal tertin Apr 30 '14 at 08:42
  • According me,My apple script is not load in NSApplescript object. – A_kumar Apr 30 '14 at 10:59
  • Image event scripting is not loaded in NSApplescript class("script load error"). but If I run the app with sandboxing disabled, it works perfectly with exactly the same script(when sandboxing disabled then no loaded error found by the Image event scripting). – A_kumar May 01 '14 at 04:35
  • I am regular work on imageevent . but I am not find the exact solution which run my applescript. – A_kumar May 06 '14 at 05:12
  • If you are provide the alternate method which convert GIF,PDF,PICT,PSD,SGI,TGA to PICT,PSD,JPEG . – A_kumar May 06 '14 at 05:16
  • This is a completely new question. I added some links in my answer to other questions on saving image objects to files. And you would also need to load the image first. – mahal tertin May 07 '14 at 16:06