ApplescriptObjC Get parent folder of file(s) (using container)

I'm trying to bring this little script into ApplescriptObjC
At the moment I get an error that I can only assume is to do with the alias? But i'm not sure how to correct this.
set resultFiles to (choose file with prompt "Please select images:" with multiple selections allowed without invisible) -- list of aliases
set firstFile to first item in resultFiles's contents
log firstFile
tell application "Finder" to set fileLocation to container of firstFile
set resultFilesFolder to (fileLocation as string)
In xcode I have written it like this
on loadedFiles_(sender)
        set resultFiles to (choose file with prompt "Please select images:" without invisible with multiple selections allowed) -- list of aliases
        set firstFile to first item in resultFiles's contents
        tell application "Finder" to set fileLocation to container of firstFile
        setresultFilesFolder_(fileLocation as string)
    end loadedFiles_
and my error is this
2014-06-09 15:37:32.654 OpenSesame[2081:303] *** -[AppDelegate setresultFilesFolder:]: unrecognized selector sent to object <AppDelegate @0x6080000295a0: OSAID(4) ComponentInstance(0x810000)>
2014-06-09 15:37:32.658 OpenSesame[2081:303] *** -[AppDelegate loadedFiles:]: *** -[AppDelegate setresultFilesFolder:]: unrecognized selector sent to object <AppDelegate @0x6080000295a0: OSAID(4) ComponentInstance(0x810000)> (error -10000)

Sorry I tried this, trying help from the macscripter site too.
Thanks
set openPanel to current application's NSOpenPanel's openPanel()
openPanel's setMessage:"Please select images:"
openPanel's setShowsHiddenFiles:false
openPanel's setAllowsMultipleSelection:true
set returnCode to openPanel's runModal() as integer
if returnCode = (current application's NSFileHandlingPanelOKButton) as integer then
   set firstFile to openPanel's URLs()'s firstObject()'s |path|()
   set resultFilesFolder to firstFile's stringByDeletingLastPathComponent() as text
end if

Similar Messages

  • How to get value of jca.file.IsEof using fromproperties in file adapter

    Hi Guys,
    I have a scenario where i use a file adapter for syncread (for doing chunkRead).
    While invoking this adapter i send jca.file.FileName and jca.file.Directory as input properties dynamically.
    In response i expect jca.file.IsEOF and jca.file.IsMessageRejected, for this i have done the following steps.
    1. Create a file adapter for SyncRead
    2. Create an invoke activity and input/output variables along with it.
    3. set input properties as below ..
    4. get the values of jca.file.IsEOF and jca.file.IsMessageRejected using bplex:fromproerties
    <invoke name="Invoke1"
    inputVariable="Invoke1_SynchChunked_InputVariable"
    outputVariable="Invoke1_SynchChunked_OutputVariable"
    partnerLink="SamplSyncChunkRead"
    portType="ns19:SynchChunked_ptt"
    operation="SynchChunked"
    bpelx:invokeAsDetail="no">
    <bpelx:inputProperty name="jca.file.FileName"
    variable="inputVariable"
    part="payload"
    query="/ns11:fileHeader/ns11:fileName"/>
    <bpelx:inputProperty name="jca.file.Directory"
    variable="inputVariable"
    part="payload"
    query="/ns11:fileHeader/ns11:directory"/>
    <bpelx:fromProperties>
    *<bpelx:fromProperty name="jca.file.IsEOF" variable="isEndofFile"/>*
    *<bpelx:fromProperty name="jca.file.IsMessageRejected" variable="istheMessageRejected"/>*
    </bpelx:fromProperties>
    </invoke>
    5. Flow of the project is fine but im not getting the fromProperty values assigned to variables.
    Note : rather using from proerties like give below
    <bpelx:fromProperties>
    *<bpelx:fromProperty name="jca.file.IsEOF" variable="isEndofFile"/>*
    *<bpelx:fromProperty name="jca.file.IsMessageRejected" variable="istheMessageRejected"/>*
    </bpelx:fromProperties>
    if i use output proerties as given below it is not working..
    <bpelx:outputProperty name="jca.file.isEOF" variable="isEndofFile"/>
    <bpelx:outputProperty name="jca.file.IsMessageRejected" variable="istheMessageRejected"/>
    Any suggestions on this ???
    Thanks in advance guys...

    Thanks veejai...
    i have used the following properties in my code..
    <bpelx:fromProperties>
    <bpelx:fromProperty name="jca.file.IsEOF" variable="isEndofFile"/>
    <bpelx:fromProperty name="jca.file.IsMessageRejected" variable="istheMessageRejected"/>
    </bpelx:fromProperties>
    if i use output proerties as given below it is not working..
    <bpelx:outputProperty name="jca.file.isEOF" variable="isEndofFile"/>
    <bpelx:outputProperty name="jca.file.IsMessageRejected" variable="istheMessageRejected"/>
    any suggestion on <bplex:fromproperties> ??

  • How to get the active document file name using illustrator CS2 plugin code?

    I wanna take file name from active document using illustrator plugin CS2. Plz anybody help me..
    Thanks in advance..

    AIDocumentSuite::GetDocumentFileSpecification() should get you that information. Note that it will only work properly if you've already saved the document (or opened it from a file). I'm not sure what the result looks like if you're calling that on a new, unsaved file.

  • Get Parent Community from Current Comm using the G6 PRC

    Can anyone provide or point me to a sample of code that gets the Parent Community ID from the current community using the G6 PRC? I can find samples of doing this in this discussion, but they appear to reference older versions of the EDK. Ideally, given the current community ID, I would like to walk backwards through the hierarchy until I find the root community (the community with no parent ID).
    Thanks in advance,Jeff

    Have you thought about using pt:standard.tree instead of rolling your own?
    Chris Bucchere | bdg | [email protected] | www.bdg-online.com

  • How can I open a file and get the data inside  file when using  WebStart

    When I use ClassLoader,
    Which methold can I use the read the information inside that file?
    Thanks
    Ryan

    Assuming you are trying to read the jar file.
    http://forum.java.sun.com/thread.jspa?forumID=22&threadID=572955
    rykk

  • How to get Bursting file to use the same template as selected by user

    I have created an XML publisher bursting control file for a standard Oracle report Direct Debit letter.
    The user wants to be able to select from a number of different letter templates which is ok except that the bursting control file is fixed to use one template.
    How can I get the bursting control file to use the same letter template as selected by the user when running the report ?
    I am using XML Publisher 5.6.3 with bursting patch.

    Try these following, which come to my mind now as of now.
    In the bursting file, you can do the filtering and apply different template..
    <xapi:template type="rtf" location="/usr/template1" filter=".//DIRECT_DEBIT[./parameter_or_element='first_template']"></xapi:template>
    <xapi:template type="rtf" location="/usr/template2" filter=".//DIRECT_DEBIT[./parameter_or_element='second_template']"></xapi:template>
    second option..
    you can replace the element from the xml in the bursting control file.
    ${ELEMENT_NAME}
    can be used in the template name i guess..
    <xapi:template type="rtf" locale=""
    location="xdo://AR.${SHORT_NAME}.en.US/?getSource=true" translation="" filter="">
    </xapi:template>
    But in this short name has to be in XML file...
    I haven;t tried it...wil try it wheni get time..

  • Slow loading when creating a new folder or deleting a folder or file

    Hello! Before we begin, a little information. This problem only started occurring AFTER I updated to Mavericks. I have been through every operating system since Snow Leopard and NEVER had this problem until Mavericks. It has been palguing me since I updated in October and I need some answers. Seeing as how I do not feel like paying $59 to ask apple for help in this matter I'm coming to the community. This is an odd problem where finder doesn't seem to want to load certain actions properly. In my case, creating a new folder, deleting a folder or file, and using the "always open with" function.
    In terms of creating a new folder, anywhere in finder, the folder will not appear immedlately, insetad it takes a staggering 5-10 seconds to appear where I created it. For deleting a folder or file, the same thing happens. It takes a huge amount of time to move the folder or file to the trash bin, UNLESS I open a different folder or file in the same directory after deleting said folder or file, in which case it moves right away. And the "always open with" checkbox just doesn't work at all.
    About my platform: Intel iMac (Late 2009) 3.6 GHz Intel Core 2 Duo, 12 GB 1067 MHz DDR3, 220 out of 499.75gb hard drive space. OS X version 10.9.2
    Thanks in advance for any help in these matters.
    You guys helped me solve the unchangeable background problem when apple couldn't, so I'm reaching out to you again for that awesome support I know you guys have in you

    Adobe contacted me and had me reset my prefereneces for flash using their steps. I have done that and a complete uninstall/re-install and searched for corrupted fonts and still I am having the same issue and adobe support appears to have just left me hanging.
    Is there anyone here who has experienced this same issue that can offer any assistance to solve this issue. As it stands right now I have a product I cannot even use and that is troublesome to say the least.
    Thanks for any help you can offer.

  • Rendering error message:File in use

    Please help, I am trying to print a project to video but in the rendering process I get the error message: File in use by this or another application. I have no files in use in another application. MAC support is unfamiliar with the message and recommends uninstalling FCP and re-installing. Any other ideas as I am afraid of losing the project. Any help would be appreciated. Thanks, G.
    G5   Mac OS X (10.3.9)   FCP HD 4.5
    G5   Mac OS X (10.3.9)   FCP HD 4.5

    If you rerender does the error go away? I know this comes up with Tiger and spotlight. I just disabled spotlight for my media drives. It does not look like you are running Tiger, usless your auto info has not been updated.
    If you cannot render at all, then is is not spotlight.
    I would try braking the timeline down in 1/2s. keep going until you get a render that works. You may be able to track down the exact clip that is having a problem. Good luck
    Bob

  • Getting path of parent folder of a file during a workflow execution

    How can I get the parent folder/directory of a file during the execution of a workflow? I cant't find any actions i Automator that will give me this.
    I want to make a general applicable automated workflow. The path can not be hardcoded in the workflow as different files and folders will be worked on each time the workflow is run.
    The input to the workflow is a file or list of files. I want to be able to retrieve the path of the parent folder of these files at runtime.
    Will I have to do this through AppleScript? If so, then how?
    (in case you have seen my first post on this; it seems I wasn't specific enough so people didn't understand what I want to do. Therefore this second post. Sorry for the iconvenience)

    Hi anilsen!
    If all selected files are within the same folder, it would be like this:
    For example:
    • Get Specified/Selected Finder Objects
    • Run AppleScript
    on run {input, parameters}
    tell application "Finder"
    set output to (container of item 1 of input) as alias
    end tell
    return output
    end run
    Spazek

  • [Win VC++ 6.0 ]How to get the number of files count in a folder using VC++ 6.0?

    Hi all,
    Can any one tell how to get the number of files(.EPS) count inside a folder when the folder path is specified in VC++ 6.0?
    Thanks in Advance.
    Regards
    myriaz

    I'm a little confused by the question, but it sounds like you're asking how to count the number of files with a particular extension in a given directory? That's not really an AI SDK question, but it's a fairly easy one to find if you google it. If you're trying to use Illustrator to do it, AI doesn't have a general purpose file API. It has a few functions to do some things that Illustrator needs, but I don't think enumerating directories is one of them.

  • Getting the path of the parent folder of a file?

    How can I get the parent folder/directory of a file? I cant't find any actions i Automator that will give me this.
    Will I have to do this through AppleScript? If so, then how?
    Anders

    Mine should work as a stand-alone applescript droplet (save it as an application) from Script Editor.
    This code will work in an Automator "Run Applescript" Action after a "Get Selected Finder Items" action:on run {input, parameters}
    set pathList to {}
    repeat with itemNum from 1 to count of input
    tell application "System Events"
    copy POSIX path of (container of (item itemNum of input)) to end of pathList
    end tell
    end repeat
    return pathList
    end run
    It returns an Applescript list of each path for all the selected finder items. I had to change (number of items of) to (count of) as it failed in the Automator workflow.
    If your workflow will only process one item at a time, then this will work in the workflow:on run {input, parameters}
    tell application "System Events"
    set thePath to POSIX path of (container of (item 1 of input))
    end tell
    return thePath
    end run

  • POWER QUERY Get External Data From File From Folder (Excel 2013)

    Hi,
    Beginner's question :
    What could be the use of the query on a folder : we just get a list of files with their path. What can we do with that?
    Thanks

    Hi,
    Do you want to combine data from multiple Excel Files in the same folder path into one table? If I understand correct, we can add a custom column to import the data.
    After we getting a list of files with their path, the Query Editor window will activate to show you a table containing a record for each file in the chosen directory. These will provide our function with the needed FilePath and FileName parameters. 
    Function sample: File name([Folder path],[Field name]
    For more detailed steps, please see the article:
    http://datapigtechnologies.com/blog/index.php/using-power-query-to-combine-data-from-multiple-excel-files-into-one-table/
    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • Automator and applescript to copy new files in a folder with same name as parent folder

    I have an iMac with a pictures folder (Finder folder) containing several subfolders with pictures. As per now, all these subfolders are imported into an iPhoto library (and the structure of the Finder pictures folder is thus maintained: The iPhoto events are named the same as the Finder subfolder). I.e. I have not created any albums in iPhoto.
    I have also set up a workflow, where new iPhone photos are automatically being synced to specified Finder folders within the iMac pictures folder. So what I want to do is to make a workflow to import potential new photos from week to week into the existing iPhoto structure. I know iPhoto has this Autoimport folder, so this one is unpacked and "mapped". So, this is what I´m hoping to do:
    Automator (iCal - want to do this on a weekly basis):
    - Get specified Finder items -- set to target folder = iMac pictures folder
    - Get folder content (with subfolders)
    - Filter Finder items
         - Items from the last 7 days (which then would be any new files created last week)
    - Applescript/shell script loop(?)
         - Get folder name for each file´s (from previous step) parent folder
         - Create new folder with same name as the file´s parent folder (if not already existing) under the iPhoto Autoimport folder
         - Copy the given file into the folder from above
    - Run iPhoto application (Automator task), which then should just auto import the new photos according to the Finder folder structure
    Whith the workflow above, I aim to maintain the existing iPhoto structure, and just import new photos into the existing structure. Creating folder names under the Autoimport, similar as the existing Finder folder names / iPhoto events should make it possible to have the new files imported under the existing event, right?

    Anyone?
    I have now switched to Aperture (from iPhoto) due to Aperture´s capability to handle Finder folder structure, and due to the possibility of having the pictures within Aperture as referenced files to the pictures within the Finder folders (i.e. possibility to delete pictures from both library and Finder folder at the same time).
    So I have a superior Finder folder called "Album". Within "Album" I have several subfolders (sub albums) containing pictures. The "Album" folder with subfolders are imported into Aperture as "Projects and albums", and the pictures are uploaded within the Aperture structure as referenced files. So for now the Aperture structure is more or less a direct mirror of the Finder folder structure, whereas "Album" is the project.
    And this is my current workflow in Automator, but I´m searching help with my Applescript:
    - Get specified Finder items (target folder = the superior Finder folder "Album")
    - Get Folder content
    - Filter Finder items (to look for potential new files to import into Aperture)
         - Kind is not folder
         - Date created last X days
    The output files from this task enters an Applescript
    on run {input, parameters}
           repeat with f in input (**Loop**)
                   tell application "Finder"
                          set fileName to name of (f)
                          set parentFolder to name of container of (f)
                          tell application "Aperture"
                                 tell library 1
                                        tell project "Album"
                                               if (exists album parentFolder) then
                                                 ** I then would like to check if fileName already exist within the existing album**
                                                 ** If not existing, I would like to import file f into the existing album as a referenced file**              
                                               else if not (exists album parentFolder) then
                                                       make new album with properties {name:parentFolder}
                                                ** I then would like to import file f into the new album as a referenced file**
                                               end if
                                        end tell
                                 end tell
                          end tell
                   end tell
           end repeat
    end run

  • I am using itunes 10 and trying to consolidate my files.  I keep getting the error "Copying files failed.  The file name was invalid or too long".  How can I indentify what file is causing this problem or resolve this issue?

    I am using itunes 10 and trying to consolidate my files.  I keep getting the error "Copying files failed.  The file name was invalid or too long".  How can I indentify what file is causing this problem or resolve this issue?

    BUMP
    Yes, I just get that message. I don't see how I could investigate this problem.
    I didn't mention that this happened when I was consolidating my library, not copying files to another computer.
    In other words, I'm using a "normal" itunes procedure, itunes won't complete it, and won't tell me exactly why or how to figure out how to fix it...
    Is there at least some easy way to tell which files were successfully copied to my itunes music folder so I can work on moving the uncopied files?
    Can anybody help me?

  • My partner deleted my itunes (10) library. I use a WD external back-up and retrieved my itunes library, but when i try to play a song i get the message 'could not be used because the original file could not be found Would you like to locate it?'

    My partner deleted, by accident my itunes library. I have an iMac 10.6.7, Itunes 10. I use an WD passport as an external back up and retrieved my itunes library but now get the message "could not be used because the original file could not be found. Would you like to locate it?" so itunes is not recognised the exclamation marked songs, how do i get the retrieved files recognised. At times I get fed-up with Apple blocking files being used, although I like the product its restrictions are so silly!

    You not only have to retrieve the library file from the backup drive but the actual music files (usually stored within the "iTunes Media" folder) as well.

Maybe you are looking for

  • Cannot send email from icloud account from mac

    cannot send email from icloud account from mac running 10.8.2

  • Need to execute bat file by GPO with admin rights

    Hi all I created a specific bat file that run regini.exe with specific parameters to set a specific permission in a specific registry key. I can execute this bat file from GPO but I need that this bat runs with domain admins rights otherwise script n

  • Feedback form working!

    I have at last got my feedback form working in a reasonably presentable manner. If you would like to test it, go to http://localhost/Corybas/index.php, click the yellow envelope at the bottom right of the home page, and send me a message. When I get

  • Mouse over effect for Button

    Hi,     I have a button inside a vbox. I need to give mouse over effect to that button. Please give me the code. Regards, Jayagopal.

  • How to reinstall ios7 on iPhone 4s

    I installed the ios7 update on my iphone 4s shortly after it was released. Everything went well except my connection to Comcast, it screwed up my emails and I could not access my Comcast emails unless I downloaded the Comcast Xfinity app.  My husband