kjbopp Posted November 15, 2007 Posted November 15, 2007 Newbie question; first post... Trying to change the content of $TextBox1 based on the GUICtrlSetData selection. There has to be a cleaner way of doing this because as soon as the loop exits there's no way to reselect. So I'm trying to stay within the GUI and when I click on the printer model, the corresponding IP will populate in the text box. Thanks in advance for any help. CODE#include <GUIConstants.au3> GUICreate("My GUI") GUICtrlCreateList("", 8, 25, 225, 97) GUICtrlSetData(-1, "HP CM8060 MFP with Edgeline PCL 6|HP Color LaserJet 4600 PCL6|HP LaserJet 4345 mfp PCL 6") $TextBox1 = GUICtrlCreateInput("111.11.111.11", 8, 147, 225, 21) GUISetState() While 1 $msg = GUIGetMsg() $PrinterModel = GUICtrlRead(3) $PrinterIP = GUICtrlRead(4) ;Send("{LEFT}") If StringInStr($PrinterModel, "HP CM8060 MFP with Edgeline PCL 6") Then $PrinterIP = "199.81.167.212" $TextBox1 = GUICtrlCreateInput($PrinterIP, 8, 147, 225, 21) GUISetState(@SW_SHOW) ExitLoop ElseIf StringInStr($PrinterModel, "HP Color LaserJet 4600 PCL6") Then $PrinterIP = "199.81.167.79" $TextBox1 = GUICtrlCreateInput($PrinterIP, 8, 147, 225, 21) GUISetState(@SW_SHOW) ExitLoop ElseIf StringInStr($PrinterModel, "HP LaserJet 4345 mfp PCL 6") Then $PrinterIP = "199.81.167.86" $TextBox1 = GUICtrlCreateInput($PrinterIP, 8, 147, 225, 21) GUISetState(@SW_SHOW) ExitLoop Else If $msg = $GUI_EVENT_CLOSE Then ExitLoop EndIf EndIf WEnd MsgBox(16, "New IP?", $PrinterModel & " " & $PrinterIP)
Valuater Posted November 15, 2007 Posted November 15, 2007 (edited) Welcome to the Autoit Forums #include <GUIConstants.au3> GUICreate("My GUI") GUICtrlCreateList("", 8, 25, 225, 97) GUICtrlSetData(-1, "HP CM8060 MFP with Edgeline PCL 6|HP Color LaserJet 4600 PCL6|HP LaserJet 4345 mfp PCL 6") $TextBox1 = GUICtrlCreateInput("111.11.111.11", 8, 147, 225, 21) GUISetState() While 1 $msg = GUIGetMsg() $PrinterModel = GUICtrlRead(3) $PrinterIP = GUICtrlRead(4) If $msg = $GUI_EVENT_CLOSE Then ExitLoop If StringInStr($PrinterModel, "HP CM8060 MFP with Edgeline PCL 6") Then $PrinterIP = "199.81.167.212" GUICtrlSetData($TextBox1, $PrinterIP) ElseIf StringInStr($PrinterModel, "HP Color LaserJet 4600 PCL6") Then $PrinterIP = "199.81.167.79" GUICtrlSetData($TextBox1, $PrinterIP) ElseIf StringInStr($PrinterModel, "HP LaserJet 4345 mfp PCL 6") Then $PrinterIP = "199.81.167.86" GUICtrlSetData($TextBox1, $PrinterIP) EndIf WEnd MsgBox(16, "New IP?", $PrinterModel & " " & $PrinterIP) Nice First Post, shows effort... 8) Edited November 15, 2007 by Valuater
kjbopp Posted November 15, 2007 Author Posted November 15, 2007 THANKS! Yeah, I think I was all around it but couldn't see the forest through the trees!
Valuater Posted November 15, 2007 Posted November 15, 2007 Welcome!! ... awaiting great stuff from you in the future 8)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now