Tuesday, January 16, 2018

#1 2012-06-05 10:05:01 pm

rowesiffj
Member
Registered: 2012-06-05
Posts: 1

Duplicating output Grrr

Sorry if this has been posted other places. Im running automator to do the following:
Find Finder items that contain MLS in the name
   Run Applescript
      set sourceFolder to choose folder with prompt "choose source folder"
      set destinationFolder to choose folder with prompt "choose destination folder"
      tell application "Finder"
    set allAliases to every alias file of sourceFolder
    repeat with oneAlias in allAliases
        duplicate (get original item of oneAlias) to destinationFolder
    end repeat
      end tell
   Run Applescript
     property theList : {"doc", "docx"}

     on run {input, parameters}
    set output to {}
    tell application "Microsoft Word" to set theOldDefaultPath to get default file path file path type documents path
    repeat with x in input
        try
            set theDoc to contents of x
            tell application "Finder"
                set theFilePath to container of theDoc as text
               
                set ext to name extension of theDoc
                if ext is in theList then
                    set theName to name of theDoc
                    copy length of theName to l
                    copy length of ext to exl
                   
                    set n to l - exl - 1
                    copy characters 1 through n of theName as string to theFilename
                   
                    set theFilename to theFilename & ".pdf"
                   
                    tell application "Microsoft Word"
                        set default file path file path type documents path path theFilePath
                        open theDoc
                        set theActiveDoc to the active document
                        save as theActiveDoc file format format PDF file name theFilename
                        copy (POSIX path of (theFilePath & theFilename as string)) to end of output
                        close theActiveDoc
                    end tell
                end if
            end tell
        end try
    end repeat
    tell application "Microsoft Word" to set default file path file path type documents path path theOldDefaultPath
   
   
    return output
      end run
Move Finder items to Specific Folder

The short of it is I need to grab alias files, turn them into pdf's, and place them somewhere else. The great thing is that it works, but I'm getting a duplicated output on my desktop....??????
CONFESSION: complete newbie, no programming experience. I found the scripts above from other posts.

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)