Sign in to follow this  
Followers 0
Pook

$Input1 = GUICtrlCreateInput (problem)

4 posts in this topic

Okay I'm still new at this.

I have two splash screens. The first screen gets the Hostname by using the command ' $Input1 = GUICtrlCreateInput("", 64, 176, 257, 22) ' however, I can't get the $Input var. to work later in the script on the second screen when I'm trying to ping $input1. Any ideas of what I'm doing wrong??

#include <GuiConstants.au3>
GUICreate("(Beta) ---------------- (Beta)", 386, 276, 344, 224)
$Pic1 = GUICtrlCreatePic("C:\-- Tests --\Blue_black_Gear.gif", 248, 16, 121, 113, BitOR($SS_NOTIFY,$WS_GROUP))
$Input1 = GUICtrlCreateInput("", 64, 176, 257, 22)
GUICtrlSetFont(-1, 9, 800, 0, "Tahoma")
$Group1 = GUICtrlCreateGroup("Enter Computer Name...", 16, 152, 353, 65)
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlSetState(-1, $GUI_HIDE)
$Label1 = GUICtrlCreateLabel("What is this 4 area (Beta). ", 16, 16, 226, 105)
GUICtrlSetFont(-1, 8, 800, 0, "Tahoma")
$button1 = GUICtrlCreateButton("Enter", 128, 232, 137, 33, 0)
GUISetState()


While 1
   $msg = GUIGetMsg() 
        If $msg = $GUI_EVENT_CLOSE Then
        ;Exitloop
            Exit
   Endif
     If $msg = $button1 Then
            ExitLoop
   Endif
   
WEnd

; ----------------------------------------------------------------------------
; End of screen one
; ----------------------------------------------------------------------------
; ----------------------------------------------------------------------------
; Start of screen Two
; ----------------------------------------------------------------------------
#region --- GuiBuilder code Start ---
GUICreate("(Beta) Problem  (Beta)", 350, 210)
$grp= GUICtrlCreateGroup("Select Fix", 10, 10, 330, 80)
$List = GUICtrlCreateCombo("Choose", 30, 30, 290, 21)
$Activate = GUICtrlCreateButton("Activate", 130, 60, 90, 20)
$Exit = GUICtrlCreateButton("Exit", 250, 160, 90, 20)
 GUICtrlCreateLabel("Workstation: ", 10, 110, 70, 20)
 $WKS = GUICtrlCreateLabel("WKS", 80,110,70,15)
 GUICtrlCreateLabel("Username: ", 10, 130, 60, 20)
 $UNAME = GUICtrlCreateLabel("UNAME", 80,130,70,15)
 GUICtrlCreateLabel("Ping: ", 10, 150, 60, 20)
$PNG = GUICtrlCreateLabel("", 80,150,70,15)
 GUICtrlCreateLabel("C:\ ", 10, 170, 60, 20)
$CAC = GUICtrlCreateLabel("CMD", 80,170,120,15)

;----------------------------------------------------------------

$var = Ping($Input1,250)
If $var Then; also possible:  If @error = 0 Then ...
  GUICtrlSetData ($PNG, "Online")
  GUICtrlSetColor($PNG,0x00bb00)
Else
 GUICtrlSetData ($PNG, "Offline")
 GUICtrlSetColor($PNG,0xff0000)
EndIf
;----------------------------------------------------------------
 If FileExists ( "\\" & $Input1 & "\C$\Windows\****.INI" )then
  GUICtrlSetData ($CAC, "Good")
  GUICtrlSetColor($CAC,0x00bb00)
Else
 GUICtrlSetData ($CAC, "Unable to Access")
 GUICtrlSetColor($CAC,0xff0000)
EndIf
 
;-------------------------------------------------------------------
GUISetState()

Share this post


Link to post
Share on other sites



$Input1 is the Control ID of the input control you created. It does not contain the data from the control. To get that:

While 1
   $msg = GUIGetMsg()
           If $msg = $GUI_EVENT_CLOSE Then
               Exit
           Endif
           If $msg = $button1 Then
               $InputData = GuiCtrlRead($Input1)
               ExitLoop
           Endif
WEnd

Now use $InputData where you need it.

:whistle:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

WOW ... that easy.... Thanks!!!

Share this post


Link to post
Share on other sites

WOW ... that easy.... Thanks!!!

That easy.

And, welcome to AutoIt!

:whistle:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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