Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 02:13:55 PM

Login with username, password and session length
Search:     Advanced search
* Home Help Search Calendar Links Login Register
+  Machsupport Forum
|-+  Mach Discussion
| |-+  VB and the development of wizards
| | |-+  If then else=need help
Pages: 1   Go Down
Print
Author Topic: If then else=need help  (Read 941 times)
0 Members and 2 Guests are viewing this topic.
dhelfter
Active Member

Offline Offline

Posts: 4


View Profile
« on: October 01, 2008, 04:37:17 PM »

Hello All. I am new to this vb script stuff. i have managed to write so simple code by following other people on here and learning what I can. I am trying to write a very simple macro. I have put a button on my screen that is label toggle turret. When I click this button it executes my code to turn turret one step(or tool)It worked gret. So I decided to have it also update the tool dro, that even worked great, however I need the dro to set back to 1 when I am at tool 8. So here is the code I wrote:

currenttool=getoemdro(824)
newtool=currenttool + 1

If
currenttool=8 Then
setoemdro(824,1)
Else 
setoemdro(824,newtool)
End If

activatesignal (output2)
code "g04 p.6"
While ismoving()
sleep 50
Wend
deactivatesignal (output2)
code "g04 p.6" 

prior to this I had the same code except no if then statement, only setoemdro(824,newtool) and it worked. So i know I am doing something wrong with the if then, but what?
Thanks
Logged
ger21
Global Moderator
*
Offline Offline

Posts: 2,620



View Profile WWW
« Reply #1 on: October 01, 2008, 05:32:52 PM »

Try it like this:

If currenttool=8 Then
setoemdro(824,1)
Else
setoemdro(824,newtool)
End If
Logged

dhelfter
Active Member

Offline Offline

Posts: 4


View Profile
« Reply #2 on: October 01, 2008, 07:22:04 PM »

That did it!!!!
Thanks I sure have alot to learn.
Logged
Pages: 1   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!