Convert to ASOC

how do I convert the following to ApplescriptObjC:

NSString *path = [bundle pathForResource:@“IPMenuIcon” ofType:@“tiff”]

I am trying to get photoshop to open a file that i have placed inside the application bundle.

thanks in advance for the help!

Hi,

look at this thread

thanks that was helpful.

I cannot get photoshop to see it as a file to open, can you provide any help for this.

error I get:
2011-09-19 12:03:52.703 Menulet[31239:707] *** -[MenuletAppDelegate obsCreatePSD:]: Adobe Photoshop CS5 got an error: File/Folder expected (error 1230)

You probably have a POSIX path. You need something like “thePath as POSIX file” to make it into something Photoshop understands.

I have tried many things to get this right. As a stand alone applescript it worked just the way I wanted it to. But I am now trying to learn more and am putting this in Xcode to create an application for a bunch of different scripts. This app will be a menu let…

the code that i have is:


on obsCreatePSD_(sender)
        set chosenFiles to choose file with multiple selections allowed
        tell application "Finder"
            set this_folder to (path to desktop folder)
            if not (exists folder "OBS PSD" of this_folder) then
                make new folder at this_folder with properties {name:"OBS PSD"}
            end if
            set myFile to (((path to desktop folder) as text) & "OBS PSD")
            set myPath to current application's NSBundle's mainBundle()'s pathForResource_ofType_("OBSmanny","psd")
            log myPath
        end tell
        tell application "Adobe Photoshop CS5"
            activate
            set ruler units of settings to pixel units
            set type units of settings to pixel units
            open myPath
            set testDoc to document "OBSmanny.psd"
            repeat with oneDrop in chosenFiles
                open oneDrop
                set docref to current document
                flatten docref
                set current document to docref
                set theLayer to layer 1 in current document
                
                do javascript "{var idAdobeScriptAutomationScripts = stringIDToTypeID( \"AdobeScriptAutomation Scripts\" );
                var desc160 = new ActionDescriptor();
                var idjsNm = charIDToTypeID( \"jsNm\" );
                desc160.putString( idjsNm, \"OpenAsLayer\" );
                var idjsMs = charIDToTypeID( \"jsMs\" );
                desc160.putString( idjsMs, \"C104BL09.tif\" );
                executeAction( idAdobeScriptAutomationScripts, desc160, DialogModes.NO );}"
                
                
                set ruler units of settings to pixel units
                set type units of settings to pixel units
                resize image docref height 1500 resolution 72
                if exists path item "Path 1" in current document then
                    create selection path item "Path 1" in current document
                end if
                invert selection in current document
                clear
                clear
                set theLayer to layer 1 in current document
                duplicate theLayer to testDoc
                set current document to docref
                close current document saving no
            end repeat
            set myOptions to {class:TIFF save options, image compression:none, save layers:true, transparency:true}
            save testDoc in file myFile as TIFF with options myOptions
            close current document saving yes
        end tell
        tell application "GrowlHelperApp"
            set the allNotificationsList to {"OBS_Images", "Another Test Notification"}
            set the enabledNotificationsList to {"OBS_Images"}
            register as application "Growl AppleScript Sample" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "Script Editor"
            notify with name "OBS_Images" title "OBS_Images is Complete" description "All of your images have been resized and are ready for uploading" application name "Growl AppleScript Sample"
            notify with name "Another Test Notification" title "Another Test Notification :) " description "Alas you won't see me until you enable me yourself..." application name "Growl AppleScript Sample"
        end tell
end obsCreatePSD__


Where, or how would I add your suggestion.

thanks for the help.

That should tell you that you have a POSIX path, and Photoshop will want an alias. So do something like:

set myAlias to myPath as POSIX file as alias

and then tell Photoshop to open myAlias rather than myPath.