Sign in to follow this  
Followers 0
lyledg

Enter only numbers into Input Box?

11 posts in this topic

Please note, this is a question about the Inputbox function, NOT the Guictrlcreateinput

Taken from the Help file

InputBox

--------------------------------------------------------------------------------

Displays an input box to ask the user to enter a string.

InputBox ( "title", "Prompt" [, "Default" [, "password char" [, Width, Height [, Left, Top [, TimeOut]]]]] )

I know there is a way to limit the amount of characters using the settings above, but how do I limit that only numbers get entered into the Inputbox. I know GuictrlcreateInput has this functionality, but I want to refrain from using that as it means I have to create a child gui to achieve my goal.

Possible?

Share this post


Link to post
Share on other sites



I don't think it can be done on a standard input box. However by creating a function with a new GUI you don't have to make it a child of the first.

Just create it and use GUISwitch and GUIDelete when you are finished with it.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi,

Check the Custom _InputBox() in my signature, it have the needed functionality <_<

Edited by MsCreatoR

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...

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks Geosoft, that was this bit of uneccesary code I was trying to avoid.

Thanks MsCreator...will have a look

Edited by lyledg

Share this post


Link to post
Share on other sites

Fantastic job and thanks MS, but having a look at your Custom Input box, it is a Guictrlcreateinput in a child window

I was just hoping that there was a way to specifiy a paramater to the already exiting Inputbox function that would only allow numbers..

Share this post


Link to post
Share on other sites

it is a Guictrlcreateinput in a child window

Yes, and why this is a problem? you can use it as an include, just like wth built-in function, only you add _ before func name <_<

I was just hoping that there was a way to specifiy a paramater to the already exiting Inputbox function that would only allow numbers..

No, if it isn't in the help file, then it not have the parameter... but you always can post an Feature Request :) (i believe someone posted already), but i doubt that this param will be added, because if it can be done with UDF, then there is no need to inlarge the AutoIt source.

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...

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

Share this post


Link to post
Share on other sites

Thanks MS

Yes, and why this is a problem? you can use it as an include, just like wth built-in function, only you add _ before func name

Yep, know all that, just saying that it seems strange that we have an almost perfectly working function, only thing missing is the inability to limit it to numbers

Your UDF is great, but if you were able to use the Inputbox function with the number limiting usage, would you have needed to write your UDF in the first place, with all the child gui functionality and complexity?

Don't get me wrong, your script rocks, it just is a mystery as to why we can have that functionality in Guictrlcreateinput and not Inputbox???

I will put this in the Feature requests as you suggested and see what happens...

Cheers

Share this post


Link to post
Share on other sites

Mines not as elaborate as MsCreator's ... but it works all the same:

http://www.autoitscript.com/forum/index.ph...st&p=229361


[center]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.[/center]

Share this post


Link to post
Share on other sites

Hi Smoke

Could you please repost the link, I doubt it's working as is?

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Hi Smoke

Could you please repost the link, I doubt it's working as is?

I don't know if anything is wrong with the link... because I just clicked on it and it took me to where I had posted a custom _InputBox udf myself.

I do know that AutoIt is at a crawl at the moment though.

http://www.autoitscript.com/forum/index.ph...mp;#entry229361

Here's another.

http://www.autoitscript.com/forum/index.ph...mp;#entry310913

Edited by SmOke_N

[center]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.[/center]

Share this post


Link to post
Share on other sites

Thanks guys, both examples were a tremendous help.....

<_<

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