; InputBox OnTop
; Author - herewasplato
$ans = _InputBoxOnTop("Title", "Prompt")
If @error = 0 Then MsgBox(0, "Returned", $ans)
If @error = 1 Then MsgBox(0, "", "The Cancel button was pushed.")
If @error = 2 Then MsgBox(0, "", "The Timeout time was reached.")
If @error = 3 Then MsgBox(0, "", "The InputBox failed to open.")
Func _InputBoxOnTop($IBTitle, $IBPrompt, $IBDefault = "", _
$IBpassword_char = "", $IBWidth = -1, $IBHeight = -1, _
$IBLeft = Default, $IBTop = Default, $IBTimeOut = "")
Local $file = FileOpen(EnvGet("temp") & "\InputBoxOT.au3", 2)
If $file = -1 Then Return;if error, give up
Local $line1 = 'AutoItSetOption(' & '"WinWaitDelay", 0' & ')'
Local $line2 = 'WinWait("' & $IBTitle & '", "' & $IBPrompt & '")'
Local $line3 = 'WinSetOnTop("' & $IBTitle & '", "' & $IBPrompt & '" ,1)'
FileWrite($file, $line1 & @CRLF & $line2 & @CRLF & $line3)
FileClose($file)
Run(@AutoItExe & " /AutoIt3ExecuteScript " & EnvGet("temp") & "\InputBoxOT.au3")
Local $ans = InputBox($IBTitle, $IBPrompt, $IBDefault, _
$IBpassword_char, $IBWidth, $IBHeight, _
$IBLeft, $IBTop, $IBTimeOut)
If @error Then
$ans = @error
While Not FileDelete(EnvGet("temp") & "\InputBoxOT.au3")
Sleep(10)
WEnd
SetError($ans)
$ans = ""
Return $ans
EndIf
While Not FileDelete(EnvGet("temp") & "\InputBoxOT.au3")
Sleep(10)
WEnd
Return ($ans)
EndFunc;==>_InputBoxOnTop
|