Gtek Posted May 25, 2020 Share Posted May 25, 2020 Hi y'all! I'm trying to understand why the new GUicreate don't work. it does this. the 2nd windows open, but no buttons work. You guys can probably see right through it So thank you for all your help in advance 😁 expandcollapse popup#include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include "GUIConstants.au3" Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) Global $ExitID, $ibase, $scustomer, $parent1, $parent2 _Main() Func _Main() Local $installID $parent1 = GUICreate("Imaging", 435, 300) GUICtrlCreateLabel("Please select a action!", 10, 10) $InstallID = GUICtrlCreateButton("Install Image", 10, 50, 70, 20) GUICtrlSetOnEvent($InstallID, "OnYes") GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") GUISetState() ; display the GUI While 1 Sleep(1000) WEnd EndFunc ;==>_Main ;--------------- Functions --------------- Func OnYes() $parent2 = GUICreate("Fineman Imaging", 435, 300) GUICtrlCreateLabel("Please select a action!", 10, 10) GUICtrlCreateButton("Install Image", 10, 50, 70, 20) GUICtrlSetOnEvent(-1, "instpre") GUICtrlCreateButton("Make Image", 90, 50, 70, 20) GUICtrlSetOnEvent(-1, "makecus") $ExitID = GUICtrlCreateButton("Exit", 350, 50, 50, 20) GUICtrlSetOnEvent($ExitID, "OnExit") GUIDelete($Parent1) GUISetState(@SW_SHOW, $parent2) GUISetOnEvent($GUI_EVENT_CLOSE, "_Main") ;GUISetState() ; display the GUI While 1 Sleep(10) WEnd EndFunc ;Start conimg Function Func instpre() Local $iLoop = 1 While $iLoop = 1 $ibase = InputBox("Install With 10Ltsb19 Licens", "Enter module name" & @CRLF & "" & @CRLF & " f. eks. Si22" & @CRLF & " Don't add .gho/_10Ltsb19_") If @error = 1 Then MsgBox(0x0,"You Pressed Cancel", "Reture to main menu - pressed 'OK'") Return _main Else $scustomer = InputBox("Choose which Customer", "Enter name of customers image" & @CRLF & "" & @CRLF & " f. eks. Scala/combine/WZF" & @CRLF & " Don't add .gho/_10Ltsb19_") If @error = 1 Then MsgBox(0x0,"You Pressed Cancel", "Reture to main menu - pressed 'OK'") Return _main Else if 0 = FileExists("\\10.0.1.17\public\teknik_images\ibase\" & $ibase & "\" & $ibase & "_10ltsc19_" & $scustomer & ".gho") Then MsgBox(0x5,"Error", "File name doesn't exist" & @CRLF & "Or"& @CRLF & "Network connection is missing" & @CRLF & "Else" & @CRLF & "Examine path: \\FINESTORAGE\Public\Teknik_Images\ibase") Else $iLoop = 0 EndIf EndIf EndIf WEnd RunWait(@ComSpec & " /C " & 'Ghost64.exe -clone,mode=restore,src=\\10.0.1.17\public\teknik_images\ibase\'& $ibase &'\'& $ibase &'_10ltsc19_'& $scustomer &'.gho,dst=1 -ntexact -sure -auto',"") EndFunc; Stop ;Start preimg Function Func makecus() Local $iLoop = 1 While $iLoop = 1 $ibase = InputBox("Install With 10Ltsb19 Licens", "Enter module name" & @CRLF & "" & @CRLF & " f. eks. Si22" & @CRLF & " Don't add .gho/_10Ltsb19_") If @error = 1 Then MsgBox(0x0,"You Pressed Cancel", "Reture to main menu - pressed 'OK'") Return _main Else $scustomer = InputBox("Choose which Customer", "Enter name of customers image" & @CRLF & "" & @CRLF & " f. eks. Scala/combine/WZF" & @CRLF & " Don't add .gho/_10Ltsb19_") If @error = 1 Then MsgBox(0x0,"You Pressed Cancel", "Reture to main menu - pressed 'OK'") Return _main Else if 0 = FileExists("\\10.0.1.17\public\teknik_images\ibase\" & $ibase & "\" & $ibase & "_10ltsc19_.gho") Then MsgBox(0x5,"Error", "File name doesn't exist" & @CRLF & "Or"& @CRLF & "Network connection is missing" & @CRLF & "Else" & @CRLF & "Examine path: \\FINESTORAGE\Public\Teknik_Images\ibase") Else $iLoop = 0 EndIf EndIf EndIf WEnd RunWait(@ComSpec & " /C " & 'Ghost64.exe -clone,mode=restore,src=\\10.0.1.17\public\teknik_images\ibase\'& $ibase &'\'& $ibase &'_10ltsc19_.gho,dst=1 -ntexact -sure -auto',"") if 0 = FileExists("\\10.0.1.17\public\teknik_images\dokumentation\Kundetilpassede\" & $scustomer & "\BG" & $scustomer & "\BG.jpg") Then Exit Else DirCopy("\\10.0.1.17\public\teknik_images\dokumentation\Kundetilpassede\"& $scustomer &"\BG"& $scustomer &"", "d:\FineDir") FileCopy("d:\Finedir\BG"& $scustomer &".bat", "d:\Users\player\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\bg"& $scustomer &".bat") EndIf EndFunc ; Stop Func OnExit() If @GUI_CtrlId = $ExitID Then MsgBox(64, "Exit", "Imaging Canceled") Else MsgBox(64, "Cancel", "Action Canceled") EndIf Exit EndFunc ;==>OnExit2 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 25, 2020 Moderators Share Posted May 25, 2020 Gtek, You need to move the idle loop out of the 2 functions - AutoIt will not run another function while one is still running: expandcollapse popup#include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include "GUIConstants.au3" Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) Global $ExitID, $ibase, $scustomer, $parent1, $parent2 _Main() ; Put the idle loop here <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< While 1 Sleep(10) WEnd Func _Main() Local $installID $parent1 = GUICreate("Imaging", 435, 300) GUICtrlCreateLabel("Please select a action!", 10, 10) $installID = GUICtrlCreateButton("Install Image", 10, 50, 70, 20) GUICtrlSetOnEvent($installID, "OnYes") GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit") GUISetState() ; display the GUI EndFunc ;==>_Main ;--------------- Functions --------------- Func OnYes() $parent2 = GUICreate("Fineman Imaging", 435, 300) GUICtrlCreateLabel("Please select a action!", 10, 10) GUICtrlCreateButton("Install Image", 10, 50, 70, 20) GUICtrlSetOnEvent(-1, "instpre") GUICtrlCreateButton("Make Image", 90, 50, 70, 20) GUICtrlSetOnEvent(-1, "makecus") $ExitID = GUICtrlCreateButton("Exit", 350, 50, 50, 20) GUICtrlSetOnEvent($ExitID, "OnExit") GUIDelete($parent1) GUISetState(@SW_SHOW, $parent2) GUISetOnEvent($GUI_EVENT_CLOSE, "_Main") EndFunc ;==>OnYes ;Start conimg Function Func instpre() ConsoleWrite("instpre2" & @CRLF) EndFunc ;==>instpre ;Start preimg Function Func makecus() ConsoleWrite("makeus" & @CRLF) EndFunc ;==>makecus Func OnExit() If @GUI_CtrlId = $ExitID Then MsgBox(64, "Exit", "Imaging Canceled") Else MsgBox(64, "Cancel", "Action Canceled") EndIf Exit EndFunc ;==>OnExit For a more detailed explanation on how AutoIt runs functions, please read the Interrupting a running function tutorial in the Wiki. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Gtek Posted May 25, 2020 Author Share Posted May 25, 2020 Thank you Master Melba23. Will look in to that. 🖖 Link to comment Share on other sites More sharing options...
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