Jump to content

inputbox()


Recommended Posts

  • Moderators

Hypertrophy ,

Short answer: with the mouse! :)

Longer answer: store the ControlID of the control and then check if GUIGetMsg() returns it:

#include <GUIConstantsEx.au3>

; Create GUI
$hGUI = GUICreate("Test", 500, 500)

$hInput = GUICtrlCreateInput("", 10, 10, 480, 20)

$hButton = GUICtrlCreateButton("OK", 10, 100, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            MsgBox(0,"Result", "You pressed the button!")
            Exit
    EndSwitch

WEnd

This is really basic stuff.......

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

how do i press ok on an input box i created?

You could do what Melba23 said or you can have it much simpler

Inputbox("Title","Prompt")
If @error = 1 Then Exit ; You press cancel

If you want the information from the inputbox to be used for something else:

$var = Inputbox("Title","Prompt")
If @error = 1 Then Exit ; You press cancel
If MsgBox(4,"Title,"Message " & $var) = 7 Then Exit

There is a lot of possible uses for that I just used MsgBox as an example!

Hope it helps :)

EDIT: Typo

Edited by Tekki
If you intend to use Sarcasm you must this sticker!!![size="1"][sub]pic made by manadar[/sub][/size]
Link to comment
Share on other sites

Hypertrophy ,

Short answer: with the mouse! :)

Longer answer: store the ControlID of the control and then check if GUIGetMsg() returns it:

#include <GUIConstantsEx.au3>

; Create GUI
$hGUI = GUICreate("Test", 500, 500)

$hInput = GUICtrlCreateInput("", 10, 10, 480, 20)

$hButton = GUICtrlCreateButton("OK", 10, 100, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hButton
            MsgBox(0,"Result", "You pressed the button!")
            Exit
    EndSwitch

WEnd

This is really basic stuff.......

M23

I'm sorry. What I meant was the OK button in InputBox(...)
Link to comment
Share on other sites

Take a look at ControlClick() in the help file.

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!"

Link to comment
Share on other sites

  • Developers

Yeah, and that's why I made this thread. I've been trying that and it's not working.

Do you mean to say you have an InpuBox() statement in the script and you want the same script to click the OK button?

(It always helps to show a code snippet showing your issue)

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Do you mean to say you have an InpuBox() statement in the script and you want the same script to click the OK button?

(It always helps to show a code snippet showing your issue)

That's what it reads like to me and "mine is not to reason why... ".

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!"

Link to comment
Share on other sites

Input box pauses the script.... run a secondary script to press Ok and that should do it

Link to comment
Share on other sites

Do you mean to say you have an InpuBox() statement in the script and you want the same script to click the OK button?

(It always helps to show a code snippet showing your issue)

Yes. But after reading what CodyBarret read I think his suggestion is a solution.

Link to comment
Share on other sites

Yes. But after reading what CodyBarret read I think his suggestion is a solution.

I don't know what CodeyBarret suggested but this should work.

#include <timers.au3>
$g = GUICreate("dummy window")
$t1 = _Timer_SetTimer($g,100,"checkip")
$ans = InputBox("title01","prompt","")


func checkip($a,$b,$c,$d)
    if winexists("title01") Then
        _Timer_KillTimer($g,$t1)
        msgbox(262144,"Input Box detected","OK button on Input Box will be pressed")
        controlclick("title01","","Button1")
    EndIf
EndFunc
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • Developers

Yes. But after reading what CodyBarret read I think his suggestion is a solution.

The question remain why you would want to have the script open an InputBox() and then have the script close it again?

If you want to wait for a particular time for an answer and then timeout, you could use the proper parameter for that in the InputBox() statement.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

The question remain why you would want to have the script open an InputBox() and then have the script close it again?

If you want to wait for a particular time for an answer and then timeout, you could use the proper parameter for that in the InputBox() statement.

Jos

Well when the InputBox() opens I set it's default value to ClipGet(). So I wanted to automate it where it would press ok which would then write to a file.

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