Strange behavior
SCHMUCK Philippe
philippe-schmuck at orange.fr
Sat Oct 12 11:06:05 EDT 2013
James,
Thanks for the advice; I'll update all my scripts using the try / on error scripting and I'll add also the "-m" switch to be sure.
We'll see if the problem comes back, especially if it was issued by an error not well trapped in my scripts.
Philippe
Le 10 oct. 2013 à 19:34, James Sentman <james at sentman.com> a écrit :
> Ah, OK. When you ignore the reply from something like the calls to curl they go into applescripts just generically default variable there and can be listed in the error messages. For example, in applescript it's not necessary for you to do something like
>
> set MyReply to doshellscript "whatever"
> return MyReply
>
> you can just do
> doShellScript "wahtever"
>
> and the reply will be returned (sometimes, I wouldn't actually rely on this in your own coding) but it does explain why the message is in there then.
>
> Is it possible that these curl commands might be returning an error rather than working? If a shell command exits with other than a 0 clean exit code that error will become an applescript error at that point. I would wrap them in try/on error blocks and write to the log in the error block that something didn't work
>
> try
> do shell script "curl http://..."
> on error
> write log "curl returns error while trying to do something..."
> end try
>
> that way the script will continue and you'll get some indication that might be useful. I would also add the -m switch and specify a max time you want this to take before a timeout happens otherwise XTension might hang on this for quite a long time if the connection is hosed or the device not responding. It's just "-m seconds" curl -m 10 http://... like that
>
>
> The next version of XTension has a way of making async http calls so that we will no longer have to use curl to get data or send control statements and it will never be able to hold up a script again. more on that when I'm ready to release ;)
>
>
> On Oct 9, 2013, at 5:44 PM, SCHMUCK Philippe <philippe-schmuck at orange.fr> wrote:
>
>> Yes, I'm using a TCW181B-CM_R2 Terracom ethernet controller to turn on and off my remote speakers.
>> I installed it for more than 5 months now and had never any problem with it until now!
>>
>> In the pseudo units that represent my speakers, I have an On and an Off script which just does :
>> do shell script "curl http://device.ip.address/status.xml?rX=1" to Turn Relay X ON
>> or do shell script "curl http://device.ip.address/status.xml?rX=0" to Turn Relay X OFF
>>
>> I never read the status which is returned as a xml file as I do not now how and as I do not need to read it; but there is obviously a problem occurring around this, even if the strange behavior I saw in the log seems not directly related to the use of the pseudo units at this specific time.
>>
>> So let's assume that the status.xml file is send somewhere after my order and seems to corrupt after a while something in XTension, where and how should I get it in a script to be sure to flush any input waiting somewhere?
>>
>
> Thanks,
> James
>
>
> James Sentman http://sentman.com http://MacHomeAutomation.com
>
>
>
> _______________________________________________
> XTensionList mailing list
> XTensionList at shed.com
> http://shed.com/mailman/listinfo/xtensionlist
More information about the XTensionList
mailing list