Sign in to follow this  
Followers 0
danielgomez

Duda al combinar checkbox y combobox + ciclo while

11 posts in this topic

#1 ·  Posted

Hola no se si me puedan ayudar pero tengo un problema con mi código específicamente en esta función ya que yo quiero que el siclo cierre el programa cuando $i <= $selector cual creen que sea el problema ?

$seleccion = GUICtrlCreateCombo("Select", 104, 200, 57, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "2|4|6")

Func buscarimg()
   $buscar_x = 0
   $buscar_y = 0
   Local $i = 0
   $selector = GUICtrlRead($seleccion)
   $search_img = _ImageSearch('axep.bmp', 1, $buscar_x, $buscar_y, 0)
   While $i <= $selector
      If $search_img = 1 Then
         MouseClick($MOUSE_CLICK_LEFT, $buscar_x, $buscar_y, 2)

      EndIf
      clickexit()
      If $i <= $selector Then
         MsgBox(0, "Error", "la imagen no se encontro")
         Exit
      EndIf
      $i = $i + 1
   WEnd
EndFunc   ;==>buscarimg

Func clickexit()
   $click_x = 0
   $click_y = 0
   $search_exit = _ImageSearch('exit.bmp', 1, $click_x, $click_y, 0)
   If $search_exit = 1 Then
      MouseClick($MOUSE_CLICK_LEFT, $click_x, $click_y, 1)
   EndIf

EndFunc   ;==>clickexit

Donde creen que pueda estar el error ? 

Share this post


Link to post
Share on other sites



#2 ·  Posted

Hi Daniel,

Most of the people on this forum communicate in English, and it will make it a lot easier for us to help you if you post in the future using Google Translate or some other translator.

What problem are you having? It seems that it should exit if $i <= $selector


UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Ahh ok sorry,  The problem is that when $i <= $selector don't exit program :S  (my english is very bad sorry XD)

Edited by Melba23
Quote removed

Share this post


Link to post
Share on other sites

#4 ·  Posted

$seleccion = GUICtrlCreateCombo("Select", 104, 200, 57, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "2|4|6")

Func buscarimg()
   $buscar_x = 0
   $buscar_y = 0
   Local $i = 0
   $selector = GUICtrlRead($seleccion)
   $search_img = _ImageSearch('axep.bmp', 1, $buscar_x, $buscar_y, 0)
   While $i <= $selector
      If $search_img = 1 Then
         MouseClick($MOUSE_CLICK_LEFT, $buscar_x, $buscar_y, 2)

      EndIf
      clickexit()
      $i = $i + 1
      If $i <= $selector Then
         MsgBox(0, "Error", "la imagen no se encontro")
         Exit
      EndIf
   WEnd
EndFunc   ;==>buscarimg

Func clickexit()
   $click_x = 0
   $click_y = 0
   $search_exit = _ImageSearch('exit.bmp', 1, $click_x, $click_y, 0)
   If $search_exit = 1 Then
      MouseClick($MOUSE_CLICK_LEFT, $click_x, $click_y, 1)
   EndIf

EndFunc   ;==>clickexit

Try this. I think it just had to do with where you were incrementing $i.


UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

ok thanks you :3 I try it and I'll let you know

Edited by Melba23
Quote removed

Share this post


Link to post
Share on other sites

#6 ·  Posted

danielgomez,

When you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - responders know what they wrote and it just pads the thread unnecessarily.

M23

 


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

ok i'm sorry. A question, I have a forum in Spanish autoit, can I publish it?

Edited by Melba23
Quote removed

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

danielgomez,

2 hours ago, danielgomez said:

ok i'm sorry

So why use the "Quote" button again in the very same post?

M23

Edit: You could add the URL of your Spanish site to your sig.

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#9 ·  Posted

9 hours ago, anthonyjr2 said:
$seleccion = GUICtrlCreateCombo("Select", 104, 200, 57, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "2|4|6")

Func buscarimg()
   $buscar_x = 0
   $buscar_y = 0
   Local $i = 0
   $selector = GUICtrlRead($seleccion)
   $search_img = _ImageSearch('axep.bmp', 1, $buscar_x, $buscar_y, 0)
   While $i <= $selector
      If $search_img = 1 Then
         MouseClick($MOUSE_CLICK_LEFT, $buscar_x, $buscar_y, 2)

      EndIf
      clickexit()
      $i = $i + 1
      If $i <= $selector Then
         MsgBox(0, "Error", "la imagen no se encontro")
         Exit
      EndIf
   WEnd
EndFunc   ;==>buscarimg

Func clickexit()
   $click_x = 0
   $click_y = 0
   $search_exit = _ImageSearch('exit.bmp', 1, $click_x, $click_y, 0)
   If $search_exit = 1 Then
      MouseClick($MOUSE_CLICK_LEFT, $click_x, $click_y, 1)
   EndIf

EndFunc   ;==>clickexit

Try this. I think it just had to do with where you were incrementing $i.

Friend the code still does not work try another alternative and none. What I'm looking for is that if the variables are met and the cicle is performed according to the programmed hours the program is closed.

Share this post


Link to post
Share on other sites

#10 ·  Posted

Is your Error box coming up at all? Or is it never even going into the if statement? I can't really test it on my end because I don't really know what it's used for.


UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=

Share this post


Link to post
Share on other sites

#11 ·  Posted

1 hour ago, anthonyjr2 said:

Is your Error box coming up at all? Or is it never even going into the if statement? I can't really test it on my end because I don't really know what it's used for.

The problem is that it complies with the if statement but it never stops don't throws the error in case the cicle is met the requested number of times

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