Jump to content

Inputbox


Sardith
 Share

Recommended Posts

Can you a set a inputbox ontop? so if you click on the surrouding area, it will still keep it's focus?

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

Paulie. Let me ask you a quick question. How in a loop can you use WinSetontop. You can't use it on a uncreated inputbox, you can't use it on a created input box, because the input box is waiting in the loop do to it needs a password.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

Thank you Smoke. Do you have any information on the styles for it?

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

  • Moderators

Thank you Smoke. Do you have any information on the styles for it?

? It's a custom input box... $iOnTop = 1 default is ontop.

I wonder if for ex_style if 0x00000008 or $WS_EX_TOPMOST might do it for you on the default input box... I'm not sure though.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Thanks. I missed the default for ontop. Thanks again.

Your welcome... I don't ever use the default inputbox so I looked, I thought it had a style option, but I guess the function I wrote above was confusing me on the issue.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

The ontop funcation of your inputbox works awesome. Is there any way to set the topleft corner position etc.

Is there also a method to put a timer to cancel the input box after a given time?

$Confirmation = InputBox("*Lockout*", "Please confirm Your Password.", "", "*", 150, 100, 50, 50, 15)
Edited by Sardith

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

  • Moderators

The ontop funcation of your inputbox works awesome. Is there any way to set the topleft corner position etc.

Is there also a method to put a timer to cancel the input box after a given time?

$Confirmation = InputBox("*Lockout*", "Please confirm Your Password.", "", "*", 150, 100, 50, 50, 15)
Now this is where I start to get irritated a tad...

1. Do you see any options to add a x and y coord position?

2. Do you have the ability to do that yourself?

3. If you do not see a way, and don't feel you have a way to do that, or don't choose to mess with the function at all... how would you normally set a windows position?

*winmove* maybe?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

I think this has too many params now

Func _InPutBoxEx($sTitle, $sText = '', $iWidth = 200, $iHeight = 75, $iLeft = -1, $iRight = -1, $iOnTop = 1, $nInStyle = -1, $nInStyleEx = -1)
    Local $aCID[5], $iY = 0, $sRead
    If $iLeft = -1 Or $iLeft = Default Then $iLeft = @DesktopWidth / 2.5
    If $iRight = -1 Or $iRight = Default Then $iRight = @DesktopHeight / 2.5
    If $iWidth < 175 Then $iWidth = 175
    If $iHeight < 75 Then $iHeight = 75
    If $sText <> '' Then $iY = 20
    Local $hGUI = GUICreate($sTitle, $iWidth, $iHeight + $iY, $iLeft, $iRight)
    If $sText <> '' Then $aCID[1] = GUICtrlCreateLabel($sText, 10, 10, $iWidth - 20, 20, $ES_CENTER)
    $aCID[2] = GUICtrlCreateInput('', 10, 10 + $iY, $iWidth - 20, 20, $nInStyle, $nInStyleEx)
    $aCID[3] = GUICtrlCreateButton('OK', (($iWidth - 150) / 2), 40 + $iY, 75, 25, $BS_DEFPUSHBUTTON)
    $aCID[4] = GUICtrlCreateButton('Cancel', (($iWidth - 150) / 2) + 80, 40 + $iY, 75, 25)
    WinSetOnTop($hGUI, '', $iOnTop)
    GUISetState()
    While 1
        Switch GUIGetMsg()
            Case - 3, $aCID[4]
                GUIDelete($hGUI)
                Return ''
            Case $aCID[3]
                $sRead = GUICtrlRead($aCID[2])
                GUIDelete($hGUI)
                Return $sRead
        EndSwitch
    WEnd
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Func _InPutBoxEx($sTitle, $sText = '', $iLeft = -1, $iTop = -1, $iWidth = 200, $iHeight = 75, $iOnTop = 1, $nInStyle = -1, $nInStyleEx = -1)
    Local $aCID[5], $iY = 0, $sRead
    If $iWidth < 175 Then $iWidth = 175
    If $iHeight < 75 Then $iHeight = 75
    If $sText <> '' Then $iY = 20
    Local $hGUI = GUICreate($sTitle, $iWidth, $iHeight + $iY)
    If $sText <> '' Then $aCID[1] = GUICtrlCreateLabel($sText, 10, 10, $iWidth - 20, 20, $ES_CENTER)
    $aCID[2] = GUICtrlCreateInput('', $iLeft, $iTop, $iWidth, $nInStyle, $nInStyleEx)
    $aCID[3] = GUICtrlCreateButton('OK', (($iWidth - 150) / 2), 40 + $iY, 75, 25, $BS_DEFPUSHBUTTON)
    $aCID[4] = GUICtrlCreateButton('Cancel', (($iWidth - 150) / 2) + 80, 40 + $iY, 75, 25)
    WinSetOnTop($hGUI, '', $iOnTop)
    GUISetState()
    While 1
        Switch GUIGetMsg()
            Case - 3, $aCID[4]
                GUIDelete($hGUI)
                Return ''
            Case $aCID[3]
                $sRead = GUICtrlRead($aCID[2])
                GUIDelete($hGUI)
                Return $sRead
        EndSwitch
    WEnd
EndFunc

Thats what i've been trying.

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

Here is my version on _InputBox() - If you want to set it on top, just use the value 0x00000008 as $exStyle param.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

You version has a lot of issues. Ie. The Ok and Cancel buttons don't work. You set styles, which cause some styles to be predefined. I'd leave it up to the user to define which styles they'd like.

I used a lot of smokes as a building block. My code works well.

Func _InputBox($Title, $Text = "", $Width = 200, $Height = 75, $Left = -1, $Top = -1, $OnTop = 1, $nInStyle = -1, $nInStyleEx = -1, $IsPassword=0, $IsDigits=0, $Timeout = 0)
    $hWnd = WinGetHandle(WinGetTitle(""))
    Local $aCID[5], $Y = 0, $sRead
    If $Left = -1 Or $Left = Default Then $Left = @DesktopWidth / 2.5
    If $Top = -1 Or $Top = Default Then $Right = @DesktopHeight / 2.5
    If $Width < 175 Then $Width = 175
    If $Height < 75 Then $Height = 75
    If $Text <> '' Then $Y = 20
    Local $hGUI = GUICreate($Title, $Width, $Height + $Y, $Left, $Top)
    If $Text <> '' Then $aCID[1] = GUICtrlCreateLabel($Text, 10, 10, $Width - 20, 20, $ES_CENTER)
    If $IsPassword <> 0 Then $IsPassword = 32
    If $IsDigits <> 0 Then $IsDigits = 8192
    $aCID[2] = GUICtrlCreateInput('', 10, 10 + $Y, $Width - 20, 20, $nInStyle & $IsPassword+$IsDigits, $nInStyleEx)
    $aCID[3] = GUICtrlCreateButton('OK', (($Width - 150) / 2), 40 + $Y, 75, 25, $BS_DEFPUSHBUTTON)
    $aCID[4] = GUICtrlCreateButton('Cancel', (($Width - 150) / 2) + 80, 40 + $Y, 75, 25)
    WinSetOnTop($hGUI, '', $OnTop)
    GUISetState()
    
    If $Timeout > 0 Then $TimerStart = TimerInit()
    While 1
        Switch GUIGetMsg()
            Case - 3, $aCID[4]
                Exit
            Case $aCID[3]
                $sRead = GUICtrlRead($aCID[2])
                Return $sRead
        EndSwitch
    If $Timeout > 0 And TimerDiff($TimerStart)/1000 >= $Timeout Then
            $RetValue = GUICtrlRead($aCID[2])
            WinSetState($hWnd, "", @SW_ENABLE)
            GUIDelete($aCID[2])
            SetError(2)
            Return $RetValue
        EndIf
    WEnd
EndFunc
Edited by Sardith

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
Share on other sites

  • Moderators

If $Timeout > 0 And Round(TimerDiff($TimerStart)/1000) = $Timeout ThenoÝ÷ Ù«­¢+Ù%ÀÌØíQ¥µ½ÕÐÐìÀ¹Q¥µÉ¥ ÀÌØíQ¥µÉMÑÉФ¼ÄÀÀÀÐìôÀÌØíQ¥µ½ÕÐQ¡¸

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Can you a set a inputbox ontop? so if you click on the surrouding area, it will still keep it's focus?

InputBox("Autoitinputboxtitle", "Autoitinputboxtext")
oÝ÷ Ù«­¢+Ø)]¡¥±Ä(]¥¹Ñ¥ÙÑ ÅÕ½ÐíÕѽ¥Ñ¥¹ÁÕѽáѥѱÅÕ½Ðì°ÅÕ½ÐíÕѽ¥Ñ¥¹ÁÕѽáÑáÐÅÕ½Ðì¤)]¹
Link to comment
Share on other sites

  • Moderators

InputBox("Autoitinputboxtitle", "Autoitinputboxtext")
oÝ÷ Ù«­¢+Ø)]¡¥±Ä(]¥¹Ñ¥ÙÑ ÅÕ½ÐíÕѽ¥Ñ¥¹ÁÕѽáѥѱÅÕ½Ðì°ÅÕ½ÐíÕѽ¥Ñ¥¹ÁÕѽáÑáÐÅÕ½Ðì¤)]¹
:whistle:

How does the script get to the While 1 Loop while the InputBox exists?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

He can't read. I already posted what you said Smoke, after Paulie responded with the same reply..

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...