Skip navigation
Active_rod
Currently Being Moderated

file path applescript broken after snow leopard

Nov 12, 2009 1:34 PM

I was using this script in illustrator cs4 on a mac running 10.5 and all was good

 

tell application "Adobe Illustrator"

activate

set theName to name of current document

set theNamecount to count of theName

set thePath to the file path of current document as string

set pathCount to count of thePath

set pathCount to (pathCount - theNamecount)

set newPath to (text 1 thru pathCount of thePath)

set newName to "Die for " & theName

set finalPath to newPath & newName

 

save current document in file finalPath as eps ¬

with options ¬

{class:EPS save options, compatibility:Illustrator 8, preview:color Macintosh, embed linked files:true, include document thumbnails:true, CMYK PostScript:true, PostScript:level 2, embed all fonts:true}

beep 2

activate

end tell

 

Then I upgraded to Snow Leopard now when i run the script I get this message

 

error "Can’t make «data fss 9CFF84A2B8001F4F75747369646520436F7665722046696E616C20312342384132413 32E61690000000064E76706D8298F1EE9D902207CE1FFBF28E1FFBF88578F1EE9D9022 0» into type string." number -1700 from «data fss 9CFF84A2B8001F4F75747369646520436F7665722046696E616C20312342384132413 32E61690000000064E76706D8298F1EE9D902207CE1FFBF28E1FFBF88578F1EE9D9022 0» to string

 

Thanks in advance.

Rod

 
Replies
  • Currently Being Moderated
    Nov 13, 2009 11:32 AM   in reply to Active_rod

    oddly enough seems like illustrator is giving you an outdated "file specification" object(class fss means that), which i think it has been deprecated since snow leopard. since i can't test it right now you might want to change that line to:

     

    set theOutdatedPathObj to the file path of current document

    set thePath to (POSIX path of theOutdatedPathObj) as string

     

     

    hope it helps.

    cheers;

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 19, 2009 8:06 PM   in reply to Active_rod

    G'day

     

    I have the same problem.

     

    tell application "Adobe Illustrator"

    set theOutdatedPathObj to the (current document's file path)

    --set fp to (POSIX path of theOutdatedPathObj) as string

    end tell

     

    returns

     

    «data fss 9CFF6D0609001B33303234302D3930343537205B436F6E7665727465645D2E657073C C4C000000016169465323E0EF181D9698CC1D5D5A34BFFFCCF0636F72650000000A033 B»

     

    What can I do to fix, please?

     

    Regards

     

    OzSanta2

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 20, 2009 4:43 PM   in reply to Active_rod

    G'day Rod

     

    Your script returns...

     

    error "Can’t make POSIX path of «data fss 9CFF6D0609001B33303234302D3930343537205B436F6E7665727465645D2E657073C DCC000000016169465323ECF0381D9748CC1D5E0A34BFFFCE70636F72650000000A033 B» into type string." number -1700 from POSIX path of «data fss 9CFF6D0609001B33303234302D3930343537205B436F6E7665727465645D2E657073C DCC000000016169465323ECF0381D9748CC1D5E0A34BFFFCE70636F72650000000A033 B» to string

     

    I'm running an intel iMac, so perhaps it's something to do with that.

     

    I'm now using this very cumbersome approach...

     

    on FetchFileContainer()

    tell application "Adobe Illustrator"

    set fp to do javascript "activeDocument.path"

    end tell

    set fp to my convertString(fp, "%20", " ") as text

    set newerPath to (POSIX file fp) as text

    set newerPath to newerPath as text

    if "Desktop" is in newerPath then

    set newerPath to newerPath & ":"

    repeat 3 times

    set o to offset of ":" in newerPath

    try

    set newerPath to items (o + 1) thru end of newerPath as text

    on error

    if newerPath = "Desktop:" then set newerPath to ""

    end try

    end repeat

    set ptd to path to desktop as text

    set newerPath to ptd & newerPath

    end if

    set C to newerPath

    if "desktop" is not in newerPath then

    set o to offset of ":" in newerPath

    set newerPath to items (o + 1) thru end of newerPath as text as alias

    tell application "Finder"

    try

    set C to container of (newerPath)

    end try

    end tell

    end if

    return C as text

    end FetchFileContainer

     

    on convertString(tString, ToFind, Tochange)

    set {oAStid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ToFind}

    set tString to text items of tString

    set AppleScript's text item delimiters to Tochange

    set tString to tString as string

    set AppleScript's text item delimiters to oAStid

    return tString

    end convertString

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 21, 2009 6:17 AM   in reply to Active_rod

    Santa, try…

     

    app.activeDocument.path.fsName;

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points