It’s in Jon’s commands: http://www.seanet.com/~jonpugh/JonsCommandsDocs.html
Recompile the script.
I don’t know what you mean with that reference. I use plain applescript. I not only recompiled the script many times, I even copied the script, converted to plain text and pasted and saved it in a new file, and that seemed to solve the problem until I noticed it happening again ” the action hangs setting the clipboard to the value of the var and sometimes logs the message I quoted above.
Jon’s Commands is a pre-OS X osax. Do you have an OS 9 or earlier volume where this may be installed?
With the error you’re getting it must be installed somewhere.
It’s part of Standard Additions. When Apple took it over, they kept the same event codes.
Thanks for pointing that out. I’m still getting mixed and random results. For example,
How can I debug this? I usually do
do shell script "logger -t 'AS DEBUG' " & myMes
at different stages, or open a file to dump errors/values, if things get complicated.
But I’m out of ideas to debug this simple command that works perfectly in another action which it is traced from.
This is the problematic code
using terms from application "Quıcĸsıɩⅴεʀ"
on process text lemma
-- works if Tipp des Tages is disabled
set the clipboard to lemma
activate application "Duden-Bibliothek"
tell application "System Events" to tell process "Duden-Bibliothek"
repeat
if window "Duden-Bibliothek" exists then exit repeat
end repeat
tell application "Duden-Bibliothek" to activate
keystroke "f" using {control down}
keystroke "a" using {command down}
keystroke "v" using {command down}
keystroke return
end tell
end process text
on get direct types
return {"NSStringPboardType"}
end get direct types
end using terms from
You may try to replace :
tell application “Duden-Bibliothek” to activate
by
set frontmost to true
But the main change to apply would be :
using terms from application "Quıcĸsıɩⅴεʀ"
on process text lemma
-- works if Tipp des Tages is disabled
using terms from scripting additions # ADDED
set the clipboard to lemma
end using terms from # ADDED
activate application "Duden-Bibliothek"
tell application "System Events" to tell process "Duden-Bibliothek"
repeat
if window "Duden-Bibliothek" exists then exit repeat
end repeat
tell application "Duden-Bibliothek" to activate
keystroke "f" using {control down}
keystroke "a" using {command down}
keystroke "v" using {command down}
keystroke return
end tell
end process text
on get direct types
return {"NSStringPboardType"}
end get direct types
end using terms from
So that the script may understand the command set the clipboard to lemma
Yvan KOENIG running Yosemite 10.10.5 in French (VALLAURIS, France) vendredi 21 août 2015 14:43:57
Error -10006. This is a Qt/QMake application, has no sdef and it’s a pain to script.
I get
I don’t use Quicksilver so I can’t test just guess.
My understanding is that in the process handler, the unique feature specific to QuickSilver is the entry one :
on process text lemma
The reports lines reported above state that the script doesn’t understand the instruction “set clipboard to.”
It’s why I asked you to add the instruction “use terms from scripting additions”.
As it is rejected, you may try to move the useful code which doesn’t rely upon QuickSilver features into a handler which is not using terms from QuickSilver.
using terms from application "Quıcĸsıɩⅴεʀ"
on process text lemma
my main(lemma)
end process text
on get direct types
return {"NSStringPboardType"}
end get direct types
end using terms from
on main(lemma)
-- works if Tipp des Tages is disabled
using terms from scripting additions # ADDED
set the clipboard to lemma
end using terms from # ADDED
activate application "Duden-Bibliothek"
tell application "System Events" to tell process "Duden-Bibliothek"
repeat
if window "Duden-Bibliothek" exists then exit repeat
end repeat
--tell application "Duden-Bibliothek" to activate
set frontmost to true
keystroke "f" using {control down}
keystroke "a" using {command down}
keystroke "v" using {command down}
keystroke return
end tell
end main
If it works, you may try to remove the two instructions which I commented as # ADDED.
Yvan KOENIG running Yosemite 10.10.5 in French (VALLAURIS, France) vendredi 21 août 2015 16:06:15
Thanks Yvan. The problem is also, that it happens randomly AFAICT.
set the clipboard
gets stuck sometimes and Quicksilver logs that message, but, as I said, it doesn’t happen with other actions that have identical structure.
I noticed a process that also appears concomitantly
If my edited version is accepted by QuickSilver, it will allow you to insert quite easily instructions tracing what happen because in the main handler you will be able to use functions belonging to Standard Additions like say, do shell script…
Yvan KOENIG running Yosemite 10.10.5 in French (VALLAURIS, France) vendredi 21 août 2015 17:34:17
That doesn’t compile. In my version I inserted statements like do shell script "logger -t 'AS DEBUG' " & myMes
before and after set the clipboard to lemma
and, if it gets stuck, it always logs right before the clipboard command and hangs and never reaches the second logger, throwing that event. Well, if anything comes to mind let me know, I guess I’ll have to randomly live with it for the moment.
What didn’t compiles, the script with the instructions moved in the third handler named main() ?
If it’s that, it may be a conflict with the name “main” which I used to name the handler.
You may try to use an other one. In my own scripts I often name this kind of script “Germaine” which never conflicts.
In your original code, according to the issued error messages it seems logical that the shell script instruction inserted after “set the clipboard.” one wasn’t triggered.
Yvan KOENIG running Yosemite 10.10.5 in French (VALLAURIS, France) vendredi 21 août 2015 20:26:46
main or germain, it still doesn’t compile.
Anyway, is there any other method to debug setting the clipboard to string?
It looks to me like the problem may not so much the script, but what’s being passed to the script. Adding some code that logs the class of lemma might help clarify things.
I think that requires 10.9 or later. I’m not sure the OP has said what version of the OS they are running.
I use 10.8.5.
It looks to me like the problem may not so much the script, but what’s being passed to the script. Adding some code that logs the class of lemma might help clarify things.
It’s class text. I log it with the following test action when the look up action is stuck in setting the clipboard ” which seems to unstuck it, sometimes.
using terms from application "Quıcĸsıɩⅴεʀ"
on process text theObjs
(* on open files theObjs *)
-- TEST
(* begin test script *)
set the clipboard to theObjs
do shell script "logger -t 'AS DEBUG' dO value: " & theObjs & " - class: " & class of theObjs
(* end test script *)
-- DEBUG
--do shell script "echo " & quoted form of (theObjs as text) & " > ~/Desktop/as_debug.txt"
try
do shell script ¬
"echo 'STRING :: '" & quoted form of theObjs & " > ~/Desktop/as_debug.txt"
on error errMsg
do shell script ¬
"echo 'ERROR :: '" & quoted form of errMsg & " > ~/Desktop/as_debug.txt"
do shell script ¬
"echo 'STRING :: '" & quoted form of (theObjs as string) & " >> ~/Desktop/as_debug.txt"
end try
(* repeat with theObj in theObjs as list
--do shell script "logger -t 'AS DEBUG' " & theObj
--do shell script "echo " & theObj & " >> ~/Desktop/as_debug.txt"
end repeat *)
(* set myFile to open for access (path to desktop as text) & "as_debug.txt" with write permission
write theObjs to myFile
close access myFile *)
(* end open files *)
end process text
(* on get direct types
return {"NSFilenamesPboardType"} -- files and folders
return {"NSStringPboardType"} -- text or a string
return {"Apple URL pasteboard type"} -- URLs
return {"qs.command"} -- Quicksilver command
end get direct types *)
end using terms from
I fear you’re just hitting a bug. If com.apple.foundation.UserScriptService is being run each time, the script is being run via the mechanism designed for sandboxed apps – they are getting passed to a separate process for execution. I’m not sure what you can do to debug that, but you should probably log a bug with Apple (while not holding your breath; it sounds like it might be difficult to reproduce).
As I said it happens randomly ” if I see com.apple.foundation.UserScriptService, quit it and rerun the action, it sometimes runs as expected, then Quicksilver logs the error message from the first failed execution.
What I also found strange is the form of the error: “[value of var] doesn’t understand the set the clipboard to message”.
I’m testing some workarounds. One of them is
do shell script "echo " & quoted form of lemma & " | pbcopy"
instead of
set the clipboard to lemma
but then I need to add a backspace
keystroke "v" using {command down}
key code 51
keystroke return
as pasting adds a newline.
Maybe you guys know a more elegant way to circumvent this.