JonnyThunder
Active Members-
Posts
106 -
Joined
-
Last visited
JonnyThunder's Achievements
Adventurer (3/7)
0
Reputation
-
Getting selected row in ListView
JonnyThunder replied to JonnyThunder's topic in AutoIt General Help and Support
Thanks guys - got it. :-) -
Hello, I've been struggling with this one all morning. I've got a ListView on my form and a delete button. I want to be able to click a row, then click the delete button. How can I get the index of the row which is currently selected when I click my button? Cheers, JT
-
Possible ListView Item Copy bug
JonnyThunder replied to JonnyThunder's topic in AutoIt General Help and Support
Okay cool. Thanks again for your help guys. -
Possible ListView Item Copy bug
JonnyThunder replied to JonnyThunder's topic in AutoIt General Help and Support
Thanks very much for your time and effort guys. The post that KaFu made does seem to work - but I don't fully understand why the original example I posted only worked in one direction but not both? Just for completeness, can you fill in the missing details for me? Thanks again though. I'm up and running with drag'n'drop goodness! :-) Oh, thanks for the pointer about sleeping my loop. Am I mistaken, but I also seem to remember something in a previous version history which said that tight loops like this were more CPU friendly now than in older versions of AutoIT? p.s. Should I now close the bug ticket? Or is there still an issue here? -
You should read here
-
Possible ListView Item Copy bug
JonnyThunder replied to JonnyThunder's topic in AutoIt General Help and Support
I've now posted a bug report about this issue. Fairly sure it's not down to bad programming! You can view the bug ticket here. -
Hello, I've been doing some fairly hefty exploration with listviews and no matter what I try, I can't get this copy to work. Attached is a chunk of code. When you run it, you'll notice that you can drag items from the left to the right. However, when you drag items from right to left - it copies them but doesn't remove them. Is this an AutoIT bug? I'm using version 3.3.2.0. If this isn't a bug, I'd sure appreciate it if someone could tell me what I'm doing wrong here. Cheers, JT UPDATE: I've just tried it with v3.3.6.0 and it's the same! ; Includes first! Must must must! #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #Include <GuiListView.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <Misc.au3> ; Switch on the 'onEvent' notifications Opt ("GUIOnEventMode", 1) ; Generate the GUI! Ahoy there. Global $MainForm, $list_source, $list_target $MainForm = GUICreate(" TEST! ", 517, 178) ; Source list box $list_source = GUICtrlCreateListView("Title|Details", 13, 16, 240, 136, BitOR($LVS_REPORT,$LVS_SHOWSELALWAYS,$LVS_SORTASCENDING)) ; Target list box $list_target = GUICtrlCreateListView("Title|Details", 261, 16, 240, 136, BitOR($LVS_REPORT,$LVS_SHOWSELALWAYS,$LVS_SORTASCENDING)) ; Populate box with some test stuff For $x = 1 to 6 GUICtrlCreateListViewItem( _makeJunkName() & "|" & _makeJunkName(), $list_source) Next ; Handle GUI events GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "_dragHandler") GUISetOnEvent($GUI_EVENT_CLOSE, "_formEvents") GUISetOnEvent($GUI_EVENT_MINIMIZE, "_formEvents") GUISetOnEvent($GUI_EVENT_RESTORE, "_formEvents") ; Show the form GUISetState(@SW_SHOW) ; Main program loop While 1 ; Don't really do much in here at all... WEnd ; Create a junk name for testing Func _makeJunkName() Local $labelout = '' For $i = 1 to 10 $labelout &= chr(Random(65,90,1)) Next Return $labelout EndFunc ; Function to handle drag and drop Func _dragHandler() ; Define some stuff Local $source, $desc Local $cinfo = GUIGetCursorInfo (WinGetHandle($MainForm)) Local $direction = 0 ; Check we are dragging from one or the other boxes If $cinfo[4] = $list_source OR $cinfo[4] = $list_target Then ; Are we moving from source to destination If $cinfo[4] = $list_source Then $direction = 1 EndIf ; Or are we moving from destination to source If $cinfo[4] = $list_target Then $direction = 2 EndIf ; Doublecheck we're pressing mouse button If _IsPressed(1) Then if $direction = 1 Then $selecteditems = _GUICtrlListView_GetSelectedCount($list_source); Else $selecteditems = _GUICtrlListView_GetSelectedCount($list_target); EndIf ; Check we actually have selected an item If $selecteditems >= 1 Then ; Wait for keypress! While _IsPressed(1) WEnd ; Get new position Local $newcinfo = GUIGetCursorInfo (WinGetHandle($MainForm)) ; If we were moving from source to destination and we ARE in the destination box If $direction = 1 And $newcinfo[4] = $list_target Then ConsoleWrite("Moved " & $selecteditems & " items from source to destination" & @CRLF) _GUICtrlListView_CopyItems ($list_source, $list_target, 1) EndIf ; If we are moving from destination to source and we ARE in source box If $direction = 2 And $newcinfo[4] = $list_source Then ConsoleWrite("Moved " & $selecteditems & " items from destination to source" & @CRLF) _GUICtrlListView_CopyItems ($list_target, $list_source, 1) EndIf EndIf EndIf EndIf EndFunc ; Function to handle other form events Func _formEvents() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE Exit EndSelect EndFunc
-
That's quite odd - we have 6000 or so users and it works fine for me. Water : nice one, I'll keep an eye on this page for updates!
-
It's still hugely impressive - many thanks to you and Jonathan Clelland for all the work. I've just been raking through the list of examples and they all work beautifully. I've got a big project away to start which will require a lot of AD integration and querying so this just saved me a huge chunk of time. Nice one fella.
-
You've done a brilliant job on this sir, thanks for the effort!
-
Run a script as a service
JonnyThunder replied to JonnyThunder's topic in AutoIt General Help and Support
Yes, when I try to start the service I get the error above. I get it whether I use the UDF posted earlier or from the command line using SC.EXE. Or even if I try to start the service from the Services list. -
Run a script as a service
JonnyThunder replied to JonnyThunder's topic in AutoIt General Help and Support
Sadly it isn't that easy. The command I posted originally DOES install the service but it doesn't actually start. -
Run a script as a service
JonnyThunder replied to JonnyThunder's topic in AutoIt General Help and Support
Thanks, I'd already read that earlier on - but I was trying to make use of SC.EXE which is 'meant' to be able to do this. I already tested the script with RunAsSvc and it works fine with that too. Just seems to be SC.EXE which is a problem, though I can't think why. -
Hello, I've read various topics on here about running the script as a service but can't get it to work. Here is the test script I'm running.... #NoTrayIcon While 1=1 Beep(4000, 200) Sleep(400) WEnd Then I create a service with this.... sc.exe create "MyService" binpath= "C:\MyScript.exe" type= own type= interact start= auto DisplayName= "MyService" The service is created fine. However, when I try to start the service with this.... sc.exe start "MyService" ... I get the following message... Can anyone show me how to actually do this? Cheers, JT
-
Ah cool, thanks for that.