Sign in to follow this  
Followers 0
emendelson

Force an InputBox Topmost?

9 posts in this topic

I know how to add 262144 to the flag on a MsgBox to force it topmost. Is there any way to accomplish the same thing with an InputBox?

IF the only way to do this is through a GUI Then...

Is any GUI expert willing to help me figure out how to create one that looks exactly like the result of:

InputBox($t, "Folder for temporary printfiles in root directory of drive " & $drv, $suggest, "", -1, 140)

where $t is a message title, $drv is the home drive, and $suggest is a folder name that I suggest.

EndIf

Many thanks for any help.

Share this post


Link to post
Share on other sites



I know how to add 262144 to the flag on a MsgBox to force it topmost. Is there any way to accomplish the same thing with an InputBox?

IF the only way to do this is through a GUI Then...

Is any GUI expert willing to help me figure out how to create one that looks exactly like the result of:

InputBox($t, "Folder for temporary printfiles in root directory of drive " & $drv, $suggest, "", -1, 140)

where $t is a message title, $drv is the home drive, and $suggest is a folder name that I suggest.

EndIf

Many thanks for any help.

Wait - sorry, I just saw this post:

http://www.autoitscript.com/forum/index.ph...l=inputbox++top

and will see if I can get it to work...

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

What exactly is the code that I would use with that method to force the InputBox topmost??

Here is the basic concept:
; InputBox OnTop
; Author - herewasplato

$ans = _InputBoxOnTop("testTitle", "testText")
MsgBox(0, "Returned", $ans)

Func _InputBoxOnTop($IBTitle, $IBText)
    Local $file = FileOpen(EnvGet("temp") & "\InputBoxOT.au3", 2)
    If $file = -1 Then Return;if error, give up on the move
    
    Local $line1 = 'AutoItSetOption(' & '"WinWaitDelay", 0' & ')'
    Local $line2 = 'WinWait("' & $IBTitle & '", "' & $IBText & '")'
    Local $line3 = 'WinSetOnTop("' & $IBTitle & '", "' & $IBText & '" ,1)'
    FileWrite($file, $line1 & @CRLF & $line2 & @CRLF & $line3)
    FileClose($file)
    
    Run(@AutoItExe & " /AutoIt3ExecuteScript " & EnvGet("temp") & "\InputBoxOT.au3")
    
    Local $ans = InputBox($IBTitle, $IBText)
    
    While Not FileDelete(EnvGet("temp") & "\InputBoxOT.au3")
        Sleep(10)
    WEnd
    
    Return ($ans)
EndFunc   ;==>_InputBoxOnTop
Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

this question popped up in my head a few minutes ago.. :) why didn't input box get the same treatment for extra options like msgbox?

thanks.. I tried adding all the values an input

; InputBox OnTop
; Author - herewasplato

$ans = _InputBoxOnTop("testTitle", "testText",'what','*M',400,400,0,0,5)
MsgBox(0, "Returned", $ans)

Func _InputBoxOnTop($IBTitle, $IBText,$a_Default='',$a_Passchar='',$a_Width=-1,$a_Height=-1,$a_left=-1,$a_top=1,$a_timeout=-1)
    Local $file = FileOpen(EnvGet("temp") & "\InputBoxOT.au3", 2)
    If $file = -1 Then Return;if error, give up on the move
   
    Local $line1 = 'AutoItSetOption(' & '"WinWaitDelay", 0' & ')'
    Local $line2 = 'WinWait("' & $IBTitle & '", "' & $IBText & '")'
    Local $line3 = 'WinSetOnTop("' & $IBTitle & '", "' & $IBText & '" ,1)'
    FileWrite($file, $line1 & @CRLF & $line2 & @CRLF & $line3)
    FileClose($file)
   
    Run(@AutoItExe & " /AutoIt3ExecuteScript " & EnvGet("temp") & "\InputBoxOT.au3")
   
    Local $ans = InputBox($IBTitle, $IBText)
   
    While Not FileDelete(EnvGet("temp") & "\InputBoxOT.au3")
        Sleep(10)
    WEnd
   
    Return ($ans)
EndFunc ;==>_InputBoxOnTop
Edited by slightly_abnormal

Share this post


Link to post
Share on other sites

...why didn't input box get the same treatment for extra options like msgbox?...

...because I really don't know enough to do that.

I've spent several hours searching/reading and I don't have the answers yet.

How can I allow the optional parms to be skipped without impacting the position of the InputBox?

How can I properly return the various @error values?

Should $ans be an array?

$ans[0] = InputBox return

$ans[1] = @error values

Should I use ByRef?

Should I just go to bed?

; InputBox OnTop
; Author - herewasplato

Global $err = 0
$ans = _InputBoxOnTop("Title", "Prompt")
MsgBox(0, "Returned", $ans)
MsgBox(0, "@error", $err)

Func _InputBoxOnTop($IBTitle, $IBPrompt, $IBDefault = "", $IBpassword_char = "", $IBWidth = -1, $IBHeight = -1, $IBLeft = 0, $IBTop = 0, $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)
    $err = @error
    
    While Not FileDelete(EnvGet("temp") & "\InputBoxOT.au3")
        Sleep(10)
    WEnd
    
    Return ($ans)
EndFunc   ;==>_InputBoxOnTop

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

...because I really don't know enough to do that.

I've spent several hours searching/reading and I don't have the answers yet.

How can I allow the optional parms to be skipped without impacting the position of the InputBox?

How can I properly return the various @error values?

Should $ans be an array?

$ans[0] = InputBox return

$ans[1] = @error values

Should I use ByRef?

Should I just go to bed?

; InputBox OnTop
; Author - herewasplato

Global $err = 0
$ans = _InputBoxOnTop("Title", "Prompt")
MsgBox(0, "Returned", $ans)
MsgBox(0, "@error", $err)

Func _InputBoxOnTop($IBTitle, $IBPrompt, $IBDefault = "", $IBpassword_char = "", $IBWidth = -1, $IBHeight = -1, $IBLeft = 0, $IBTop = 0, $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)
    $err = @error
    
    While Not FileDelete(EnvGet("temp") & "\InputBoxOT.au3")
        Sleep(10)
    WEnd
    
    Return ($ans)
EndFunc   ;==>_InputBoxOnTop
Well, after struggling for hours with getting the InputBox on top, your function solved the problem in about 45 seconds. Thank you. This really ought to be built into the program. Is there any chance it might be??

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Well, after struggling for hours with getting the InputBox on top, your function solved the problem in about 45 seconds. Thank you. This really ought to be built into the program. Is there any chance it might be??

You are welcome... and I doubt it will be included - there are dozens of little UDFs that do things like that - here is one collection: http://www.autoitscript.com/forum/index.ph...showtopic=19370

Edit: See here for better code:

http://www.autoitscript.com/forum/index.ph...ndpost&p=187372

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

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