Compiling Embedded Scripts in Leopard (OS 10.5.1)

Posted on
Sat Jan 05, 2008 5:19 pm
yergeyj offline
Posts: 260
Joined: Dec 29, 2004

Compiling Embedded Scripts in Leopard (OS 10.5.1)

Since upgrading to Leopard, embedded scripts do not seem to compile correctly? Two very simple examples are shown below:

Code: Select all
tell application "iTunes"
    play
    set sound volume to 100
end tell



Code: Select all
      set primaryState to brightness of device "Outside Garage Lights (Primary)"
      set secondaryState to brightness of device "Outside Garage Lights (Secondary)"
      
      
      if not (secondaryState = primaryState) then
         set brightness of device "Outside Garage Lights (Secondary)" to primaryState
      end if



In both cases, if the code is compiled in Script Editor, and then copied and pasted as an embedded action, and NOT recompiled, they work. Any attempt to compile in Indigo 2.0.9 fails with the following error message:

Error script error: Expected “end” or “end tell” but found unknown token.

Any thoughts on what's happening?
Jim

Posted on
Sat Jan 05, 2008 9:27 pm
matt (support) offline
Site Admin
User avatar
Posts: 21420
Joined: Jan 27, 2003
Location: Texas

Re: Compiling Embedded Scripts in Leopard (OS 10.5.1)

Upgrade to the latest public beta of 3.0. This is a Leopard bug that 2.5 works around.

Regards,
Matt

Posted on
Sat Jan 12, 2008 12:34 pm
yergeyj offline
Posts: 260
Joined: Dec 29, 2004

(No subject)

Thanks.

Upgrading the server to 3.0b13 did the trick.

Jim

Posted on
Tue Mar 25, 2008 8:19 pm
yergeyj offline
Posts: 260
Joined: Dec 29, 2004

(No subject)

Matt,

Has this issue resurfaced in b18?

I seem to be getting the same "carriage return issue" again when script elements are copied and pasted from an embedded Indigo AppleScript into Script Editor.

Jim

Posted on
Tue Mar 25, 2008 8:27 pm
matt (support) offline
Site Admin
User avatar
Posts: 21420
Joined: Jan 27, 2003
Location: Texas

(No subject)

Hi Jim,

The problem is actually in Leopard. With all the unicode changes to AppleScript it now does not like the whitespace characters that Indigo uses to format the scripts. I worked around the problem in 3.0 by having it strip the white space characters before it sends the source to the OS to compile it.

But the Script Editor doesn't do that, which explains why you see the problem after you copy/paste the formatted source from Indigo and compile it inside the Script Editor.

Regards,
Matt

Posted on
Tue Mar 25, 2008 8:36 pm
yergeyj offline
Posts: 260
Joined: Dec 29, 2004

(No subject)

Thanks Matt.

I was moving scripts between the two in order to see the "results" in the Script Editor window for some things that weren't behaving as I expected.

Now that I know what's happening, I'll just strip the white space manually, or if it's a long script move it into Word and strip it with Edit/Replace.

Jim

Posted on
Tue Mar 25, 2008 9:03 pm
gregjsmith offline
Posts: 946
Joined: Apr 01, 2003
Location: Rio Rancho, NM

(No subject)

Holy crap! That explains a lot for me too. I thought I was screwing something up again.

Posted on
Sun Apr 13, 2008 12:22 am
dnomode offline
Posts: 366
Joined: Apr 12, 2008
Location: North Georgia

(No subject)

Hello, I'm a newb to Indigo with no apple scripting experience.
I just installed the software about 1 week ago and got some Insteon receptacles for my Malibu Lights working with the software (works great).
Today I installed the EZRain and got that working, but I'm trying to get the NOAA Weather Script working. I copied the script to the Attachments folder, changed the NOAA station, then saved it. I tried to run it from the Script Editor but nothing happened. So I continued with the instructions in the script. I created a Time/Date Action to run the script every 60 min., but the script did not show up in the Embedded list under the Actions section, like a picture I found on this forum. So I choose the File radio button and selected the script. I then tried to run the script from the Run button, but nothing seemed to happen. So I continued with the instructions and created a Trigger Action GetNOAAData() For Indigo Server Startup. Again selected the File radio button in the Actions section and choose the script. I can't seem to get the script running. I also looked into the Variable List but nothing in there regarding weather. I saw no error messages pop up. Am I doing something wrong or is it something to do with the OS. Please help. I'm running OS 10.5.2 With 3.0.0 b19

Thank You
Edmond

Posted on
Sun Apr 13, 2008 8:07 am
matt (support) offline
Site Admin
User avatar
Posts: 21420
Joined: Jan 27, 2003
Location: Texas

(No subject)

Hello Edmond,

The instructions inside the most recent version of the Weather NOAA sync.scpt say:
1) Modify the "property NOAA_Station" below to correspond to your nearest
NOAA broadcast station.

2) Create a Trigger Action of Type "Indigo Server Startup" and select
an Action Type of "Execute AppleScript" that executes this script file. This
script file will then start as a separate process and run as long as the
IndigoServer is running. IndigoServer automatically terminates the script
when it shuts down.

I'm not sure what instructions you were following -- perhaps the instructions in an older version of the NOAA script that was installed by an older version of Indigo. The most recent version should have been installed into this folder by beta 19:
Code: Select all
/Library/Application Support/Perceptive Automation/Indigo 2/Scripts/Background Tasks/

You do not need to move it out of that folder. Just create a single Trigger Action using the type "Indigo Server Startup" that runs the script once. Don't copy/paste the script, but just point to the file in the Action panel. That will cause Indigo to launch the script. The script then continues to run automatically as long as the Indigo Server is running (it runs as a separate process).

Give all that a try, and delete the other Trigger Actions that are using the older version of the file, and delete the older version of the file. You should then, after you stop and restart the Indigo Server (via the Indigo 2->Stop Server menu item), see the weather variables appear in the Variables Window.

Regards,
Matt

Posted on
Sun Apr 13, 2008 12:15 pm
dnomode offline
Posts: 366
Joined: Apr 12, 2008
Location: North Georgia

(No subject)

Hello Matt,

That did the trick. Thank you for your help and the great software.

Edmond

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 7 guests