Jump to content

Duda al combinar checkbox y combobox + ciclo while


Recommended Posts

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 ? 

Link to comment
Share on other sites

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=

Link to comment
Share on other sites

$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=

Link to comment
Share on other sites

  • Moderators

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

 

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

  • Moderators

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

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

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.

Link to comment
Share on other sites

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

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