Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 12, 2013, 12:40 PM   #1
Dreamspinner
macrumors member
 
Join Date: Dec 2012
Applescript "Variable hdg is not defined"

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
Dreamspinner is offline   0 Reply With Quote
Old Feb 12, 2013, 04:25 PM   #2
Partron22
macrumors 6502a
 
Join Date: Apr 2011
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'.
Partron22 is offline   1 Reply With Quote
Old Feb 12, 2013, 04:26 PM   #3
numero
macrumors member
 
Join Date: Jul 2002
Location: 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"
numero is offline   0 Reply With Quote
Old Feb 12, 2013, 06:33 PM   #4
Dreamspinner
Thread Starter
macrumors member
 
Join Date: Dec 2012
Quote:
Originally Posted by Partron22 View Post
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.

----------

Quote:
Originally Posted by numero View Post
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.....
Dreamspinner is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Tags
applescript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Applescript to start iTunes radio "station"? Honza1 Mac Programming 4 Aug 28, 2014 10:04 AM
String and variable concatenation in AppleScript tekboi Mac Programming 6 Apr 15, 2014 01:37 PM
Applescript newb: declaring a variable in another script. Vanilla Face Mac Programming 2 Jan 5, 2014 07:39 PM
Dialog Variable not Defined? ness64 Mac Programming 3 Sep 12, 2013 07:20 PM
AppleScript: Set variable to every XML element of a given name moonman239 Mac Programming 13 Jan 2, 2013 02:55 PM

Forum Jump

All times are GMT -5. The time now is 06:56 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC