Sign in to follow this  
Followers 0
surfer

GUI reload to get input data ?

3 posts in this topic

Hello,

how is it possible to reload an GUI to get the from

GUICtrlCreateInput again ???

Thanks

surfer

Share this post


Link to post
Share on other sites



The below code will get information from the input.

Modify it and then place it where you need it..

$data = GUICtrlRead($input)
MsgBox(64, "", $data)

Share this post


Link to post
Share on other sites

Hello Helge,

thanks a lot but please try my code and you will see what I mean:

#include <file.au3>
#include <GuiConstants.au3>
#include <Array.au3>
; http://www.sysinternals.com/Utilities/PsShutdown.html

Dim $aRecords

$file = "server.txt"
$psshutdown = "psshutdown.exe"
$server = "XXX"
$ListServer = "XXX"
$serverFileExists = FileExists ($file)
if $serverFileExists=0 Then
   MsgBox(4096,"Error", " Error file"&$file&" does not exists")
   Exit
EndIf

$shutdownFileExists = FileExists ($psshutdown)
if $shutdownFileExists=0 Then
   MsgBox(4096,"Error", " Error file "&$psshutdown&" does not exists")
   Exit
EndIf

If Not _FileReadToArray($file ,$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array     error:")
   Exit
EndIf
GuiCreate("Server Restart", 210, 430)
GUICtrlCreateLabel("Server from the file: "&$file, 10, 10, 180, 95)
GUICtrlCreateLabel("________________________________", 10, 25, 180, 95)
$counter = 50
$counterOne = 0
$counterOne = $aRecords[0]-1
$listTest = ""
$ListServer = GUICtrlCreateList("", 10, 40, 180, 97, -1)
For $x = 1 to $counterOne
        $listTest = $listTest&"|"& StringStripCR($aRecords[$x])
        GUICtrlSetData(-1, $listTest)
    $counter = $counter+20
Next
GUICtrlCreateLabel("Server", 10, 170, 80, 95)
$server = GUICtrlCreateInput ("", 10,  190, 130, 20)
GUICtrlCreateLabel("User", 10, 220, 80, 95)
$user = GUICtrlCreateInput ("", 10,  240, 130, 20)
GUICtrlCreateLabel("Password", 10, 270, 80, 95)
$password = GUICtrlCreateInput ("", 10,  290, 130, 20)
$RadioRestart = GuiCtrlCreateRadio("Restart", 10, 330, 90, 20);
$RadioShutdown = GuiCtrlCreateRadio("Shutdown", 10, 350, 90, 20);
$RadioLock = GuiCtrlCreateRadio("Lock", 10, 370, 90, 20);
$Button = GuiCtrlCreateButton("OK", 10, 410, 90, 20);



GuiSetState()

While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
    Case $msg = $Button
         server()
    EndSelect
WEnd




; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Func server()
Msgbox(0,'Server Restart:', "Test 0 "&GUICtrlRead($server)&" >"&GUICtrlRead($ListServer))
if GUICtrlRead($server) == "" Then
$server = $ListServer
Msgbox(0,'Server Restart:', "Test 1 "&GUICtrlRead($server)&" >"&GUICtrlRead($ListServer))
Endif
if GUICtrlRead($server) == 0 Then
Msgbox(0,'Server Restart:', "Test 2 "&GUICtrlRead($server)&" >"&GUICtrlRead($ListServer))
$server = $ListServer
Endif
if GUICtrlRead($server) == "Server" Then
Msgbox(0,'Server Restart:', "Test 3 "&GUICtrlRead($server)&" >"&GUICtrlRead($ListServer))
$server = $ListServer
Endif
if GUICtrlRead($server) == "0" Then
Msgbox(0,'Server Restart:', "Test 4 "&GUICtrlRead($server)&" >"&GUICtrlRead($ListServer))
$server = $ListServer
Endif
if GUICtrlRead($server) == "XXX" Then
Msgbox(0,'Server Restart:', "Test 5 "&GUICtrlRead($server)&" >"&GUICtrlRead($ListServer))
$server = $ListServer
Endif

if GUICtrlRead($ListServer) == "XXX" Then
Msgbox(0,'Server Restart:', "Test 6 "&GUICtrlRead($server)&" >"&GUICtrlRead($ListServer))
$server = $server
Endif

if GUICtrlRead($ListServer) == "" Then
Msgbox(0,'Server Restart:', "Test 7 "&GUICtrlRead($server)&" >"&GUICtrlRead($ListServer))
$server = $server
Endif

if GUICtrlRead($ListServer) == 0 Then
Msgbox(0,'Server Restart:', "Test 8 "&GUICtrlRead($server)&" >"&GUICtrlRead($ListServer))
$server = $server
Endif

; Msgbox(4096,'Record:' & GUICtrlRead($ListServer), "Test XXXX>"&GUICtrlRead($ListServer)&" Test2>"&GUICtrlRead($server))

        if GUICtrlRead($RadioRestart) = $GUI_CHECKED Then
              ; restart
                        $message1 = Msgbox(1,'Server Restart:', "Restart >"&GUICtrlRead($server))
                        if ($message1 == 1) Then
                             Run(@ComSpec & " /c " & "psshutdown \\"&GUICtrlRead($server)&" -u "&GUICtrlRead($user)&" -p "&GUICtrlRead($password)&" -r", "", @SW_HIDE);shutdown a pc
                Endif
        EndIf
        if GUICtrlRead($RadioShutdown) = $GUI_CHECKED Then
              ; shutdown
                  $message2 = Msgbox(1,'Server Shutdown:', "Shutdown >"&GUICtrlRead($server))
                  if ($message2 == 1) Then
                     Run(@ComSpec & " /c " & "psshutdown \\"&GUICtrlRead($server)&" -u "&GUICtrlRead($user)&" -p "&GUICtrlRead($password), "", @SW_HIDE);shutdown a pc
            EndIf
        EndIf
        if GUICtrlRead($RadioLock) = $GUI_CHECKED Then
              ; shutdown
                  $message3 = Msgbox(1,'Server Shutdown:', "Lock >"&GUICtrlRead($server))
                  if ($message3 == 1) Then
                     Run(@ComSpec & " /c " & "psshutdown \\"&GUICtrlRead($server)&" -u "&GUICtrlRead($user)&" -p "&GUICtrlRead($password)&" -l", "", @SW_HIDE);shutdown a pc
            EndIf
        EndIf
   
; $server = "XXX"
    $ListServer = GUICtrlRead($server)
EndFunc

You need the psshutdown and server.txt file.

You will see that the server input can be used only ones.

But why and why is the mouse disabled???

Greetings surfer

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