Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 07:13

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[HELP!!!] Autoit ListView conundrum

Discussion on [HELP!!!] Autoit ListView conundrum within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jan 2009
Posts: 1
Received Thanks: 0
[HELP!!!] Autoit ListView conundrum

So i've been beating my head against the wall for some hours now and can't figure this out.

Im unsure on how to link a single(1) ListViewItem to a single(1) function. Although i have several functions and list items that I would like to link together. I'm attempting to use a button to do the selection but i'm not much of a programmer.

I would like to link the Anhur() function to the ListItem labeled Anhur. Currently right now, when i run the program, the anhur function is running 100% of the time, but I want it to only work when its ListItem has been selected with the button. I think it could possibly be done with a GUISetOnEvent but am unsure on how to do this.

btw, ive been using alot of different peoples codes trying to complete this as im not a programmer, so if you see anything that could be deleted without hindering functionality feel free to share.

Thanks in Advance to anyone who helps me!!!

Code:
#include <GuiListBox.au3>
#include <GuiListView.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>

Global $listview
Opt("GUIOnEventMode", 1)
 
 
_Main()

Func _Main()
	 
  $listGUI = GUICreate("easyScript", 220, 200, 100, 100, -1)
  GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close_Main")
  $listview = GUICtrlCreateListView("Gods", 10, 10, 200, 150)
  _GUICtrlListView_SetColumnWidth($listview, 0, 196)


  GUICtrlCreateListViewItem("Anhur", $listview)
  GUICtrlCreateListViewItem("Freya", $listview)
	
  $selectGod = GUICtrlCreateButton("Select God", 33, 165, 160, 30)
  GUICtrlSetOnEvent(-1, "SelectItem")
  
  GUISetState()
		
EndFunc   ;==>_Main
 
 
Func SelectItem()
  $sItem = GUICtrlRead(GUICtrlRead($listview))
  MsgBox(0, "Selected Item", $sItem)
EndFunc


 
;---------------------------------------
; Anhur
;---------------------------------------
While 1
   HotKeySet("{F1}", "Anhur")
WEnd

   Func Anhur();
	  send("{1}")
		 mouseclick("")
		 Sleep(400)
	  send("{2}")
		 mouseclick("")
		 Sleep(550)
	  send("{4}")
		 mouseclick("")
   EndFunc


Func On_Close_Main()
   Exit
EndFunc
tantrim is offline  
Old 03/10/2013, 10:44   #2
 
lolkop's Avatar
 
elite*gold: 280
Join Date: May 2007
Posts: 2,818
Received Thanks: 3,483
i would highly suggest to use a simple list, since you've got only one cell in your listview...

beside that, if i understood you right, you wanted to to only use the select *** function once, when the button gets clicked... since you'll have to wait for the gui to get inactive, to not send and click on the gui only, you'll have to place the logic outside the normal gui events, and use a special state variable to run the actions...

in the end it could look like this:
Code:
Dim $state = 0, $x=0, $t, $anhur[3][2] = [[1,0],[2,450],[4,550]]
$gui = GUICreate("easyScript", 220, 200, Default, Default, 0x10C80000, 8)
$list = GUICtrlCreateList("Anhur", 10, 10, 200, 150)
GUICtrlSetData(-1, "Freya")
$selectGod = GUICtrlCreateButton("Select ***", 33, 165, 160, 30)

While True
	Switch GUIGetMsg()
		Case -3
			Exit
		Case $selectGod
			Switch GUICtrlRead($list)
				Case "Anhur"
					$state = 1
				Case "Freya"
					$state = 2
			EndSwitch
		Case Else
			Switch $state
				Case 0
				Case 1
					If Not WinActive($gui) And TimerDiff($t)>=$anhur[$x][1] Then
						Send(&$anhur[$x][0])
						MouseClick("left")
						$t = TimerInit()
						$x += 1
						If $x >= UBound($anhur) Then
							$x = 0
							$state = 0
						EndIf
					EndIf
				Case 2
			EndSwitch
	EndSwitch
WEnd
lolkop is offline  
Reply


Similar Threads Similar Threads
[vTutorial] How to solve Conundrum Cubed (Jump Puzzle)
10/04/2012 - GW2 Guides & Strategies - 1 Replies
Heyho guys, in this vid you'll see the solution to the one and only jump puzzle in the Mount Maelstrom region, called Conundrum Cubed. It's not too difficult and has a short duration. http://www.youtube.com/watch?v=n_n_jGLHUL4 Best regards, manniL
Quantum Conundrum Fehlercode 51
07/29/2012 - Off Topic - 9 Replies
Hey leute, ich hoffe ihr könnt mir helfen... Also ich habe mir das spiel Quantum Conundrum geholt und installiert ... Aber wenn ich es starten will steht da das das spiel nicht gestartet werden kann , und irgendwas von fehlercode 51... Wisst ihr was ich da machen kann?? Wenn ja wäre es nett wenn ihr mir helfen könnt. Mfg , .Spike
Quantum Conundrum is coming soon, pre-order for extra stuff!
06/20/2012 - Gaming News - EN - 0 Replies
Quantum Conundrum is a new title from Airtight Games due for release tomorrow, Thursday the 21st of June. Published by Square Enix, Quantum Conundrum is a puzzle-based game comparable to Portal, as from the trailers it's assumed that we're given the task of changing the laws of physics in order to solve puzzles and progress. Pre-purchases are still available on Steam, where you can even get 10% off both the standard game and the "Season Pass", which gives you the full game, the soundtrack...
[AutoIt] ListView nach mehreren Kriterien sortieren
02/26/2011 - AutoIt - 7 Replies
Hi zusammen, für mein aktuelles Projekt ist es nötig, dass ich ein ListView nach mehreren Kriterien sortiere, also mit verschiedenen Prioritäten. Das ganze sieht in etwa wie eine Bundesligatabelle aus. Prioritäten: Punkte > Tordifferenz > geschossene Tore Ich hab das jetzt mal mit den folgenden Codeschnippseln probiert: Global $B_DESCENDING _GUICtrlListView_SimpleSort($db_zs4 ,$B_DESCENDING , 10)Wie ihr jetzt wahrscheinlich merkt bedeuten die Variablen folgendes: $db_zs4 //-...



All times are GMT +1. The time now is 07:14.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.