Re: tell Grog to glog
Re: tell Grog to glog
- Subject: Re: tell Grog to glog
- From: Gil Dawson <email@hidden>
- Date: Sun, 7 Jan 2007 10:55:10 -0800
Title: Re: tell Grog to glog
Thanks, Axel--
At 10:50 A +0100 1/7/07, Axel Luttgens wrote:
>The "Connection is invalid" message indicates that
the caller script was still expecting something from Grog when the
latter quit.
That explains the message, thanks.
It's strange that you got it to work on your machine, but it
didn't work on mine, even after I enclosed the top-level statements in
an on run ... end run block.
>Looks like having Grog.app to display some dialog when
launched hinders a response to get returned to the caller
script.
Good catch. Simply removing that display dialog makes it
work here:
1) Saved as stay-opne application under the name
"Grog":
global StartTime
on run
set StartTime to (current date)
activate
-- display dialog
"Grog launched." giving up after 1
end run
on glog(s)
activate
display
dialog "Grog called with " & ¬
s & ¬
"
as a parameter." giving up after 1
end glog
on idle
if (current date) >
(StartTime + 10) then quit
return 5 -- check again in five seconds
end idle
2) Executed from Smile or Script Editor with Command-R:
tell application "Grog"
glog("xxx")
end tell
The above works here as written. Thanks for your help
finding it.
However, if I take out the comment marks on the display dialog
command in Grog's run handler, it doesn't work. I still
get:
1) "Grog Launched."
2) Spinning pizza.
3) "Grog got an error: Connection is invalid."
This effect is the same whether I compile and run with Smile or
with Script Editor.
I wonder what might be different between our two machines?
Thanks for your help, Alex.
--Gil
At 10:50 A +0100 1/7/07, Axel Luttgens wrote:
>On 7/01/07 2:22, Gil Dawson wrote:
>
>> Hi--
>>
>> [...]
>>
>> Can someone please help me interpret this message?
>
>
>The "Connection is invalid" message indicates that the
caller script was still expecting something from Grog when the latter
quit.
>Looks like having Grog.app to display some dialog when launched
hinders a response to get returned to the caller script.
>(don't remember whether this always has been the case...)
>
>Given the above, something like this works:
>
>======== Grog =========
>global StartTime
>
>on run
> set StartTime to (current date)
> activate
> display dialog "Grog launched." giving up
after 1
>end run
>
>on glog(s)
> activate
> display dialog "Grog called with " &
¬
> s & ¬
> " as a
parameter."
>end glog
>
>on idle
> if (current date) > (StartTime + 10) then quit
> return 5 -- check again in five seconds
>end idle
>=======================
>
>==== Caller script ====
>-- Allow Grog.app to initialize.
>ignoring application responses
> tell application "Grog" to run
> delay 2
>end ignoring
>
>-- Use Grog.app's script.
>tell application "Grog"
> glog("xxx")
> glog("yyy")
>end tell
>=======================
>
>HTH,
>Axel
>
>_______________________________________________
>Do not post admin requests to the list. They will be ignored.
>AppleScript-Users mailing list
(email@hidden)
>Help/Unsubscribe/Update your Subscription:
>l.dawson.name
>Archives:
http://lists.apple.com/mailman//archives/applescript-users
>
>This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden