
Threap
Members-
Posts
10 -
Joined
-
Last visited
Everything posted by Threap
-
Maybe my reply was ambiguous.. the problem still has me tearing out what's left of my hair, and help would be much appreciated if anyone can shed light on this.. On XP 32-bit the _GUICtrlListView_GetItemText($hListView, $i) call returns the icon label; on Win7 x64, it returns blank. So does _GUICtrlListView_GetItemTextArray(). Checking the desktop icons with _GUICtrlListView_MapIndexToID() shows that the ID of every icon is "-1". I am... puzzled.
-
I stand corrected - I only have W7 x64 and XP x86, I took a guess as to which was more likely to be the cause - and got it wrong. Great start to the year Thanks for the really quick response!
-
Hi, This is great code, and is exactly what I'm looking for - using it, I've written a couple of routines for getting & setting the desktop icon locations. Everything works fine on XP 32-bit, but unfortunately it fails to get the icon names on Windows 7 x64 (the culprit is the _GUICtrlListView_GetItemText() call, which returns a null string on that platform). I suspect it's Windows 7 that is the problem rather than the 64-bit architecture. It can still "see" all the icons and their positions - just not their names. Can you suggest how to get the icon name on W7 x64? Thanks (and happy New Year to all)!
-
UDP multicast send and receive from the same program?
Threap replied to Threap's topic in AutoIt General Help and Support
Oh, come on.. does no-one have any suggestions? Please? I would really appreciate some guidance - I know helping people out on these forums is a tedious, thankless task but it would make a big difference to me to have some advice here. Thanks! -
Hello esteemed AutoIt experts, I am using the UDP functions in AutoIt to try and multicast data, but I've quickly run into a problem Here's my aim.. to have a number of PCs on the same LAN subnet, each running an AutoIt program ("A"). At ANY time, ANY of those PCs might launch another program ("B") which will send a network signal to run a Windows application (e.g Notepad.exe). As long as each of our PCs are running that application, I want them to be signalling on the network; program "B" will only exit when it detects that it hasn't received such a signal for a period of, say, 3 seconds. I started using UDP as the most promising technology for this. A complication is that I don't know the IP address of the recipient(s) - as long as they're on the same subnet, I want other PCs running program "A" to get the data. There are other possible issues that I can see here: -A and B are both "client" and "server" at different times, receiving and sending data. Does it matter that B starts up after A? -if there are two tasks running on the same PC, both listening on the same port, do datagrams sent to that port get "swallowed" by the first app to parse them? What I've done is essentially the same as the example UDP code in the AutoIt helpfile. Here's part of "A": $socket = UDPBind($my_IP, $IP_Listen_Port) If @error <> 0 Then Exit Traytip("Info","Listening on " & $my_IP,10,16) ; just to let me know the program's started listening on the right IP interface While 1 $sReceived = UDPRecv($socket, 128) If $sReceived <> "" Then fReceived($sReceived) ; this is a function that analyses the received info and acts on it according to its contents! ; if it means launching a task then $Running_Task is set to the taskname, e.g notepad.exe EndIf sleep(200) If $Running_Task <> "" Then ; if we've previously received an instruction to launch a specific task, I want to keep sending "heartbeat" packets as long as that task's running UDPSend($socket, $my_IP & $cDelimiter & "RUNNING" & $cDelimiter & $Running_Task) Sleep(500) If Not(ProcessExists($Running_Task)) Then $Running_Task = "" ; if the task's finished, then stop sending the keepalives. EndIf WEnd Program B (probably invoked AFTER the first one) contains this code: While ($boolRunning) $sReceived = UDPRecv($socket, 128) If $sReceived <> "" Then ; something came in over UDP fReceived($sReceived) ; parse it - if it's a "RUNNING" message then peg $Timer back to a high value, so that this While/Wend loop keeps running. Msgbox(0,"debug","received",3) ; just for debug - and never pops up, hence my question here :( EndIf Sleep(300) $Timer -= 1 If $Timer < 0 Then $bRunning = False ; we haven't received a "still running" message in 3 seconds, so it's safe to quit. Wend The problem seems to be in the code snippet above - although the first program is (as far as I know) sending its data, the second program above never receives anything. What am I doing wrong? These forums have never let me down in the past - here's hoping your collective mighty wisdom can set me straight once again! Please let me know if I need to supply more details. Many, many thanks in advance.
-
Hi, esteemed AutoIt experts, I have trawled extensively through the forums & not seen an answer to this problem - if this is a well-known issue then please, call me stupid & point me in the right direction! I have a program that uses _GUICreate_Alpha (thanks, Kip & others!) to create an alpha-blended GUI based on a part-transparent PNG. On top of that, I am trying to render & rotate another PNG - although for what I am trying to achieve, a "speedometer" effect, I'd settle for just being able to draw a simple line, provided I can reposition the line at run-time. Here's the relevant bit of what I am currently using: _GDIPlus_Startup() $GUI = _GUICreate_Alpha("TBT", @ScriptDir & "\sample.png") $hWnd = WinGetHandle("TBT") $hDC = _WinAPI_GetWindowDC($hWnd) GUISetState(@SW_SHOW) ;... $graphics = _GDIPlus_GraphicsCreateFromHWND($hWnd) $bitmap = _GDIPlus_BitmapCreateFromGraphics(300, 300, $graphics) ;...then code for matrix rotating & rendering another PNG...Now, this doesn't work - my alpha-blended GUI gets rendered perfectly, but any _GDIPlus_ graphics operations I then perform don't appear. If, however, I delete the _GUICreate_Alpha line and replace it with this: $Form1 = GUICreate("TBT", 0, 0, 300, 300, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE))..and then use $Form1 as the parameter for my GDIPlus_GraphicsCreateFromHWnd() statement, then all my lines, other PNGs etc, get rendered properly but, of course, my GUI looks like an ordinary window, not a beautifully-rendered alpha-blended PNG. The _GUICreate_Alpha() function invokes GUICreate() - even if I pull the $hWnd value that is returned there, and use that as my GraphicsCreateFromHWND() parameter, it still doesn't work, which suggests to me that the problem is not an incorrect window handle, but instead something more fundamental. What am I doing wrong? It must be very simple... right? Please let me know if I need to supply any more details. Many thanks in advance for anything you can suggest!
-
Task Manager automation help sought
Threap replied to Threap's topic in AutoIt General Help and Support
Hi, Thanks for the tip - I've tried changing my code to incorporate your suggestion and it seems to work much more reliably now under Vista/W7. And no, recreating the CPU graphs wouldn't be terribly complicated - but why re-invent the wheel? -
Hello Forum Users, Long time lurker here, making my first post (weeelll... second post, strictly speaking - I posted this same question in the COM forum thinking COM would offer the solution, but no joy, hence the repost. Apologies if this therefore seems familiar. Refunds will not be given). I searched the forums before posting, so forgive me if this question has already been answered! In one of my scripts, I need to display the Windows Task Manager, set it to the "Performance" tab, and put the window into "borderless" mode (removing the window frame/decorations). The latter is what's giving me most trouble. In theory it can be done by simply double-clicking on the CPU load graph or in other places in the window; in practice, this is very unreliable when done from a script! Here's a simplified version of my code. I've highlighted the bit that gives the problems: ;Display task manager. Wait for a window with its CLASSID to appear, then activate it. ShellExecute("Taskmgr.exe") WinWait("[CLASS:#32770]") WinActivate("[CLASS:#32770]") ;Now switch to Performance tab... send TabRight messages to the SysTab control until the appropriate text is visible While (Not(WinGetText("[CLASS:#32770]","CPU Usage History"))) ControlCommand ("[CLASS:#32770]", "", "[CLASS:SysTabControl32; INSTANCE:1]", "TabRight") WEnd ; yes, I know this loop might never end if something goes wrong. Not my main problem ; now, set Task Manager to "no window border" mode While (WinGetText("[CLASS:#32770]","Handles")) ; this is text that is ONLY visible in "frame" mode - disappears in borderless mode! $winpos = WinGetPos("[CLASS:#32770]") MouseClick ("left",$winpos[0]+20,$winpos[1]+90,2,0) ; the (20,90) co-ords relative to window have been chosen to work under XP & Vista - and do, if I move & clicking the mouse manually! Sleep(100) Wend ; the mouse double-click doesn't always work - so we loop, doing it until success The above code works (pretty reliably) on XP, but fails frequently on Vista and Windows 7 (yes, I know W7 is pre-release at this point but the Task Manager code seems identical to Vista). The failure mode is that it just sits there in the final While() loop, sending mouseclicks that never work. What am I doing wrong? Can anyone offer suggestions for a more reliable/efficient way of accomplishing this task? Thanks for any help you can offer!
-
Windows Task Manager into "Frameless" mode?
Threap replied to Threap's topic in AutoItX Help and Support
Thanks for the reply. I need the Frameless mode so that I can have the simple CPU usage/load graphs visible on the screen. Task Manager is the only solution that can be used for my purposes. I'll move this query to another forum, as COM seems to be a dead end. -
Hello Forum Users, Long time lurker here, making my first post. I searched the forums before posting, so forgive me if this question has already been answered! In one of my scripts, I need to display the Windows Task Manager, set it to the "Performance" tab, and put the window into "borderless" mode (removing the window frame/decorations). The latter is what's giving me most trouble. In theory it can be done by simply double-clicking on the CPU load graph or in other places in the window; in practice, this is very unreliable when done from a script! Here's a simplified version of my code. I've highlighted the bit that gives the problems: ;Display task manager. Wait for a window with its CLASSID to appear, then activate it. ShellExecute("Taskmgr.exe") WinWait("[CLASS:#32770]") WinActivate("[CLASS:#32770]") ;Now switch to Performance tab... send TabRight messages to the SysTab control until the appropriate text is visible While (Not(WinGetText("[CLASS:#32770]","CPU Usage History"))) ControlCommand ("[CLASS:#32770]", "", "[CLASS:SysTabControl32; INSTANCE:1]", "TabRight") WEnd ; yes, I know this loop might never end if something goes wrong. Not my main problem ; now, set Task Manager to "no window border" mode While (WinGetText("[CLASS:#32770]","Handles")) ; this is text that is ONLY visible in "frame" mode - disappears in borderless mode! $winpos = WinGetPos("[CLASS:#32770]") MouseClick ("left",$winpos[0]+20,$winpos[1]+90,2,0) ; the (20,90) co-ords relative to window have been chosen to work under XP & Vista Sleep(100) Wend ; the mouse double-click doesn't always work - so we loop, doing it until success The above code works (pretty reliably) on XP, but fails frequently on Vista and Windows 7 (yes, I know W7 is pre-release at this point but the Task Manager code seems identical to Vista). The failure mode is that it just sits there in the final While() loop, sending mouseclicks that never work. Frankly, clicking on windows and sending control commands doesn't seem like the neatest way of doing this. I've had great success with using COM elsewhere in the script, and I wonder if that's the solution here? Can anyone suggest a way to access TaskMgr.exe via COM and pass commands to it that way? I've googled extensively trying to find COM API documentation for TaskMgr but no luck! Failing that, any suggestions for an alternative way to reliably accomplish this? (I can move this thread to another forum area if COM isn't the solution). Thanks for any help you can offer!