Automator and Applescript

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Automator and Applescript Sun Nov 05, 2017 7:59 pm • by Razzle
I am having problems putting a file in each subfolders after creating the subfolders. Using automator to creating the subfolders and then using AppleScript to populate the subfolder with a file.

I select the folder in automator then pass this folder in a variable Myfolder over to AppleScript. One reason could be the format that automator pass on to AppleScript of the folder path.

Here is the coded I have used below. Any help would be appreciated



on run {input, parameters}

set MyFolder to input as text #set MyFolder to path to current user folder
display dialog MyFolder

set MyFile to "Macintosh HD:Users:Razzle:Lightroom:Test:_Full Shoot:image.jpg"


tell application "Finder"

set SubFolders to every folder of entire contents of MyFolder
repeat with aFolder in SubFolders
display dialog aFolder as string
duplicate MyFile to aFolder with replacing
end repeat
end tell



end run
Razzle
 
Posts: 2
Joined: Sun Nov 05, 2017 7:54 pm

Re: Automator and Applescript Mon Nov 06, 2017 11:41 am • by Mr_Noodle
Note that Hazel does not use the "on run" handler. See the help on how to integrate AppleScripts with Hazel. Depending on whether the script is embedded or external, you will need to use a different handler.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support