Sign in to follow this  
Followers 0
hogfan

Inputbox question......specifying parameters.........

5 posts in this topic

This should be an easy one. I don't understand why I am getting a syntax error on this inputbox. All I am trying to do is specify the parent window of the inputbox, so that some of my app users can't try to do something else in the application before putting the requested info in the inputbox:

$myIP = InputBox("TELNET", "Please enter IP:", "", "",,,,,, $Form1_1_1)

The autoit fuction help shows the format should be like this:

[color=#000000]InputBox ( "title", "prompt" [, "default" [, "password char" [, width [, height [, left [, top [, timeout [, hwnd]]]]]]]] )

As you can see, I don't care about specifying the other optional parameters (ie. width, height, left, top, & timeout).

I also tried this:

$myIP = InputBox("TELNET", "Please enter IP:", "", "", $Form1_1_1)

but that just freaks out the app.....as I think it should since I believe it's trying to interpret my parent form name as the width parameter.

So the question is, how can I NOT specify those other optional parameters but specify the parent window.

-hogfan

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You'll have to use some parameteres so that the user can at least see the InputBox!

Try this:

$myIP = InputBox("TELNET", "Please enter IP:", "", "",30,10,-1,-1,default, $Form1_1_1)

Spelling !

Edited by JoHanatCent

Share this post


Link to post
Share on other sites

When you want to use a parameter that's optional, you MUST put something into all of the other optional parameters before it, you don't have to specify any in the parameters that follow it, but the ones before it has to have something in them, even if it's the Default keyword or -1 (neither which may or may not work as a parameter for that function).


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Ok, that works great! And that makes a lot more sense now. I think in VB you don't have to specify a default value for optional parameters and that's what threw me off. I like the window position of the inputbox though and the window size. Is there an easy way to determine what the default values are so that I can specify these in my optional parameters? Thanks for the help.

-hogfan

Share this post


Link to post
Share on other sites

Nevermind. Looks like this works just fine:

$myIP = InputBox("TELNET", "Please enter IP:", "", "",default,default,default,default,default, $Form1_1_1)

Thanks for everyone's help that responded.

-hogfan

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