Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Dreamspinner

macrumors member
Original poster
Dec 17, 2012
39
0
This is my first Applescript, and has been working for 2 days when run from thr Applescript editor. Today, I started the Script Menu and put my script into the folder.

When I ran it from there, nothing happened. When I ran it from the editor, I got the error "Variable hdg is not defined" on the line with the <---.

Code:
on enabledGUIScripting(true)
    tell application "System Events"
	activate -- brings System Events authentication dialog to front
	set UI elements enabled to true
	return UI elements enabled
    end tell
end enabledGUIScripting

tell application "RUMlog"
    set hdg to TxRprt
    set beam to hdg as string  <---- error here
    repeat while length of beam as string < 3
        set beam to "0" & beam
	--display dialog "Now beam = " & beam buttons {"OK"}
    end repeat
    activate application "RotorDCU"
    tell application "System Events"
        tell process "RotorDCU"
           set value of text field 1 of window "RotorDCU" to  beam
        end tell
    end tell
end tell
 

Partron22

macrumors 68030
Apr 13, 2011
2,655
808
Yes
TxRprt is probably coming back undefined from the app, which leaves hdg undefined when you try to convert it to a string->error.

Try adding the line 'set hdg to ""' before 'set hdg to TxRprt'.
 

numero

macrumors regular
Jul 23, 2002
106
3
OR
Code:
TxRprt v : Writes the parameter into the Sent RST field
TxRprt
TxRprt text

TxRprt doesn't return anything. It expects a parameter. I don't know what is appropriate since I'm not into HAM, but it would be something like
Code:
TxRpt "hello"
 

Dreamspinner

macrumors member
Original poster
Dec 17, 2012
39
0
TxRprt is probably coming back undefined from the app, which leaves hdg undefined when you try to convert it to a string->error.

Try adding the line 'set hdg to ""' before 'set hdg to TxRprt'.

AHA! Your idea about TxRprt being un-defined was spot on! Thanks!
I had two copies of RUMlog, 1 exposing TxRprt, 1 not. Oddly, looking at the dictionary of both versions with Script Editot, they seem identical.

----------

Code:
TxRprt v : Writes the parameter into the Sent RST field
TxRprt
TxRprt text

TxRprt doesn't return anything. It expects a parameter. I don't know what is appropriate since I'm not into HAM, but it would be something like
Code:
TxRpt "hello"

Thanks for the response. TxRprt does return a value, it does not expect a value. That is, if I call the correct version of the program.....:confused:
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.