Skip navigation

Script not functioning outside editor

444 Views 6 Replies Latest reply: Feb 28, 2013 5:22 PM by A.P.M. Wülfinghoff RSS
A.P.M. Wülfinghoff Level 1 Level 1 (5 points)
Currently Being Moderated
Feb 23, 2013 1:17 PM

This programme works perfectly in the Applescript editor and so it does when placed as an Applescript within a Filemaker Pro script, except for the last lines.

 

 

 

--tell application "FileMaker Pro"

  set album_title to cell "album_title" of current record & ".jpeg"

--end tell

 

 

set url_path to "Macintosh HD:Users:<me>:Documents:POPMUZIEK:ALBUM COVERS POP:"

set tekst to ""

 

 

tell application "Finder"

  activate

--reveal items of desktop

  select document files

  display dialog "Search file and click" with title "" buttons {"ok"}

  set picture to (choose file)

  repeat

  display dialog "Chosen file is > " & picture with title "" buttons {"ok", "again"} default button 1

  if button returned of result = "again" then

       set picture to (choose file)

  else

       set name of picture to album_title

        set tekst to name of picture

       exit repeat

  end if

  end repeat

 

set the clipboard to tekst

 

---------------------------------------------------the next two lines are completely ignored, even the display etc. statements

--display etc

open location url_path

--display etc

move picture to url_path


end tell

 

Any idea what might be going on?

iMac, OS X Mountain Lion (10.8.2), FileMaker Pro 11; iTunes 11.0.1 (12
  • VikingOSX Level 5 Level 5 (4,695 points)
    Currently Being Moderated
    Feb 23, 2013 3:02 PM (in response to A.P.M. Wülfinghoff)

    I have a natural question when reviewing your AppleScript. Are there language variants of AppleScript, and in particular, the use of localized (NL) tekst for the English text? Since this appears on the last line before the ignored statements, and is the only deviation from English in the entire AppleScript, I was just curious.

     

    On further study, I think I answered that question.

  • HD Level 4 Level 4 (3,240 points)
    Currently Being Moderated
    Feb 25, 2013 5:17 AM (in response to A.P.M. Wülfinghoff)

    Hi,

     

     

    In your script, url_path is a string of characters in the form of a file system reference, not a path or a file system reference in itself.

     

    I can't test this at the moment, but I think AppleScript Editor is doing some hidden coercion which doesn't happen when the script is run from FMP. You may need to force the coercion of url_path within the script.

     

    How does this work:

     

     

    tell application "Finder"

    ....... main script....


    set the_folder to folder url_path -- this is the coercion

    completely ignored, even the display etc. statements

    --display etc

    open the_folder

    --display etc

    move picture to the_folder


    end tell

     

    (There isn't any need to open the folder in order to move the files into it.)

  • twtwtw Level 5 Level 5 (4,580 points)
    Currently Being Moderated
    Feb 25, 2013 7:52 AM (in response to A.P.M. Wülfinghoff)

    open location is meant to open internet-scheme urls in the default browser.  try open location "http://www.google.com" and see what happens.  if you're just trying to open a folder in the Finder, say open folder the_folder.

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.