Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

MsgBox not takin enter key

$
0
0
Hello all.

I am having a problem with my MsgBox. First I have a custom GUI that I create and then after getting the users input in the GUI, I use the HotkeySet in the function for the GUI to get the Enter key. This will then end the GUI's function and call the MsgBox to get a confirmation. My problem is when the MsgBox comes up everything works fine except highlighting Yes or No and then pressing Enter doesn't do anything. I have to either click with the mouse or press Y for yes and N for No (normally enter works). Any ideas why enter doesn't work on my message box in this case?

In the main part of the script:
DeviceNumGUI()
$RUSure = MsgBox( 4, "Confirm Device Number", "Install Device Number " & $DeviceNumber & "?")


[ autoit ]         
Func DeviceNumGUI() $Complete = 0 $DeviceNumGUI = GUICreate("Installation", $ScreenRes[0] , $ScreenRes[1] , -1, -1, 0x00800000, -1 ) ;Create Label $L1Width = $ScreenRes[0] / 2 $L1Height = $ScreenRes[1] / 8 $L1Left = $ScreenRes[0] / 4 $L1Top = $ScreenRes[1] / 8 $Label1 = GUICtrlCreateLabel("Enter Device Number and Press Enter", $L1Left, $L1Top, $L1Width, $L1Height, 0x01) GUICtrlSetFont($Label1, 12, 700) ;Create Input Box for the Device Number $IWidth = $ScreenRes[0] / 4 $IHeight = $ScreenRes[1] / 30 $ILeft = $ScreenRes[0] * 3 / 8 $ITop = $L1Top + $L1Height + 60 $DeviceNumInput = GUICtrlCreateInput("", $ILeft, $ITop, $IWidth, $IHeight) HotKeySet("{ENTER}", "EnterPressed" ) GUISetState(@SW_SHOW, $DeviceNumGUI) While $Complete = 0 $nMsg = GUIGetMsg() WEnd EndFunc Func EnterPressed() $DeviceNumber = ControlGetText("Installation","", $DeviceNumInput) $MachineName = "AND1P" & StringFormat("%04d", $DeviceNumber) $Certificate = "AND1P" & StringFormat("%04d", $DeviceNumber) & ".pfx" If StringLen($DeviceNumber) = 0 OR StringIsDigit($DeviceNumber) = 0 Then ControlSetText("Installation","", $Label1,"Device Number Format Invalid:" & @CRLF & "Enter Device Number Again and Press Enter") ControlSetText("Installation","", $DeviceNumInput,"") ControlFocus("Installation","",$DeviceNumInput) Else $Complete = 1 ;GUIDelete($DeviceNumGUI) ;RunInstallWinPE($DeviceNumber, $MachineName) EndIf EndFunc

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>