Sign in to follow this  
Followers 0
vickerps

Autoit-qui Help

13 posts in this topic

slowly starting to learn the superb autoit-qui

One of the probs i'am have is how do you create a loop

I have written a little test script which i want to select a name from the combo box.

Once the user presses apply a messege box come up saying "name" was selected

This works no probs for the first time but then if they press apply again or choose a different name nothing happens.

How do i keep it looping?

example script

GUICreate("names")

GUISetControl("button", "Apply", 240,260)

GUISetControlNotify()

$combo = GUISetControl("combo", "my combo", -1,10,80)

GUISetControlData(-1,"paul|peter|sam")

GUISetControl("button", "Exit", 290,260,50)

While GUImsg()

$combo = GuiRead ($combo)

IF $combo = "paul" Then

MsgBox(0,"", $combo & " " & "was selected")

elseIF $combo = "peter" Then

MsgBox(0,"", $combo & " " & "was selected")

elseIF $combo = "sam" Then

MsgBox(0,"", $combo & " " & "was selected")

endif

Wend

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You override the $COMBO handle with the value of the combocontrol with this statement:$combo = GuiRead ($combo)

try it this way:

GUICreate("names")
GUISetControl("button", "Apply", 240,260)
GUISetControlNotify()
$C_COMBO = GUISetControl("combo", "my combo", -1,10,80)
GUISetControlData(-1,"paul|peter|sam")
GUISetControl("button", "Exit", 290,260,50)
While GUImsg()
   $COMBO = GuiRead($C_COMBO)
   If $COMBO = "paul" Then
      MsgBox(0,"", $COMBO & " " & "was selected")
   ElseIf $COMBO = "peter" Then
      MsgBox(0,"", $COMBO & " " & "was selected")
   ElseIf $COMBO = "sam" Then
      MsgBox(0,"", $COMBO & " " & "was selected")
   EndIf
Wend
Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I could not get your script to work. GUICreate does not exist. Possibly I don't have the latest version?

Anyway, after a quick look it seems that the Wile...Wend loop will exit after the first GUImsg is received, causing the whole function to stop. Also, there is way too much repitiion in there. You don't need to have a separate If...Then setup for each name if you just want to display which one was selected (all of the outcomes are the same).

Try this:

GUICreate("names")
GUISetControl("button", "Apply", 240,260)
GUISetControlNotify()

$combo = GUISetControl("combo", "my combo", -1,10,80)
GUISetControlData(-1,"paul|peter|sam")

GUISetControl("button", "Exit", 290,260,50)

While 1
     While GUImsg()
     $combo = GuiRead ($combo)
     MsgBox(0,"", $combo & " " & "was selected")
     Wend
Wend

Of course, then you will need to build in some check to allow exiting the endless While...Wend loop...

Edited by krclark

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I could not get your script to work. GUICreate does not exist. Possibly I don't have the latest version?

Try this:

GUICreate("names")
I am lost..... :whistle:

The code works fine for me...

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I do not have any GUI functions listed in my AutoIt3 help file. The program tells me that GUICreate is an unknown function.

I assume that this means somewhere there is an add-in for the GUI functions, but I did not see anything listed for downloads except the 2 versions of the program and some C++ code.

Share this post


Link to post
Share on other sites

I do not have any GUI functions listed in my AutoIt3 help file. The program tells me that GUICreate is an unknown function.

I assume that this means somewhere there is an add-in for the GUI functions, but I did not see anything listed for downloads except the 2 versions of the program and some C++ code.

This stuff is based on JPM's Test version that includes the GUI functions:

http://www.hiddensoft.com/fileman/users/jp...-gui.102.16.zip


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Okay, I downloaded that and will try it soon.

Is there a list of other useful things which can be downloaded to add-in to the program?

There is nothing listing user account folders that I can find...

Share this post


Link to post
Share on other sites

Right...

So I downloaded the GUI version. Now what?

Should I replace the original with these files?

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

I prefer to keep the Beta/Unstable versions in a seperate directory and make a Userfunction in the Editor so i am able to run the script Iam woking on with the Official or Beta version.

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

thanks JdeB

thant work great and learnt somthing in the process

using the same script the one you fixed for me. Is it possible to make it bring up the msgbox up without clicking on the apply button

so when they select the name in the combo box the msgbox will just come up

Kclarke don't take the script the litterally I only wrote it as an example. just found out about autoit-gui a few days ago and it superb with don't they just incorperate this into the main autoit dowload and have it as one entity.

oh and krclark thank for your input. go to the help file and go to gui references via the contents the index and search doesn't have the gui in it.

Share this post


Link to post
Share on other sites

oh and krclark thank for your input. go to the help file and go to  gui references via the contents the index and search doesn't have the gui in it.

JPM's last version (autoit-gui.102.16.zip) has a helpfile where he did add all his newfunctions to the helpfile Index...

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

that was quick lol only downloaded 15 the other day.

Jdeb have you had a any thoughts on what i asked?

using the same script the one you fixed for me. Is it possible to make it bring up the msgbox up without clicking on the apply button

so when they select the name in the combo box the msgbox will just come up

Share this post


Link to post
Share on other sites

Jdeb have you had a any thoughts on what i asked?

missed that questions... :D

try this:

GUICreate("names")
$C_COMBO = GUISetControl("combo", "my combo", -1,10,80)
GUISetControlNotify ( $C_COMBO,2)
GUISetControlData(-1,"paul|peter|sam")
GUISetControl("button", "Exit", 290,260,50)
While GUImsg()
  $COMBO = GuiRead($C_COMBO)
  If $COMBO = "paul" Then
     MsgBox(0,"", $COMBO & " " & "was selected")
  ElseIf $COMBO = "peter" Then
     MsgBox(0,"", $COMBO & " " & "was selected")
  ElseIf $COMBO = "sam" Then
     MsgBox(0,"", $COMBO & " " & "was selected")
  EndIf
Wend

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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