how can i get the path of an attached folder action?

hi, i’ve been stumped by this for a few days (new to applescripts syntax)

i want to be able to get the folder actions that are attached to a given folder as some sort of string

set thisAction to the folder action of thisFolder

variations on that don’t seem to work.

basically i’m recursively copying a templated hierarchy of folders (rather ‘duplicating’ them) but folder actions are not being duplicated through applescript.
so i figured if i can get the attached actions as txt or a path, then while i’m duplicating them i can reattach them to the new duplicated directories.

is this possible? does anyone know the syntax?

thanks much
-d

Try something like this:

tell application "System Events" to return attached scripts (choose folder)

Edit: This will copy one folder and reattach the actions:

choose folder with prompt "Copy folder w/ folder actions:"
set originalFolder to result

get name of (info for originalFolder)
choose folder with prompt "Copy '" & result & "' to:"
set copyTo to result

try
	tell application "Finder" to duplicate originalFolder to copyTo
	set newFolder to result as alias
	
	tell application "System Events"
		get attached scripts originalFolder
		
		repeat with thisAction in result
			attach action to newFolder using thisAction
		end repeat
	end tell
on error errorMsg number errorNum
	display dialog "Error: (" & errorNum & "):" & return & return & errorMsg buttons "Cancel" default button 1 with icon caution
end try

Perfect! works like a charm, thanks!

-d