Sign in to follow this  
Followers 0
myk3

GUIGetMsg()

9 posts in this topic

Is there a way to clear the GUIGetMsg()? I am loading a new gui and it appears to be keeping the old value.

Share this post


Link to post
Share on other sites



Have a little read about correctly using Multiple GUI's >> http://www.autoitscript.com/wiki/Managing_Multiple_GUIs


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thanks.. I think I got it.. but i keeps auto picking the "ok" button. Im not sure why..

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>

global $test, $form1, $form2, $ok, $cancel, $add, $delete, $edit, $file

main()




func Main()
    $Form1 = GUICreate("Patch Management", 749, 468, 186, 117)
    $Installers = GUICtrlCreateGroup("Installers", 8, 8, 185, 409, BitOR($GUI_SS_DEFAULT_GROUP,$BS_FLAT))
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $List1 = GUICtrlCreateList("", 16, 24, 169, 390)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $add = GUICtrlCreateButton("Add", 8, 424, 83, 33)
    $delete = GUICtrlCreateButton("Delete", 112, 424, 83, 33)
    $Group2 = GUICtrlCreateGroup("", 200, 56, 537, 105, BitOR($GUI_SS_DEFAULT_GROUP,$BS_FLAT))
    $file = GUICtrlCreateLabel("File Name: ", 208, 72, 72, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    $command = GUICtrlCreateLabel("Command Line:", 208, 112, 97, 20)
    GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $delpoy = GUICtrlCreateButton("Delpoy Now", 656, 24, 83, 33)
    $edit = GUICtrlCreateButton("Edit Installer", 568, 24, 83, 33)
    $Name = GUICtrlCreateLabel("INSTALLER NAME", 200, 24, 156, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $Group3 = GUICtrlCreateGroup("Deployments", 200, 168, 537, 289, BitOR($GUI_SS_DEFAULT_GROUP,$BS_FLAT))
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState(@SW_SHOW)

        While 1
            $msg = GUIGetMsg(1)
            switch $msg[1]
                case $Form1
                    Switch $msg[0]
                        Case $GUI_EVENT_CLOSE
                            Exit
                        Case $add
                            GUISetState(@SW_disable,$Form1)
                            installer()
                        Case $delete
                            MsgBox(0,"","Delete was pressed")
                        Case $delpoy
                            MsgBox(0,"","Deploy was pressed")
                        Case $edit
                            MsgBox(0,"","Edit was pressed")
                    EndSwitch
                case $Form2
                    Switch $msg[0]
                        case $file
                            MsgBox(0,"","File")
                        case $ok
                            MsgBox(0,"","OK")
                        case $cancel
                            GUISetState(@SW_hide,$Form1)
                            GUISetState(@SW_enable,$Form1)
                            exitloop
                    EndSwitch
            endswitch
        WEnd
EndFunc



func Installer()
    $Form2 = GUICreate("Installer", 738, 200, 380, 154)
    $Label1 = GUICtrlCreateLabel("Installer Name: ", 16, 16, 112, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    GUICtrlCreateInput("", 128, 16, 585, 21, BitOR($GUI_SS_DEFAULT_INPUT,$WS_BORDER))
    $Label2 = GUICtrlCreateLabel("Installer File: ", 16, 48, 97, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    GUICtrlCreateInput("", 129, 48, 551, 21, BitOR($GUI_SS_DEFAULT_INPUT,$WS_BORDER))
    $file = GUICtrlCreateButton("...", 688, 48, 27, 25)
    $Label3 = GUICtrlCreateLabel("Switches: ", 16, 80, 73, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    GUICtrlCreateInput("", 128, 80, 585, 21, BitOR($GUI_SS_DEFAULT_INPUT,$WS_BORDER))
    $Label4 = GUICtrlCreateLabel("NOTE: Ensure you have selected the proper silent switches, otherwise the deployment may appear to hang indefinitely", 128, 104, 584, 17)
    GUICtrlSetColor(-1, 0xFF0000)
    $Label5 = GUICtrlCreateLabel("Command Line: ", 16, 136, 114, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $Label6 = GUICtrlCreateLabel("", 128, 136, 588, 20, $WS_BORDER)
    $ok = GUICtrlCreateButton("OK", 645, 165, 27, 25)
    $cancel = GUICtrlCreateButton("Cancel", 675, 165, 45, 25)
    GUISetState()
EndFunc

I mirrored my gui from a software package called PDQ delpoy.. I am just trying to see if I can replicate it, using autoit

Edited by myk3

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Why not have a setup like Example 2 in the Wiki Entry? I see no reason from the code you posted above why you could do it like this.

OR change the top of your script with this >>

Global $ok = 9999, $cancel = 9999, $form2 ; ; Predeclare the variables with dummy values to prevent firing the Case statements
Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

I didn't even read that line... Thanks it worked :unsure:

Share this post


Link to post
Share on other sites

Excellent! It was in the Wiki though :unsure:


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

yea.. Not sure why you need to do that however.. I thought after you declared a variable it has a value of "" or 0?

Now I need some help looping through all the items in a list.. not sure how to do this.. Is there a function to get listview > array?

EDIT: I think I got it..

$l = 0
do
$deploy1 = _GUICtrlListBox_GetText($list2, $l)
msgbox(0,"",$deploy1)
$l += 1
until $deploy1 = 0
Edited by myk3

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I got it and it lists all the items but for some reason it adds a value of 0 at the end??

Edited by myk3

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I am having a new issue now.. I am trying to run PSexec and I get an error.. but I can run it normal from cmdline.. Someone else is having the same error..

http://forum.sysinternals.com/topic25173_post127972.html#127972

I posted on the general support with this error..

EDIT: I found out the error.. it seems my syntax was wrong :unsure:

Edited by myk3

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