Hello Guest it is April 23, 2024, 11:36:43 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - cheech

Pages: 1
1
hello ;D

I'm almost crawling with VB programming.  I'd like to create a code that gets the press of a button and writes the DRO's to a file and keeps appending the values as you keep hitting the button.

I did a bit of a search in the forum and read a bit of the "C. Enable" manual. And so far this is what I've got:

Dim fileData As Integer
Dim fileName As String
Dim place As String

fileData = FreeFile
fileName = InputBox("Part file name:", "please name the file...", "", 350,400)
place = "c:\" + fileName + ".txt"

Open place For Output As #fileData

Xcoord = getoemdro(800)           'gets the X axis DRO value, which is motorized
Ycoord = getoemdro(171)           'gets the value of encoder #2 DRO, Y axis carried by hand for measuring rig
Zcoord = getoemdro(172)           'gets the value of encoder #3 DRO, Z axis carried by hand for measuring rig

Print #fileData, "X= ", Xcoord
Print #fileData, "Y= ", Ycoord
Print #fileData, "Z= ", Zcoord

Close #fileData     


Can I get a little help with how to create a loop for repeating the getoemdro() method every time the "append" button is pressed? Also is it possible/needed to create a second button that closes the file?, In case I want to create a new file/session.

thanks
cheech

Pages: 1