from an old post,
'M1001.m1s Save User DROs and LEDs to file and/or this can run in your macro pump.
UserDROs = 1000
UserLEDs = 1000
'Optional, you can have a Brain using a timer
'that for every 5 minutes or so this file will run again, updating the status.
'OR you can have a SAVE user DROs/LEDs button that will activate this, you would need
'to put this code in your MacroPump for the AutoSave and manual Save to work.
'If GetUserLED(2100) Then 'Optional code see above.
Open "UserDROStates.txt" For Output As #1 ' Open to write file.
For x = 1000 To 2255
DROState = GetUserDRO(UserDROs)
Write #1, DROState
UserDROs =(UserDROs + 1)
Next x
Close #1
Open "UserLEDStates.txt" For Output As #2 ' Open to write file.
For y = 1000 To 2255
LEDState = GetUserLED(UserLEDs)
Write #2, LEDState
UserLEDs = (UserLEDs + 1)
Next y
Close #2
'End If 'optional from the if above for auto save functions
'Enjoy Scott