Hello Guest it is March 29, 2024, 10:20:48 AM

Author Topic: Retrieving the string in a UserLabel  (Read 3706 times)

0 Members and 1 Guest are viewing this topic.

Offline JJ

*
  •  16 16
    • View Profile
Retrieving the string in a UserLabel
« on: April 30, 2007, 03:39:05 PM »
Hello,

I have a need to call the string stored in a UserLabel.  Is there a way to do this?  I've set the value using SetUserLabel, but GetUserLabel is not working for me.

Any help is greatly appreciated.

Thank you,

JJ

Offline JJ

*
  •  16 16
    • View Profile
Re: Retrieving the string in a UserLabel
« Reply #1 on: May 01, 2007, 10:34:16 AM »
OK, maybe my first post was not specific enough.  ;)

I'm trying to create a set of buttons to emulate canned scenarios after prompting for a custom name.

To do this, I created 3 VB buttons and a UserLabel (Userlabel1) to display the name of the .tap file input by the user.

The first button's VB labeled "Teach Scenario 1"

Dim Prog1
Prog1 = InputBox ("What is the name of this scenario? Be sure to add '.tap' at the end of the file name. EX: MediaPlayer.tap")
SetUserLabel (1, Prog1) 
OpenTeachFile Prog1
Code "G0 G49 G40 G17 G80 G50 G90"
Code "G82 X0.0 Y0.0 Z-.01000 P0 R-.001000 F150" 

The second button's VB script labeled "End Teach 1"

Dim InfLoop
InfLoop = InputBox ("Do you want this scenario to loop continuously when ran? Y or N")
Code "G80"
Code "G28"
If InfLoop = "Y" Then
   Code "M47"
ElseIf InfLoop = "y" Then
   Code "M47"
End If
Code "M30"
CloseTeachFile         


The Last button labeled "Run Scenario 1"

Dim Prog1_1
Prog1_1 = GetUserLabel1
ChDir "d:\mach3\gcode"
LoadRun (Prog1_1)



I want this last button to be able to be pressed during Teach mode for another .tap file and enter all of it's code into the current .tap file on the fly.  I also want this button to run the tap file listed in UserLabel1 if the button is pressed while NOT in teach mode for another .tap file.  Am I going about this the wrong way?  I understand I probably will need to add an if/then statement in the last button to give it this duel capability, but to get started I need it to run the file listed in the UserLabel and not simply the last file taught.  I don't see a way to call the string currently in UserLabel1.  Prog1_1 = GetUserLabel1 is not working for this.

I hope this helps to clarify my question.

Thank you,

JJ
 
Re: Retrieving the string in a UserLabel
« Reply #2 on: May 01, 2007, 11:17:14 AM »
You cannot read the value of a UserLabel from VB, only write it. There is no way to store string data in a wizard, except in files. You could create a file with a fixed name, write to it your Prog1 value, then read the file when oyu need it.

A bit of a pin, but I think its the only way.