Automator service broken

Hi guys,

i introduced Script libraries for some Applescript-Services
which run with the WorkflowServiceRunner.

But doing so, i lost the ability to stop the Automator code in action (controllable by the spinning wheel in the menulets menubar, in case you want to discard a running Service) because the code runs indirectly from a script lib instead from the Automator Applescript Service itself.

now my question is - how to control an invoked code running as Automator Service ?
or, some workaround ?

here a sample code of mine:

on run {input, parameters}
	set the_text to input as Unicode text
	
	set lib_pt to (path to scripts folder from user domain as text) 
	set loadscr to (lib_pt & "Custom.scpt" as text)
	try
		set file_lb to load script alias loadscr
		file_lb's read_txt(read_text, mode_ky)
	end try
	#"WorkflowServiceRunner"
end run

somebody?

Hello Joy.

It would have helped if you had posted the parts of your library that you use.

The code in your library executes on the same thread as your workflow, when called from the workflow.

Maybe your code is stuck inside a try - end try block?

Hi McUsrII,

It would have helped if you had posted the parts of your library that you use.

youre right.sometimes we take everything for inplicit.
the library i use is a longer applescript written by myself and works always like expected. Maybe i used the wrong terms to describe it, that library is a Applescript invoked in several other Scripts/Apps

try
       set file_lb to load script alias loadscr
       file_lb's read_txt(read_text, mode_ky)
   end try

 display dialog "Hi"

to test it, try to use:

on read_txt("", "")
	repeat 5 times
		do shell script "sleep 2"
		beep
	end repeat
end read_txt

as external script to load.

note that, if i write a display dialog “Hi” as last line, the Service avoids likewise to show the spinning wheel in between. Sometimes its very handy to be able to stop longer processes like this one (from 1-8 mins), if necessary.
Sorry if i repeat things but ill be sure to formulate the problem understandable. (Also for myself :smiley: )

Hello.

I’m still just guessing, that the reason you don’t get the spinning wheel is because it happens inside the try . . . end try block. How about removing those, and see what happens? :slight_smile: