Sign in to follow this  
Followers 0
mdwerne

Creating a ComboBox with values for schtasks /ST

5 posts in this topic

#1 ·  Posted (edited)

So I apologize in advance for the horrible mess you see below. While there may be many issues with my code, I only need help with one part. This GUI is an interface for customers to install software pushed via SCCM. While I have Continue and Abort buttons working just fine, I'm trying to implement a scheduler that will allow the customer to defer the install for later in the day up until 11:30pm.

I'd like to have the combobox display the current time (12 hour format) and then all hours (both top and bottom of the hour) until 11:30pm. So if they check the "Defer" box, select a time from the dropdown (such as 8:30pm) and click "Go"...the time chosen will be sent to my 'unfinished' Scheduler function which will then create a task to be executed at the specified time. I hope that all makes some sense.

So again, the only thing I would like some help with is how to correctly create the combobox with the possible values based on the current local time. I should be able to figure out the rest.

Thanks for any suggestions,

-Mike

Edit:...Oops, if the moderator would like to move this post to the "Graphical User Interface (GUI) Help and Support", I wasn't thinking when I hit submit...sorry.

#include "_XMLDomWrapper.au3"
#include <Constants.au3>
#include <GuiRichEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Date.au3>

;Global $sFile = (@ScriptDir & "\Config.xml")
Global $hGUI, $FormTitle, $RTFName, $ProgramName, $TrayTip, $ShutdownTimer, $ParamName, $AbortAllowed, $AbortButtonName, $ContinueButtonName, $GoButton, $Scheduler
Global $hRichEdit, $ExitCode, $Width, $Height, $sHours

If @DesktopWidth > 1024 Then
    $Width = 1024
Else
    $Width = @DesktopWidth
EndIf

If @DesktopHeight > 768 Then
    $Height = 768
Else
    $Height = @DesktopHeight
EndIf

;_XMLFileOpen($sFile)

$FormTitle = _XMLGetAttrib("/MessageInfo/Title", "FormTitle")
$RTFName = _XMLGetAttrib("/MessageInfo/Display", "RTFName")
$ProgramName = _XMLGetAttrib("/MessageInfo/Program", "ProgramName")
$TrayTip = _XMLGetAttrib("/MessageInfo/TrayTip", "TrayTip")
$ShutdownTimer = _XMLGetAttrib("/MessageInfo/ShutdownTimer", "ShutdownTimer")
$ParamName = _XMLGetAttrib("/MessageInfo/Param", "ParamName")
$AbortAllowed = _XMLGetAttrib("/MessageInfo/Abort", "AbortAllowed")
$AbortButtonName = _XMLGetAttrib("/MessageInfo/ABN", "AbortButtonName")
$ContinueButtonName = _XMLGetAttrib("/MessageInfo/CBN", "ContinueButtonName")
$Scheduler = _XMLGetAttrib("/MessageInfo/Sched", "Scheduler")

_Main()

; Functions
Func _Main()
    Local $msg, $AbortButton, $ContinueButton, $ScheduleBox
    $hGUI = GUICreate($FormTitle, $Width - 20, $Height - 100, -1, 10, -1)
    $hRichEdit = _GUICtrlRichEdit_Create($hGUI, "", 10, 10, $Width - 40, $Height - 150, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
    ;GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
    _GUICtrlRichEdit_SetEventMask($hRichEdit, $ENM_LINK)
    _GUICtrlRichEdit_AutoDetectURL($hRichEdit, True)
    $ContinueButton = GUICtrlCreateButton($ContinueButtonName, $Width - 500, $Height - 133, 100, 25)
    GUICtrlSetFont($ContinueButton, 10, 800, 0, "Tahoma")
    $AbortButton = GUICtrlCreateButton($AbortButtonName, $Width - 390, $Height - 133, 100, 25)
    GUICtrlSetFont($AbortButton, 10, 800, 0, "Tahoma")
    $ScheduleBox = GUICtrlCreateCheckbox("Defer", $Width - 280, $Height - 133, 75, 25)
    GUICtrlSetFont($ScheduleBox, 10, 800, 0, "Tahoma")

    Global $hCombo = GUICtrlCreateCombo("", $Width - 200, $Height - 132, 90, 25)
    GUICtrlSetData(-1, @HOUR + 1 & "|" & @HOUR + 2 & "|" & @HOUR + 3 & "|" & @HOUR + 4 & "|" & @HOUR + 5 & "|" & @HOUR + 6 & "|" & @HOUR + 7 & "|" & @HOUR + 8)

    $GoButton = GUICtrlCreateButton("Go", $Width - 75, $Height - 133, 50, 25)
    GUICtrlSetFont($GoButton, 10, 800, 0, "Tahoma")

    GUISetState()
    _GUICtrlRichEdit_StreamFromFile($hRichEdit, $RTFName)
    _GUICtrlRichEdit_SetReadOnly($hRichEdit)
    _GUICtrlRichEdit_GotoCharPos($hRichEdit, 0)
    MouseClick("main", @DesktopWidth / 2, @DesktopHeight / 2, 0)
    Sleep(1000)
    ;GUISetState(@SW_MINIMIZE)
    GUISetState(@SW_SHOW)

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $ContinueButton
                Opt("TrayIconHide", 1)
                GUISetState(@SW_HIDE)
                $ExitCode = RunWait(@ScriptDir & "\" & $ProgramName)
                _GUICtrlRichEdit_Destroy($hRichEdit)
                ;MsgBox(0, "Program Exit Code", $ExitCode)
                Exit $ExitCode
            Case $msg = $GoButton
                Opt("TrayIconHide", 1)
                GUISetState(@SW_HIDE)
                ;Scheduler()
                _GUICtrlRichEdit_Destroy($hRichEdit)
                Exit
            Case $msg = $GUI_EVENT_CLOSE Or $msg = $AbortButton
                _GUICtrlRichEdit_Destroy($hRichEdit)
                Exit -1
        EndSelect
    WEnd
EndFunc   ;==>_Main

;~ Func Scheduler()
;~  Local $sXtra_Parms
;~  Local $sDateTime = _DateAdd('h', $sHours, _NowCalc())
;~  Local $sStartDate = StringMid($sDateTime, 6, 3) & StringMid($sDateTime, 9, 2) & "/" & StringLeft($sDateTime, 4)
;~  $sStartTime = StringRight($sDateTime, 8)

;~  If @OSVersion = "WIN_VISTA" Or @OSVersion = "WIN_7" Or @OSVersion = "WIN_8" Then $sXtra_Parms = " /Z /V1"

;~  Local $QueryTask = Run("SCHTASKS /QUERY /TN " & $FormTitle, "", @SW_HIDE, $STDOUT_CHILD)

;~  Local $line = ""

;~  While 1
;~      $line &= StdoutRead($QueryTask)
;~      If @error Then ExitLoop
;~  WEnd

;~  If $line = "" Then
;~      $sCmd = 'SCHTASKS /CREATE /SC ONCE /TN ' & $FormTitle & ' /TR ' & $ProgramName & ' /SD ' & $sStartDate & ' /ST ' & $sStartTime & ' /RU SYSTEM' & $sXtra_Parms
;~      Run($sCmd, "", @SW_HIDE)
;~      ;MsgBox(0, "", $sCmd) ; for testing
;~  Else
;~      $sCmd = 'SCHTASKS /CHANGE /TN ' & $FormTitle & ' /SD ' & $sStartDate & ' /ST ' & $sStartTime
;~      Run($sCmd, "", @SW_HIDE)
;~      ;MsgBox(0, "", $sCmd) ; for testing
;~  EndIf
;~ EndFunc   ;==>Scheduler

Here is the Config.xml file if you're interested.

<?xml version="1.0"?>
<MessageInfo>
    <Title FormTitle="EMET 4.1"/>
    <Display RTFName="RichText.rtf"/>
    <Program ProgramName="Emet installer.exe /sccm"/>
    <TrayTip TrayTip="EMET 4.1 Available"/>
    <ShutdownTimer ShutdownTimer="300000"/>
    <Param ParamName=""/>
    <Abort AbortAllowed="Y" />
    <ABN AbortButtonName="Not Now"/>
    <CBN ContinueButtonName="Continue"/>
    <Sched Scheduler="0"/>
</MessageInfo>
Edited by mdwerne

Share this post


Link to post
Share on other sites



Anyone have any suggestions on this, I've been poking at this for a couple days and not really making any progress.

If the mess above is too confusing, I can simplify and restate.

Thanks for taking a look,

-Mike

Share this post


Link to post
Share on other sites

Okay...I was left to my own devices long enough and actually came up with something, not pretty, but it seems to work.

(?) My question now is, where is the "0" coming from at the end of my ComboBox, and do I remove the "0". (?)

#include <GuiComboBox.au3>
#include <GUIConstantsEx.au3>
#include <Date.au3>

Global $CurrentTime, $i, $AMPM

If @HOUR > 12 Then
    $AMPM = "PM"
ElseIf @HOUR = 0 Then
    $AMPM = "AM"
Else
    $AMPM = "AM"
EndIf

GUICreate("ComboTest", 200, 40)
Global $hCombo = GUICtrlCreateCombo("New install time:", 10, 10, 180, 25)
GUICtrlSetData(-1, GetTimes())
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Func GetTimes()
    Local $CurrentHour = StringTrimRight(_NowTime(), 9)
    For $i = $CurrentHour To 11 Step +1
        _GUICtrlComboBox_BeginUpdate($hCombo)
        _GUICtrlComboBox_InsertString($hCombo, $i & ":00 " & $AMPM, -1)
        _GUICtrlComboBox_InsertString($hCombo, $i & ":30 " & $AMPM, -1)
        _GUICtrlComboBox_EndUpdate($hCombo)
    Next
EndFunc   ;==>GetTimes

Thanks for your time,

-Mike

Share this post


Link to post
Share on other sites

GetTimes() returns 0 so do not use GUICtrlSetData to add the return value of 0 to the combo.

Updated code

#include <GuiComboBox.au3>
#include <GUIConstantsEx.au3>
#include <Date.au3>

Global $CurrentTime, $i, $AMPM

If @HOUR > 12 Then
    $AMPM = "PM"
ElseIf @HOUR = 0 Then
    $AMPM = "AM"
Else
    $AMPM = "AM"
EndIf

GUICreate("ComboTest", 200, 40)
Global $hCombo = GUICtrlCreateCombo("New install time:", 10, 10, 180, 25)
; function returns value of 0
GetTimes()
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd

Func GetTimes()
    Local $CurrentHour = StringTrimRight(_NowTime(), 9)
    _GUICtrlComboBox_BeginUpdate($hCombo)
    For $i = $CurrentHour To 11
        _GUICtrlComboBox_InsertString($hCombo, $i & ":00 " & $AMPM, -1)
        _GUICtrlComboBox_InsertString($hCombo, $i & ":30 " & $AMPM, -1)
    Next
    _GUICtrlComboBox_EndUpdate($hCombo)
EndFunc   ;==>GetTimes
1 person likes this

Share this post


Link to post
Share on other sites

Thanks MHz, your correction and code clean up helped me learn a bit more.

All the best!

-Mike

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

  • Similar Content

    • SkysLastChance
      By SkysLastChance
      I keep losing the count of my $r varable when I go into the dropdown () function and call the same function.
      #include <Excel.au3> #include <AutoItConstants.au3> #include<GUIConstantsEx.au3> #include<EditConstants.au3> #include<GUIConstants.au3> Global $iBox, $oExcel, $oWorkbook, $r = 1, $x = 3 HowMany() Excel () Dropdown () Sleep (500) Func Dropdown () $list = GUICreate("Chart", 225, 80) $combobox = GUICtrlCreateCombo("Clinic 1", 10, 10, 120, 20) GUICtrlSetData(-1, "Clinic 2|Clinic 3|Clinic 4") $button = GUICtrlCreateButton("Select", 10, 40, 60, 20) GUISetState(@SW_SHOW) While 1 $guibox = GUIGetMsg() Select Case $guibox = $button Select Case GUICtrlRead($combobox) = "Clinic 1" GUIDelete($list) Auto () EndSelect Case $guibox = $GUI_EVENT_CLOSE EndSelect WEnd EndFunc Func HowMany() Local $iMsg While 1 ;~ Turn input into a number $iBox = Number(InputBox ("Regestration", "How Many Patients are there total?")) ;~ If user enters a string or cancels then get them to try again If $iBox = 0 Then $iMsg = MsgBox(1,'Regestration', 'Please enter a valid number') If $iMsg = 2 Then Exit Else ExitLoop EndIf WEnd EndFunc Func Excel() While ProcessExists("EXCEL.EXE") $ms = MsgBox(5,"","Process error. You have an Excel sheet open. You must close it in order to let this program work. Please close it now.") If $ms=2 Then Exit ;~ Doesn't require sleep since the script is paused by the MsgBox above ;~ Sleep(250) WEnd ;~ Shouldn't use Global Scope inside functions moved to top of script Local $sExcelFile = FileOpenDialog("Choose/Create Excel File", @ScriptDir, "(*.xlsx)") If FileExists($sExcelFile) Then ;~ Shouldn't use Global Scope inside functions moved to top of script $oExcel = _Excel_Open () $oWorkbook = _Excel_BookOpen($oExcel,$sExcelFile) ;this will open the chosen xls file. Else $oExcel = _Excel_Open() $oWorkbook = _Excel_BookNew($oExcel, 2);this is here to create the xls file if it does not exist. EndIf EndFunc Func Auto() Local $aArray1 = _Excel_RangeRead($oWorkbook) ;~ If $iBox is greater than no. of rows in $aArray then $iBox equals the number of rows in $aArray If $iBox > (UBound($aArray1) - 1) Then $iBox = UBound($aArray1) - 1 For $i = 2 To UBound($aArray1) - 1 ;$i =0 Start from row A If $aArray1[$i][1] = "" Then Continueloop $sR0 = $aArray1[$i][0] ;status $sR1 = $aArray1[$i][1] ;Last Name $sR2 = $aArray1[$i][2] ;First Name $sR3 = $aArray1[$i][3] ;DOB $sR4 = $aArray1[$i][4] ;Sex $sR5 = $aArray1[$i][5] ;Mailling Address $sR6 = $aArray1[$i][6] ;Zip $sR7 = $aArray1[$i][7] ;Phone # $sR8 = $aArray1[$i][8] ;Visit Reason $sR9 = $aArray1[$i][9] ;Insurance $sR10 = $aArray1[$i][10] ;Clinic $sR11 = $aArray1[$i][11] ;Provider $sR12 = $aArray1[$i][12] ;Appt Time $sR13 = $aArray1[$i][13] ;Appt Date WinWaitActive ("Untitled - Notepad") ControlSend("Untitled - Notepad", "", "", $sR1 & ',' & $sR2 & @CR) $r += 1 If $r > $iBox Then Exit Dropdown () Next EndFunc so the second time I choose clinic 1 I want it to go to the next row which would be Champ brett in my example excel.
       
      Test.xlsx
    • siva1612
      By siva1612
      I would like to create a window like the one shown below. The requirements are as below
      1. The title bar should be opaque.
      2. The parent window/Main screen will be below the side menu/child window
      3. The left side of the side menu window should be opaque.
      4. The right side should be semi-transparent. 

       
      Any idea to help?
    • Lights_On
      By Lights_On
      Hi all,

      I am having a little trouble with ‘GUICtrlSetResizing’ an hoping someone could push me in the direction of best practice.

      I have a basic GUI created to a set size with the enabled abilities to resize it:

      GUICreate("Test", 500, 450, -1, -1, BitOR($WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX))

      Inside this I have an image and label:

      GUICtrlCreateLabel($Image1StampInfo, 10, 395, 480, 20, $SS_CENTER) GUICtrlCreatePic($TheImage, 25, 25, 450, 350)

      Using:

      Case ($GUI_EVENT_MAXIMIZE or $GUI_EVENT_RESTORE or $GUI_EVENT_RESIZED)

      I activate:

       
      GUICtrlSetResizing($TheImageBox, $GUI_DOCKAUTO) GUICtrlSetResizing($Image1Stamp, $GUI_DOCKAUTO)

      This works fine with the image but not with the label – the label after a bit of resizing seems to get stuck in different places in the GUI as if the $GUI_DOCKAUTO has not worked properly.

      So 2 questions if I may. 

      1)    Have I used $GUI_DOCKAUTO incorrectly for use with lables?

      2)    I am happy to manually set new sizes dynamically but how? I can get the size of the window with ‘WinGetPos()’ but how do I set new size parameters for the ‘label’ and ‘image’?

      Thank you in advance.

    • FrancescoDiMuro
      By FrancescoDiMuro
      Good evening guys ( almost good night here in Italy )  
      How are you? Hop you're fine  
      I'm trying to do a Login Form ( I did, but I'm missing something in the management ), that allows the user to login when the script is launched, and, when the main GUI is opened, the user can Logout and Login with another username and password.
      The username and password "checking" I do is done by a text file, which in there are username and password, crypted through _Crypt_EncryptData().
      The "issue" I'm having at the moment, is to manage the Login form when the user hasn't already done the login, and so, the main GUI is not visible, but is created...
      I create the main GUI after the Login form... I tried with WinActive, WinGetState, but nothing changed ( even at the first Login, the script says ( through a MsgBox ) that the Win does exists ( or is active... ) and, as I want, it is not shown again...

      I really don't know If I missed something, or, I don't know...
      I'm going crazy for this thing...
      If someone could help me, I'd really appreaciate it!
      Thanks for the reading
      #Region ### START Koda GUI section ### Form=C:\Users\Portatile-60\Documents\Documenti Lavoro\AutoIt\Gestione_Magazzino_v2\form_Login.kxf Global $form_Login = GUICreate("Effettua il Login per continuare:", 405, 120, @DesktopWidth/2 - 202.5, @DesktopHeight/2 - 150) ; 302, 218 GUISetOnEvent($GUI_EVENT_CLOSE, "GUIDeleteLogin") Global $combo_Username = GUICtrlCreateCombo("Di Muro Francesco", 104, 64, 217, 25) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetData($combo_Username, "somedata") Global $input_Password = GUICtrlCreateInput("", 104, 89, 217, 25, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") $button_VerificaDati = GUICtrlCreateButton("", 328, 66, 42, 42, $BS_ICON) GUICtrlSetImage(-1, "C:\Users\Portatile-60\Documents\Documenti Lavoro\AutoIt\Gestione_Magazzino_v2\Icone\icon_check.ico", -1) GUICtrlSetOnEvent($button_VerificaDati, "CheckLogin") $label_Titolo = GUICtrlCreateLabel("Login", 167, 14, 71, 33) GUICtrlSetFont(-1, 18, 800, 0, "Arial") $label_Username = GUICtrlCreateLabel("Username :", 24, 64, 76, 20) GUICtrlSetFont(-1, 10, 800, 0, "Arial") $label_Password = GUICtrlCreateLabel("Password :", 24, 89, 73, 20) GUICtrlSetFont(-1, 10, 800, 0, "Arial") #EndRegion ### END Koda GUI section ### Func CheckLogin() Local $sUsername = GUICtrlRead($combo_Username) Local $sPassword = GUICtrlRead($input_Password) MsgBox($MB_ICONINFORMATION, "", "Username: " & $sUsername & @CRLF & "Password: " & $sPassword) Local $sFileUtenti = @ScriptDir & "\utenti.txt" If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante la lettura del file!") Exit Else Local $hFileUtenti = FileOpen($sFileUtenti, $FO_READ) If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante l'apertura del file " & $sFileUtenti & "." & @CRLF & "Errore: " & @error) Else Local $sDatiUtente, $aDatiUtente Local $bUtenteTrovato = False Local $iLinea = 1 Local $sControlloWin = "" Local $sWin = WinGetState($form_GestioneMagazzino) MsgBox($MB_ICONINFORMATION, "", $sWin) If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante la verifica della GUI attiva." & @CRLF & "Errore: " & @error) EndIf If($sWin == 5) Then MsgBox($MB_ICONINFORMATION, "", "La GUI esiste!") Do $sDatiUtente = FileReadLine($hFileUtenti, $iLinea) $aDatiUtente = StringSplit($sDatiUtente, "|", $STR_NOCOUNT) If(BinaryToString(_Crypt_DecryptData($aDatiUtente[0], "CRYPT", $CALG_RC4)) = $sUsername And BinaryToString(_Crypt_DecryptData($aDatiUtente[1], "CRYPT", $CALG_RC4)) = $sPassword) Then $sControlloWin = "ESISTE" $bUtenteTrovato = True ExitLoop Else $iLinea+=1 If($sDatiUtente = "" And $bUtenteTrovato = False) Then MsgBox($MB_ICONWARNING, "Attenzione!", "Username o Password errati.") ExitLoop EndIf EndIf Until $bUtenteTrovato = True Else MsgBox($MB_ICONINFORMATION, "", "La GUI esiste!") Do $sDatiUtente = FileReadLine($hFileUtenti, $iLinea) $aDatiUtente = StringSplit($sDatiUtente, "|", $STR_NOCOUNT) If(BinaryToString(_Crypt_DecryptData($aDatiUtente[0], "CRYPT", $CALG_RC4)) = $sUsername And BinaryToString(_Crypt_DecryptData($aDatiUtente[1], "CRYPT", $CALG_RC4)) = $sPassword) Then $sControlloWin = "NON ESISTE" $bUtenteTrovato = True ExitLoop Else $iLinea+=1 If($sDatiUtente = "" And $bUtenteTrovato = False) Then MsgBox($MB_ICONWARNING, "Attenzione!", "Username o Password errati.") ExitLoop EndIf EndIf Until $bUtenteTrovato = True EndIf If($sControlloWin = "ESISTE") Then MsgBox($MB_ICONINFORMATION, "Login effettuato!", "Hai effettuato l'accesso come: " & @CRLF & $sUsername & ".") ; Setta come "non-cliccabile" il bottone di Login GUICtrlSetState($button_Login, $GUI_DISABLE) GUICtrlSetState($button_VisualizzaGiacenze, $GUI_ENABLE) GUICtrlSetState($button_AggiungiProdotto, $GUI_ENABLE) GUICtrlSetState($button_PrelevaProdotto, $GUI_ENABLE) GUICtrlSetState($button_RicercaProdotto, $GUI_ENABLE) GUICtrlSetState($button_CreaDDT, $GUI_ENABLE) GUICtrlSetState($button_MostraGiacenzeAZero, $GUI_ENABLE) GUICtrlSetState($combo_Magazzino, $GUI_ENABLE) GUICtrlSetState($button_Logout, $GUI_ENABLE) ; Setta come "non-cliccabile" il bottone di Login GUICtrlSetState($button_Login, $GUI_DISABLE) ; Setta l'utente che ha effettuato l'accesso nella label $label_CaptionUtente GUICtrlSetData($label_CaptionUtente, $sUsername) ; "Distruggi" la GUI Login GUIDelete($form_Login) FileClose($hFileUtenti) Else MsgBox($MB_ICONINFORMATION, "", "La GUI non esiste!") MsgBox($MB_ICONINFORMATION, "Login effettuato!", "Hai effettuato l'accesso come: " & @CRLF & $sUsername & ".") ; Mostra la GUI Principale GUISetState(@SW_SHOW, $form_GestioneMagazzino) ; Setta come "non-cliccabile" il bottone di Login GUICtrlSetState($button_Login, $GUI_DISABLE) ; Setta l'utente che ha effettuato l'accesso nella label $label_CaptionUtente GUICtrlSetData($label_CaptionUtente, $sUsername) ; "Distruggi" la GUI Login GUIDelete($form_Login) FileClose($hFileUtenti) EndIf EndIf EndIf EndFunc Func Logout() GUICtrlSetData($label_CaptionUtente, "") MsgBox($MB_ICONINFORMATION, "Logout effettuato!", "Effettua nuovamente il Login per utilizzare il programma.") ; Disabilita tutti i bottoni della GUI Principale GUICtrlSetState($button_VisualizzaGiacenze, $GUI_DISABLE) GUICtrlSetState($button_AggiungiProdotto, $GUI_DISABLE) GUICtrlSetState($button_PrelevaProdotto, $GUI_DISABLE) GUICtrlSetState($button_RicercaProdotto, $GUI_DISABLE) GUICtrlSetState($button_CreaDDT, $GUI_DISABLE) GUICtrlSetState($button_MostraGiacenzeAZero, $GUI_DISABLE) GUICtrlSetState($combo_Magazzino, $GUI_DISABLE) GUICtrlSetState($button_Logout, $GUI_DISABLE) ; Abilita il Login GUICtrlSetState($button_Login, $GUI_ENABLE) EndFunc EDIT:
      Solved, making an "integrated" Login form... 
    • AnonymousX
      By AnonymousX
      Hello, 
      I'm wondering if it is possible to read a radio button off a GUI running by another program? 
      Someone created these Outlook emails that when open appear to be in a GUI format. I could easily come up with a way of navigating these fields by using tab inputs, and then copying specific fields that I need. However there is a spot on the form that has 4 choices of radio buttons, asking for what the status of the task is, and I have no idea how to store which one of these was pressed. 
      End game is to be able to go through thousands of these forms, take input from specific fields from this GUI form in outlook and copy into cells in an excel spreadsheet. I believe I could create a script to do everything I need, if I could just obtain the value from which radio button was pressed.
      Any advice on how to obtain which radio button was press in this outlook form would be appreciated.
      Thanks,
      If I knew VBA better Outlook might have its own functions for figuring this out.
       
      Example:

      In this example I'd want to be able to know that the 2nd or Assigned radio button was selected. Only 1 button is able to be selected at a time. I'm assuming the way to do this would be to tab through the form get to the first box and then run some command to check if pressed then if no, keep checking till I find which of the 4 were pressed.