PaulIA Posted May 25, 2007 Author Posted May 25, 2007 snipet ... #Obfuscator_off AdlibEnable("auto", 700) #Obfuscator_on Run("SVSAdmin.exe", $Path) WinActivate("Altiris Software Virtualization Solution Admin", "") Sleep(150) $handle_ = ControlGetHandle("[CLASS:ManageFrame]", "", "[CLASS:ATL:01003A62; 458360]") Sleep(10) IniWrite(@ScriptDir & "\Admin.dat", "GetHandle", "Handle" ,$handle_) Sleep(10) $handle = IniRead(@ScriptDir & "\Admin.dat", "GetHandle", "Handle","NotFound") Sleep(10) $Flags = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\Altiris\SVS", "Flags") _ListView_InsertColumn ($handle, 3, " Comment", 350) _ListView_SetSelectedColumn ($handle, 3) _ListView_AddSubItem ($handle, 0, "| Version:", 3) _ListView_AddSubItem ($handle, 1, "", 3) _ListView_AddSubItem ($handle, 2, "*", 3) ;....... Func auto() If $Flags = "1" Then If _ListView_GetItemText ($handle, 0, 3) = "" Then _ListView_SetItemText ($handle, 0, "| Version:", 3) If _ListView_GetItemText ($handle, 3, 3) = "" Then _ListView_SetItemText ($handle, 3, "| Author:", 3) If _ListView_GetItemText ($handle, 6, 3) = "" Then _ListView_SetItemText ($handle, 6, "| Company:", 3) If _ListView_GetItemText ($handle, 9, 3) = "" Then _ListView_SetItemText ($handle, 9, "| Notes:", 3) EndIf EndFuncWell, you have the auto() function in an AdLib statement executing every 700 ms. The auto() function is reading the ListView of an external program, based on a window handle that you set. Now what do you think happens when you close the external program? That window handle doesn't point to a ListView control any more, does it? So the error message you are receiving is indeed correct. You have passed an invalid window handle to one of the ListView functions. You could check to make sure the ListView handle still points to a valid window and then make your ListView calls, but eventually you'll run onto the situation where the window closes between checking the window handle and making the call to the window. The solution for this is to hook into the external program's message queue using a DLL or wait for Jon to change AutoIt to allow us to do the same (which, unfortunately probably won't happen). Auto3Lib: A library of over 1200 functions for AutoIt
Thunder-man Posted May 25, 2007 Posted May 25, 2007 (edited) Well, you have the auto() function in an AdLib statement executing every 700 ms. The auto() function is reading the ListView of an external program, based on a window handle that you set.).... Yes, but now when I start the script, it write the Handle in the *.ini Why lost the Handle, it´s in the ini ? When I close the external Program, the Handle lost. But i write the Handle in the ini File and read it. I don´t know this. THX for Help Edit: I have change auto() $state = WinGetState("Altiris Software Virtualization Solution Admin", "") If BitAND($state, 1) Then ..... Else Exit EndIf For my code the massage is not bad. Can i to dismiss the MsgBox? Opt("RunErrorsFatal", 0) for au3lib eg. Opt("RunErrorsFatal_au3lib", 0) Edited May 25, 2007 by Thunder-man
PaulIA Posted May 25, 2007 Author Posted May 25, 2007 Yes, but now when I start the script, it write the Handle in the *.ini Why lost the Handle, it´s in the ini ? When I close the external Program, the Handle lost. But i write the Handle in the ini File and read it. I don´t know this.Window handles are dynamic. They are assigned to programs by the OS when the program runs and will be different every time you run a program. You can not store a window handle in a file and reuse it the next time you run the program. I have change auto() $state = WinGetState("Altiris Software Virtualization Solution Admin", "") If BitAND($state, 1) Then ...This will lessen the occurrence of the error, but you still run the chance of it happening if the external program is closed between the WinGetState call and calling the ListView functions. Auto3Lib: A library of over 1200 functions for AutoIt
Thunder-man Posted May 25, 2007 Posted May 25, 2007 Window handles are dynamic. They are assigned to programs by the OS when the program runs and will be different every time you run a program. You can not store a window handle in a file and reuse it the next time you run the program.Ok,Can I disable the close Button of the external Program?Then we must close it from the Tray ...
PaulIA Posted May 25, 2007 Author Posted May 25, 2007 Ok, Can I disable the close Button of the external Program? Then we must close it from the Tray ...I don't think you're understanding the problem. Let's try something else. A --> Program running B ----> I check to see if program is running C ----> I make a call to the program D ----> I check to see if program is running E --> Program closes F ----> I make a call to the program At point F, you have made a call to the program and it is no longer running. That's the problem. It doesn't matter how the program closes (button, task manager, etc.), it still closes. You are trying to send a message to a control in a program that no longer exists. You can minimize the chance that this happens, but unless you can hook the other program's messages, you can't eliminate it. Auto3Lib: A library of over 1200 functions for AutoIt
Thunder-man Posted May 25, 2007 Posted May 25, 2007 (edited) I don't think you're understanding the problem. Let's try something else. Very Thanks for your Help (I can´t write so bad in english) I would disable the close Button of the external Program. The User must close the Program from the tray icon. Then I can close my script and the external Program at the same Time. (I have Test this, with no Error) $exititem = TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "close") ;============================================= Func Close() WinClose("Altiris Software Virtualization Solution Admin", "") Exit EndFunc;==>Close ;============================================= Edit: I found by myself in Auto3Lib lol $hWnd = WinGetHandle("Altiris Software Virtualization Solution Admin") ;_Lib_WinWaitActive("Altiris Software Virtualization Solution Admin") $hMenu = _Menu_GetSystemMenu($hWnd) ;$Text =_Menu_GetItemText($hMenu, 6) _Menu_EnableMenuItem($hMenu,6, 1) _Menu_DrawMenuBar($hWnd) Edited May 25, 2007 by Thunder-man
PaulIA Posted May 28, 2007 Author Posted May 28, 2007 Release 4.0.5This release has some major changes to the GDI+ module. The prefix for all GDI+ functions has been changed from _GDI to _GDIP to prevent naming collisions when I eventually get around to splitting the GDI functions into a separate module. I have also grouped the GDI+ functions by class name as they are defined on MSDN. It didn't take too long for me to realize that, as I implement the GDI+ classes, this is the only sane way to keep things in order. I have started to add in the GDI+ graphics functions in this release. You can now draw the primitive images (arcs, circles, ellipses, images, lines, pies, rectangles, etc.) as well as create brushes, colors, fonts, font families, pens, etc. I have updated the help file to include examples on how to use these new functions as well as created a new example in the GDI+ folder that shows you how to emboss text on a screen captured image.This release also includes the help file examples for the Time functions. Auto3Lib: A library of over 1200 functions for AutoIt
ddeerr Posted May 29, 2007 Posted May 29, 2007 Great work PaulIA since last time there now a documentation with your very helpful library TX
PaulIA Posted May 29, 2007 Author Posted May 29, 2007 Great work PaulIA since last time there now a documentation with your very helpful library TXYou're welcome. Auto3Lib: A library of over 1200 functions for AutoIt
PaulIA Posted May 29, 2007 Author Posted May 29, 2007 Release 4.0.6Grrrr... stupid installer. Just realized that I'd forgot to tell the Wise installer to check for new files in my build directory. All of the new GDI+ demo scripts (and Misc scripts) should now be in the installer. Auto3Lib: A library of over 1200 functions for AutoIt
PaulIA Posted June 1, 2007 Author Posted June 1, 2007 Release 4.0.7Put code in the Auto3Lib installer that will tell users when they have an out of date version of AutoIt. Auto3Lib: A library of over 1200 functions for AutoIt
randallc Posted June 1, 2007 Posted June 1, 2007 Hi, Thanks for the update, attempting to make it easy to install properly! I still have problems with your examples, though! 1. Listview1 example; errors still; this surely cannot still be due to me being stupid with installation?; +> Starting AutoIt3Wrapper v.1.7.1 >Running AU3Check (1.54.7.0) params: from:C:\Program Files\AutoIt3 C:\Program Files\AutoIt3\Auto3Lib\ListView 1.au3(259,64) : ERROR: syntax error if $iWidth > $cMaxX then DllStructGetData($tRect, "Right" ) = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Program Files\AutoIt3\Auto3Lib\ListView 1.au3(259,78) : ERROR: multi-line 'If' missing 'Then'. if $iWidth > $cMaxX then DllStructGetData($tRect, "Right" ) = $iX + $cMaxX ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Program Files\AutoIt3\Auto3Lib\ListView 1.au3(260,64) : ERROR: syntax error if $iHeight > $cMaxY then DllStructGetData($tRect, "Bottom") = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Program Files\AutoIt3\Auto3Lib\ListView 1.au3(260,78) : ERROR: multi-line 'If' missing 'Then'. if $iHeight > $cMaxY then DllStructGetData($tRect, "Bottom") = $iY + $cMaxY ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Program Files\AutoIt3\Auto3Lib\ListView 1.au3 - 4 error(s), 0 warning(s) !>AU3Check ended.rc:2 >Exit code: 0 Time: 3.5692. Listview2 example; crashes and wants to send message to microsoft about the crash Message box "_Mem_CtrlInit: Invalid window handle passed [0x00700690]" Why have i never been able to get your funcs to to run? Is it something about my computers? Best, randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW
PaulIA Posted June 2, 2007 Author Posted June 2, 2007 Hi, Thanks for the update, attempting to make it easy to install properly! I still have problems with your examples, though! 1. Listview1 example; errors still; this surely cannot still be due to me being stupid with installation?; 2. Listview2 example; crashes and wants to send message to microsoft about the crash Message box "_Mem_CtrlInit: Invalid window handle passed [0x00700690]" Why have i never been able to get your funcs to to run? Is it something about my computers? Best, randallThis just doesn't make sense to me. For example, you're saying that it reports line 259 as being a "multi-line If missing then" error. If you look at the code, you can clearly see that it's a single line "If" statement and that sure looks like there is a "then" on that line to me. I've run both demos and they appear to work fine for me. I haven't had anybody else report any problems with them either. I'm assuming that you've done the obvious virus scans, reinstalled the latest production version of AutoIt, etc.? What are you using for an OS, language, etc.? Does it do this on other machines? Are you using the Unicode or ANSI version of AutoIt. I think you have to start eliminating the possibilities, but at this point, I am not getting any other reports of this type about problems with the code. Auto3Lib: A library of over 1200 functions for AutoIt
randallc Posted June 2, 2007 Posted June 2, 2007 Hi, 1. Occurs all machines If I look at line 259 for you, if $iWidth > $cMaxX then DllStructGetData($tRect, "Right" ) = $iX + $cMaxXoÝ÷ Ø'£ 趧¦èºÛazÇWî˺Ûaz¥¥ø¥zË ë-²Øb²+~éÜ·º¹ì²¶§©Ýq©ç¢ÖÞuçâçmìË*.«ÞêÞzaz¥¥ø¥y«¢+Ù¥ÀÌØíÑ¡¸ÀÌØíµ©½È$$ô±±MÑÉÕÑÑÑ ÀÌØíÀ°ÅÕ½ÐíÝ5©½ÉYÉÍ¥½¸ÅÕ½Ðì¤what do you think?; the script runs apparently OK if "continue anyway" past the syntax error? 2. Occurs only on 1 machine out of 2 tested today.; it is an error which has been stopping me using that func [and scaring me off as I don't like to think I am crashing the computer all the time] ever since you released the example script, I think; not a new thing; re-installed latest Scite, AutoIt, [v Win XP2.] Best, randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW
PaulIA Posted June 2, 2007 Author Posted June 2, 2007 (edited) Hi, 1. Occurs all machines If I look at line 259 for you, if $iWidth > $cMaxX then DllStructGetData($tRect, "Right" ) = $iX + $cMaxXoÝ÷ Ø'£ 趧¦èºÛazÇWî˺Ûaz¥¥ø¥zË ë-²Øb²+~éÜ·º¹ì²¶§©Ýq©ç¢ÖÞuçâçmìË*.«ÞêÞzaz¥¥ø¥y«¢+Ù¥ÀÌØíÑ¡¸ÀÌØíµ©½È$$ô±±MÑÉÕÑÑÑ ÀÌØíÀ°ÅÕ½ÐíÝ5©½ÉYÉÍ¥½¸ÅÕ½Ðì¤what do you think?; the script runs apparently OK if "continue anyway" past the syntax error? 2. Occurs only on 1 machine out of 2 tested today.; it is an error which has been stopping me using that func [and scaring me off as I don't like to think I am crashing the computer all the time] ever since you released the example script, I think; not a new thing; re-installed latest Scite, AutoIt, [v Win XP2.] Best, randallUgh. You're making me old (and I can't afford to get any older). I found the problem with #1. You neglected to tell me that the error only happens when you resize the form. Details, details, details... Now, what are you doing when error #2 happens? Are trying to do something to the Explorer window that is open while the script is running? Can you tell me where in the example the error occurs (maybe put in some ConsoleWrite functions or something)? Is it bigger than a breadbox? Am I getting warmer? Edited June 2, 2007 by PaulIA Auto3Lib: A library of over 1200 functions for AutoIt
PaulIA Posted June 2, 2007 Author Posted June 2, 2007 Release 4.0.8Fixed a bug in the ListView 1 demo. Auto3Lib: A library of over 1200 functions for AutoIt
randallc Posted June 2, 2007 Posted June 2, 2007 Now, what are you doing when error #2 happens? Are trying to do something to the Explorer window that is open while the script is running? Can you tell me where in the example the error occurs (maybe put in some ConsoleWrite functions or something)? Is it bigger than a breadbox? Am I getting warmer? Now, what are you doing when error #2 happens? Are trying to do something to the Explorer window that is open while the script is running? )No -and I wasn't before; the first script would work; it was only a syntax error reported by Scite; aren't you using the full version or something?2. Maybe you can sugest some debugging points for me to work out where it is crashing?'ErrorReporting.txt>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Program Files\AutoIt3\Auto3Lib\ListView 2.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams +>19:40:58 Starting AutoIt3Wrapper v.1.9.0>Running AU3Check (1.54.7.0) from:C:\Program Files\AutoIt3+>19:41:00 AU3Check ended.rc:0>Running:(3.2.4.9):C:\Program Files\AutoIt3\autoit3.exe "C:\Program Files\AutoIt3\Auto3Lib\ListView 2.au3" Approximate view rect height .: 425Approximate view rect width ..: 757Callback mask ................: 0Color (background) ...........: 00FFFFFFColor (text) .................: 00000000Color (text background) ......: 00FFFFFFCount per page ...............: 52Edit control .................: 00000000Extended styles ..............: 00014C58DVD drive index ..............: 2Group view enabled ...........: FalseHeader columns ...............: 6Header handle ................: 00D30520HitTest: Item ................: 1HitTest: Over control ........: FalseHitTest: Over icon ...........: FalseHitTest: Over text ...........: TrueHitTest: Over image ..........: FalseHitTest: Over item ...........: TrueHitTest: Above client area ...: FalseHitTest: Below client area ...: FalseHitTest: Left of client area .: FalseHitTest: Right of client area : FalseHot cursor handle ............: 0001002DHot item index ...............: 1Hover time (milliseconds) ....: -1Image list (large) ...........: 000AC070Image list (small) ...........: 000ACB98Image list (state) ...........: 00000000Insert mark color ............: 00000000ISearch String ...............: Item count ...................: 23Item nearest point 0, 0 ......: -1Item spacing (horizontal) ....: 91Item spacing (vertical) ......: 91then crash...Thanks, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW
PaulIA Posted June 2, 2007 Author Posted June 2, 2007 From what you posted, it appears to be a problem in the ShowListView() function. If what you posted is correct, the problem is in _ListView_GetNumberOfWorkAreas because that would be the next thing that would get printed to the console. Comment out that line and see if the demo runs any further. Auto3Lib: A library of over 1200 functions for AutoIt
randallc Posted June 2, 2007 Posted June 2, 2007 From what you posted, it appears to be a problem in the ShowListView() function. If what you posted is correct, the problem is in _ListView_GetNumberOfWorkAreas because that would be the next thing that would get printed to the console. Comment out that line and see if the demo runs any further.No, by a process of elimination, it runs OK if All of the following are remarked; any one of them cause the problem; do they have something in common? ;~ _Lib_ConsoleWrite("Insert mark color ............: " & Hex(_ListView_GetInsertMarkColor ($hList ))) ;~ _Lib_ConsoleWrite("View: Small ..................: " & _ListView_GetViewSmall ($hList )) ;~ _Lib_ConsoleWrite("View: Tile ...................: " & _ListView_GetViewTile ($hList )) ;~ _Lib_ConsoleWrite("View rectangle ...............: [" & $aRect[0] & ", " & $aRect[1] & ", " & $aRect[2] & ", " & $a ;~ _Lib_ConsoleWrite()Best, randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW
PaulIA Posted June 2, 2007 Author Posted June 2, 2007 No, by a process of elimination, it runs OK if All of the following are remarked; any one of them cause the problem; do they have something in common? Best, randallSo now you're telling me that the problem is moving around? The information that you posted before showed the problem to be in _ListView_GetNumberOfWorkAreas. Now you're saying that function works? The only way all of those functions would fail would be if Explorer closed while the script is running (the handle is no longer valid). Ok, let's do this. I just put out a new version of code that includes some debug information. I've been wanting to do this for a while, so now's as good a time as any. Download the latest version and install it. Then modify the ListView 2 script and put the following line: $gbDebug = True right before the call to ShowListView() in the Main section. When the error occurs, it will create a file called A3LDebug.txt in your AutoIt directory. Post the contents of that file so we can see what is going on. Auto3Lib: A library of over 1200 functions for AutoIt
Recommended Posts