Sign in to follow this  
Followers 0
megatron

Keeping Input Fields As Variables Throughout A Script

3 posts in this topic

#1 ·  Posted (edited)

Hello

First post (hope im not going to embaress myself)

Program description: GUI takes a series of user defined inputs (IP address, subnet mask etc) then on pressing an "execute" button it uses these variables inside a subroutine who's function is to write a config file for a network device using said variables.

Problem summary: everything works apart from actually assigning the variables, i.e. when the subroutine runs it doesn't seem to know about the predefined variables from the UI...

;Create the input fields with defaults already entered
$IPAddress = GUICtrlCreateInput ( "192.168.", 100, 10, 100)
$Netmask = GUICtrlCreateInput ( "255.255.252.0", 100, 40)
$Gateway = GUICtrlCreateInput ( "192.168.0.1", 100, 70)

;Make a button to execute 
$Execute = GUICtrlCreateButton("Execute", 100, 310, 100)




;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GUISetState(@SW_SHOW)

While 1
  $msg = GUIGetMsg()

  Select
    Case $msg = $Execute
      MsgBox(0, "GUI Event", "Executing config script.")
       Call ("Write")


    Case $msg = $GUI_EVENT_CLOSE
      MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")
        Exit

ExitLoop
  EndSelect
WEnd 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Func Write ()


blah blah, does stuff with the variables (only it hasnt got them >.<)

EndFunc

i know its something dumb, thanks in advance for help :)

Edited by megatron

Share this post


Link to post
Share on other sites



;Create the input fields with defaults already entered
$IPAddress = GUICtrlCreateInput("192.168.", 100, 10, 100)
$Netmask = GUICtrlCreateInput("255.255.252.0", 100, 40)
$Gateway = GUICtrlCreateInput("192.168.0.1", 100, 70)

;Make a button to execute
$Execute = GUICtrlCreateButton("Execute", 100, 310, 100)




;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $Execute
            MsgBox(0, "GUI Event", "Executing config script.")
            Write()
            
            
        Case $msg = $GUI_EVENT_CLOSE
            MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")
            Exit
            
            ExitLoop
    EndSelect
WEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Func Write()
    MsgBox(0, "IPAdress", GUICtrlRead($IPAddress))
    MsgBox(0, "NetMask", GUICtrlRead($Netmask))
    MsgBox(0, "Gateway", GUICtrlRead($Gateway))
    
;~ blah blah, does stuff with the variables (only it hasnt got them >.<)
    
EndFunc  ;==>Write


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

You Sir, are a hero! :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0