Jump to content

Input Boxes


Recommended Posts

So, I'm really bad at GUI's but if anyone could help me it would be great!

I would like to make an input box, a small one, to where I could put something in it, and then it would take me to a link with that something.

Let me make an example, or try.

So lets say I have the input box pop up, and I type in 1234

I would like my input box, we'll name it $input to be in some links.

Just confused. o_e

Example of what I would like.

; Input box pops up
; I put in input
; Takes me here with input
; Lets say $input = 1234

$input = 1234

ShellExecute("http://www.somesite.com/user/"& $input)
Sleep(2000)
ShellExecute("http://www.somesite.com/search/"& $input)
Sleep(2000)
ShellExecute("http://www.somesite.com/forums/topic/"& $input)

I know it doesn't have the GUI Inputbox.

Could someone start me off on how to make one though, or how it would work like that? :\

I would like to add a button to execute the input. Like after I type it I can press the button "Go!" or something, then it does it. o.o

Edited by Penisaurus
Link to comment
Share on other sites

So, I'm really bad at GUI's but if anyone could help me it would be great!

I would like to make an input box, a small one, to where I could put something in it, and then it would take me to a link with that something.

Let me make an example, or try.

So lets say I have the input box pop up, and I type in 1234

I would like my input box, we'll name it $input to be in some links.

Just confused. o_e

Example of what I would like.

; Input box pops up
; I put in input
; Takes me here with input
; Lets say $input = 1234

$input = 1234

ShellExecute("http://www.somesite.com/user/"& $input)
Sleep(2000)
ShellExecute("http://www.somesite.com/search/"& $input)
Sleep(2000)
ShellExecute("http://www.somesite.com/forums/topic/"& $input)

I know it doesn't have the GUI Inputbox.

Could someone start me off on how to make one though, or how it would work like that? :\

I would like to add a button to execute the input. Like after I type it I can press the button "Go!" or something, then it does it. o.o

For something this simple InputBox will work beautifully.

$input = InputBox ("Title", "Prompt", "Default")
if not $input then return ; So you can change your mind

Also, AutoIt should be able to queue the ShellExecutes, so the Sleep() isn't strictly needed. :mellow:

Edited by Fulano

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Link to comment
Share on other sites

For something this simple InputBox will work beautifully.

$input = InputBox ("Title", "Prompt", "Default")
if not $input then return ; So you can change your mind

Ah. Okay. I get it now.

I guess I was thinking it would be more difficult than it seemed.

Thank you! :]

Is there anyway to make it a bit smaller and more compact?

If I go too small it only seems to do the default. D':

Link to comment
Share on other sites

I'm not sure what you mean by 'smaller and more compact' - do you mean the code, or the box itself (which I believe has a minimum size, though I've never really bothered with it as it sizes itself well enough for me).

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Link to comment
Share on other sites

I'm not sure what you mean by 'smaller and more compact' - do you mean the code, or the box itself (which I believe has a minimum size, though I've never really bothered with it as it sizes itself well enough for me).

I mean, can I make it this size - Example

Without sizing it myself each time I run it?

Link to comment
Share on other sites

  • Moderators

Penisaurus,

From the Help file for InputBox:

The InputBox is user-resizable, but has a minimum size of approximately 190 x 115 pixels. Default size is approximately 250 x 190 pixels.

If you want it any smaller, you will have to write your own GUI code like this: :mellow:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$vID = _Get_ID()

MsgBox(0, "ID", $vID)

Func _Get_ID()

    $hGUI = GUICreate("ID Information", 180, 100, Default, Default, BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU), $WS_EX_TOPMOST)

    GUICtrlCreateLabel("Please type the ID!", 10, 10, 160, 20)

    $hInput = GUICtrlCreateInput("", 10, 40, 160, 20)

    $hOK_Button = GUICtrlCreateButton("OK", 10, 70, 75, 20)
    $hCan_Button = GUICtrlCreateButton("Cancel", 95, 70, 75, 20)

    GUISetState()

    While 1

        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $hCan_Button
                Exit
            Case $hOK_Button
                $vID = GUICtrlRead($hInput)
                GUIDelete($hGUI)
                Return $vID
        EndSwitch

    WEnd

EndFunc

Although this user-drawn GUI (which is based on your example) is only marginally smaller than the minimum size of an InputBox (180 x 100 vs 190 x 115) so you have to ask if it is worth the effort. :(

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

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