automator shell

hi,
after some tries i’m stuck with the correct syntax of my script. It should work, but it does not. Some clue?

on run {input, parameters}
	--example
	set {lfpt, ch} to {(path to scripts folder) & "workflows:", "Watermark.workflow"}
	--
	set my_wkfl to quoted form of POSIX path of (lfpt & ch as text)
	set param_ls to build_ls(parameters)
	set cmd to "automator -i - " & param_ls & space & my_wkfl
	--activate me
	--display dialog cmd
	return do shell script cmd
end run

to build_ls(get_param)
	set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, linefeed}
	set input_ls to get_param as text
	set AppleScript's text item delimiters to tid
	return param_ls
end build_ls

Hi,

the variable in the last line of the handler (param_ls) is not defined.

by the way: there is also a “shortcut” for the workflow folder


set {workflowsFolder, workflowName} to {(path to workflows folder as text), "Watermark.workflow"}
--
set myWorkflow to quoted form of (POSIX path of workflowsFolder & workflowName)

no offense, but the times of limited 8-letter variable names are definitely gone :wink:

Hi, Ste
i pasted only a piece of my script. Not to make a secret, but because i need to spot only a particular part of my script. However, thanks for your tips.
sorry, but param_ls is defined with:
to build_ls(get_param), continuing in the respective handler.

my trouble lies in the right compilation of the automator-shell-command. Everything runs fine, till the script arrives to execute the shell.

ps. i understand if you dislike my variables, but i write a lot of scripts. I was yet shorter with variable nomenclature time ago. :smiley:

the handler to build_ls() has its own scope.
Unless the variable is not global or a property, it’s only visible within its scope.

in the handler param_ls is returned but never been set

ok,
you’re right, i corrected my handler so that it returns param_ls.

on build_ls(get_param)
	set {tid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, linefeed}
	set param_ls to get_param as text
	set AppleScript's text item delimiters to tid
	return param_ls
end build_ls

and using my instead of ‘to’ to call the handler.
But still no results. I tested it also in the script editor, and exits with:
error -255. The picture file i want to process isn’t identified as such.