Height and Width settings

Recommended Posts

This is a complete newb question I'm sure but I could not find the anwser in the help file or searching the forums.

When, for example you are entering a new edit field GUICtrlCreateEdit you have to put the text you want and then the left and top and optionally the width and height. I cannot find out what those numbers are. Is it pixels? or a percentage? In the code I have posted I am trying to get the OK button below the edit box but I don't know what numbers to use. I think that I have the first number right (40) but again I don't know what that means, I just guessed enough times to get it where I want it and that logic doesn't apply to the ok button as I cannot get it where I need it. So in conclusion, what are the numbers that you have to enter in the left and top fields? Is it the number of pixels? If someone knows or knows where I might find this in the help file would be great as I am so close to getting what I need.

Share this post

Link to post

Share on other sites

So now that I have the button out of the way I am trying to set it up so that when you click the OK button the msgbox show the value in the editbox. The code below has what I have so far and what I am thinking of adding inside the While 1 statement is this

If $msg = $okbutton then

If $userinput = "" Then MsgBox (0,"","empty")

Else MsgBox (0,"",$userinput)

I keep getting a number in the message box even before I have a chance to enter anything into the editbox.

Share this post

Link to post

Share on other sites

Thank you Polyphem, that worked. I am still having an issue though with the copying what ever is in the editbox to the clipboard. When I enter something into the box then use edit copy, then paste into notepad it is always a number not the text that I entered. I posted my code so far. Thanks again.

Share this post

Link to post

Share on other sites

To get the content of a control always use Guictrlread(), if you just refer to $userinput you will only get the control ID. Also for username i would sugest to use an input control instead of an edit control... and please, next time use the AUTOIT tag (capital letters) instead of code tag, as these are hard to copy and paste.

Share this post

Link to post

Share on other sites

I'm afraid that I don't quit understand what you mean by next time use the AUTOIT tag (capital letters) instead of code tag. Do you mean when I post code. I am just using the insert codebox function on the right of the box then pasting my code in. Is there another way to do this? Sorry for the headache but this is the first time that I have attempted to post code in a forum.

Share this post

Link to post

Share on other sites

Dont bother, didnt want to flame. Yes, when posting code replace the "code" in the brackets with "AUTOIT", then the code will be properly formatted. I dont think there is an insert function for that tag... just a hint, no offence meant.

This post will be edited again by Polyphem: Tomorrow, 11:55 AM

Share this post

Link to post

Share on other sites

So now I am trying to open another au3 file from inside this GUI but again failing. When you click the help about menu I am looking for it to open another window with the about message. I have read around and think that maybe I should be creating a child GUI to this one? Or maybe just call the about.au3 like I have now? I cannot find anywhere in the help that explains how to create a child gui. So thats what I am looking for.

Share this post

Link to post

Share on other sites

The full path and filename of the AutoIt executable currently running. For compiled scripts it is the path of the compiled script.

So its a path and not a command, the path and filename of your "test" GUI to be precise.

Also if you use the about.au3 only for the test.au3, it would be better to include it, so that when compiling, it is added to the resulting .exe. Is it located in the same directory as the test.au3? then maybe

Share this post

Link to post

Share on other sites

So I added the script you gave me and I get an error when running the script. Yes the about.su3 is in the same directory as test.au3. I added the include line and when I run the program I get "include "about.au3" ^Error error:error parsing function call"

Is this what I need to be able to open the child GUI? or is it just something that I should include in my scripts?

Share this post

Link to post

Share on other sites

The full path and filename of the AutoIt executable currently running. For compiled scripts it is the path of the compiled script.

So its a path and not a command, the path and filename of your "test" GUI to be precise.

Also if you use the about.au3 only for the test.au3, it would be better to include it, so that when compiling, it is added to the resulting .exe. Is it located in the same directory as the test.au3? then maybe

Share this post

Link to post

Share on other sites

So, were getting there. What you proposed worked, but, When I run the Test.au3 I get the about.au3 box instantly and when I click the ok button on testa.au3 nothing happens. I have to hit ok in the about.au3 for the whole shootn match to close. I have attached both the test.au3 and the about.au3 for review.

Share this post

Link to post

Share on other sites

That got it. Woo-hoo. Now as usual, this fix causes another issue. After I hit the about button the about.au3 opens and I can click OK to close it but then no buttons or functions work in the main test.au3 window after the about.au3 closes. It just sits there and I can click the buttons and enter things into the text box but none of the controls work?

Share this post

Link to post

Share on other sites

OK I just had a brain storm for a program that I would like to make. We have a bunch of users here that we need to put behind our corporate firewall. Instead of me walking around to all the machines and doing this I thought that I would do up a GUI scipt for it. So what I am looking for is a way to test the destination machine to see if it is even on first, then somehow query the names of the network connections (i.e. local area connection 1) and return that to a variable that I can call later. Then I need to somehow be able to send the netsh command from XP to the destination computer in order to changes its gateway on the specified network adapter. I will try most of this but right off the bat I need to know if auoit it has some sort of window function that will allow me to see the result of variable. For instance, the user enteres a computer name and the script queries the network adapter names then displays those names into something like a dropdown box so that later when you are ready to change the computers gateway you can choose the computers NIC card from the drop down list. Make sense?