View unanswered posts | View active topics It is currently Sat May 25, 2013 10:29 am



Reply to topic  [ 16 posts ]  Go to page: 1, 2  Next
 Embedded apple script reports compile error after osx update 
Author Message

Joined: Jan 02, 2011
Posts: 2
Post Embedded apple script reports compile error after osx update
i have a some simple scripts that stopped working and now will not compile after I took OSX update 10.6.5.

An example script is
Code: Select all
if (value of variable "PCRbottomstate" as integer) is 9 then
    set value of variable "PCRbottomstate" to 1
else
    set value of variable "PCRbottomstate" to ((get value of  variable "PCRbottomstate" as integer) + 1)
end if


The variable PCRbottomstate exists and has a current value of 9.

When I attempt to make changes then compile i get the following error:
Error script error: around characters 22 to 23
Error script error: Expected “,” but found “"”. (-2741)


The editor highlights the double quote " just before the first PCRbottomstate variable ref.


Sun Jan 02, 2011 9:09 pm
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 6665
Location: Austin, Texas
Post Re: Embedded apple script reports compile error after osx up
Try enclosing your scripts in a tell block:

Code: Select all
tell application "IndigoServer"
    [YOUR CODE HERE]
end tell


We've had several cases where the AppleScript component becomes corrupt somehow and normal scoping rules aren't being followed correctly.

_________________
Jay (Indigo Support)
Image


Mon Jan 03, 2011 9:30 am
Profile WWW

Joined: Nov 25, 2010
Posts: 172
Location: UK
Post Re: Embedded apple script reports compile error after osx up
I've got the same issue on about 70 different scripts


Tue Jan 04, 2011 7:24 pm
Profile

Joined: Nov 25, 2010
Posts: 172
Location: UK
Post Re: Embedded apple script reports compile error after osx up
All my script errors were all with if statements if that's any assistance Jay. I have indigo check if a light is on before sending an unnecessary command to try to minimise signals backing up in the queue thus reducing a bottle neck at the cm15.

Not sure it was directly related to an os update though, as I was working on some simple script at the time it happend. I am on 10.6.5 installed 18th November 2010. Last software update was on the 23rd dec for iTunes and airport ...... I reboot whole mac weekly-ish.

Unless a indigo server reboot triggered it? I was starting and stopping indigo server quickly. Every 30 seconds or so, as I was also sorting out a problem where huristic (?) images were not displaying a lamp as being on when brightness was below 30 with the lowest image being say+ and say+30. Had to create images at +1,2,5,10,15,20,25 for lamps to be shown as on right the way through a dim.

I'm using 4.1.13 of indigo

Not sure if that assists in locating cause!?! But if you need more let me know.

Regards

Mat


Tue Jan 04, 2011 8:21 pm
Profile

Joined: Mar 09, 2008
Posts: 183
Post Re: Embedded apple script reports compile error after osx up
I've now got the same problem, fixed by using tell blocks.

Not all embedded scripts give errors; for example, a simple handler call works without the tell block, as does "do shell script...".
These statements in one script work without the tell block:
Code: Select all
set date_time_stamp to (current date) as string
growlSecurity("Reminder", "The garage door has been open for one hour; if this was inadvertent, please close it." & return & return & date_time_stamp)


Ones that need the tell block are, as mat noted, "if" statements; also "remove delayed actions for" statements and "set value of variable" statements.

Recently upgraded to 10.6.6; not sure if that's when the issue started, but it very well could be. IndigoServer version 4.1.15. Let me know if you need more info.

Hope this is useful...


Tue Jan 11, 2011 10:14 am
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 6665
Location: Austin, Texas
Post Re: Embedded apple script reports compile error after osx up
It's likely that the problem is when the script refers to Indigo objects (it seems to be a scoping error). I'd be interested to hear from others if a 'using terms from application "IndigoServer"' and 'end using terms' blocks rather than try blocks also works for everyone experiencing the problem.

_________________
Jay (Indigo Support)
Image


Tue Jan 11, 2011 10:41 am
Profile WWW

Joined: Mar 09, 2008
Posts: 183
Post Re: Embedded apple script reports compile error after osx up
jay wrote:I'd be interested to hear from others if a 'using terms from application "IndigoServer"' and 'end using terms' blocks rather than try blocks also works for everyone experiencing the problem.


"Using terms from" works here; I didn't change all of the embedded scripts but had no errors in a sample of about 25%.


Tue Jan 11, 2011 11:38 am
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 6665
Location: Austin, Texas
Post Re: Embedded apple script reports compile error after osx up
Great info, thanks.

_________________
Jay (Indigo Support)
Image


Tue Jan 11, 2011 11:41 am
Profile WWW

Joined: Nov 08, 2006
Posts: 74
Location: Seguin, TX
Post Re: Embedded apple script reports compile error after osx up
I had the similar with embedded scripts. I just noticed it yesterday - no embedded scripts will work when they all worked prior. I am running 10.6.7 and indigo 4.1.16. This has happened before when scripts no longer worked and the fix was running disk utility and repairing permissions and running disk repair. This time neither fixed it. Zapped Pram too. I have lots and lots of embedded scripts so I was really scratching my head. Running from a different permission with a older OS (10.6.4) and older Indigo 4.1.xx) these same scripts worked. The scripts range from being fairly simple using variable substitution or other logic to rather complex logic. For example a simple one uses this line:
set temp to value of variable "livingTemp"
This errors out:
Error script error: around characters 27 to 37
Error script error: A “"” can’t go after this identifier. (-2740)

The fix appears to be using the tell application "IndigoServer" statement.

Good thing this fixes it. I just completed going though all triggers, and actions and they all now work.

Hope the root cause is figured out! Good luck. The support on Indigo is the best!!!

Thanks Matt and the support team!
Matthew

_________________
Thanks,
Matthew


Sun Apr 03, 2011 7:15 am
Profile
User avatar

Joined: Oct 08, 2010
Posts: 246
Location: Boston, MA
Post Re: Embedded apple script reports compile error after osx up
I saw that need for "Tell" statement too and figured it was just my Mac being whacky after an O/S upgrade. Good to know!

_________________
Dave


Sun Apr 03, 2011 7:20 am
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 6665
Location: Austin, Texas
Post Re: Embedded apple script reports compile error after osx up
jenkins007 wrote:The fix appears to be using the tell application "IndigoServer" statement.


Did you try 'using terms from "IndigoServer"' rather than a tell statement (as I requested above)? It would help to know if that works in trying to figure out what the OS corruption problem actually is doing. Unfortunately, it doesn't appear to be OS version related - we've had reports on every Snow Leopard version and, in fact, one report of it happening on Leopard as well. I suspect your 10.6.4 install just hadn't become corrupt in that special way... :?

_________________
Jay (Indigo Support)
Image


Sun Apr 03, 2011 9:17 am
Profile WWW

Joined: Nov 08, 2006
Posts: 74
Location: Seguin, TX
Post Re: Embedded apple script reports compile error after osx up
I tried 'using terms from application "IndigoServer"' ending with the end using terms block. This erred out with
Expected "using terms from", etc. but found identifier.


Changed it to 'using terms from "IndigoServer"' and it erred out with
Can't make "IndigoServer" into type application.


Changed it to tell block and it works fine. Hope this helps!
:)

_________________
Thanks,
Matthew


Mon Apr 04, 2011 6:06 am
Profile

Joined: Nov 08, 2006
Posts: 74
Location: Seguin, TX
Post Re: Embedded apple script reports compile error after osx up
Going through the Indigo DB, looks like I adjusted all scripts and everything seems to be working fine.

My main control page shows an error when I open it for editing. Same issue with using embedded scripts. I found the controls using embedded scripts and adjusted them adding both the tell block on some and using terms from block on others. Both work and now all is running.

I communicated in my earlier post that the using terms block did not work... actually it does work. I was not using the correct closing statement... instead of ending with "end using terms" it needed to be "end using terms from".

So both the tell block and the using terms block works to fix this apple script issue. Thanks for the quick (and Sunday) reply! Excellent support!

_________________
Thanks,
Matthew


Mon Apr 04, 2011 6:58 am
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 6665
Location: Austin, Texas
Post Re: Embedded apple script reports compile error after osx up
Thanks much - this reinforces the belief that it's a compile-time scoping issue. Maybe passing this information on to Apple will help them figure out what's wrong.

_________________
Jay (Indigo Support)
Image


Mon Apr 04, 2011 7:51 am
Profile WWW
User avatar

Joined: Nov 18, 2008
Posts: 1721
Location: Berkeley, CA
Post Re: Embedded apple script reports compile error after osx up
jenkins007 wrote:...I was not using the correct closing statement... instead of ending with "end using terms" it needed to be "end using terms from"

Here is a simple tip to avoid that problem. Just end your blocks with end then compile. The compiler will automatically end the block with the correct syntax.

This works in the AS editor, but I have not tested it inside of Indigo.


Last edited by berkinet on Mon Apr 04, 2011 5:49 pm, edited 1 time in total.



Mon Apr 04, 2011 1:35 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 16 posts ]  Go to page: 1, 2  Next

Who is online

Users browsing this forum: Google [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.