applescript help move files after converting.

Discussion in 'AppleScript' started by aaabha, Mar 14, 2011.

  1. aaabha

    aaabha New Member

    Jun 26, 2010
    Likes Received:
    Good Day!

    I quite a newbie in applescripting... I have created a script that resaves a .tif file into .eps using illustrator 10. What I want is the user will select the tiff original folder and the eps destination folder... it selects all the tif files in the original folder open it in illustrator resaves it into eps and move that eps to the destination folder. On my script the eps file staying on the original folder.

    set the topLevelFolder to choose folder with prompt "Source Folder?" as string
    tell application "Finder"
    set AllFiles to name of every file of folder topLevelFolder as list
    end tell

    set myPath to choose folder with prompt "Destination folder?" as string

    tell application "Finder" to set fileName to AllFiles

    tell application "Adobe Illustrator 10"
    repeat with i in AllFiles
    set OpenThisDoc to ((topLevelFolder as string) & i) as alias
    open OpenThisDoc
    if (count of documents) > 0 then
    set myInteractLevel to user interaction level
    set user interaction level to never interact
    set myPath to file path of document 1 as string
    if myPath ends with ".tif" then
    repeat with myPage from 1 to 1
    open alias myPath with options {page:myPage}
    set myNewPath to myPath
    repeat with myCharNum from (count of characters of myNewPath) to 1 by -1
    if character myCharNum of myNewPath = "." then
    if myCharNum > (count of characters of myNewPath) - 5 then set myNewPath to (text of characters 1 thru (myCharNum - 1) of myNewPath) as string
    exit repeat
    end if
    end repeat
    set myNewPath to myNewPath & ".eps"
    save document 1 in file myPath as eps
    close document 1 saving no
    end repeat
    end try
    end if
    set user interaction level to myInteractLevel
    end if
    end repeat
    end tell
    thanks in advance

    aaabha, Mar 14, 2011
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.