The_Noob Posted June 9, 2007 Share Posted June 9, 2007 Yes.I am having problems understanding how to use this... i have a sample script below.do$handle = ControlGetHandle ( $window, "", $controlID ) ;this step i know works$value = _Progress_GetRange($handle) ;This step is giving me problemstooltip($value & @lf & $handle)until 1 = 2Im not sure if the handle will change every time the window is opened or if it stays the same, like a control ID. When i run this, it doesnt seem to understand the underscore before progress, "Unknown Function Name"In your example, it had $tRange = _Progress_GetRange($hProg)MemoWrite("Low range .: " & DllStructGetData($tRange, "Low" ))MemoWrite("High range : " & DllStructGetData($tRange, "High"))How am i to use memowrite? Is that necessary for _Progress_GetRange? Please help me im very confused Link to comment Share on other sites More sharing options...
PaulIA Posted June 9, 2007 Author Share Posted June 9, 2007 I am having problems understanding how to use this... i have a sample script below.do$handle = ControlGetHandle ( $window, "", $controlID ) ;this step i know works$value = _Progress_GetRange($handle) ;This step is giving me problemstooltip($value & @lf & $handle)until 1 = 2Im not sure if the handle will change every time the window is opened or if it stays the same, like a control ID. When i run this, it doesnt seem to understand the underscore before progress, "Unknown Function Name"In your example, it had $tRange = _Progress_GetRange($hProg)MemoWrite("Low range .: " & DllStructGetData($tRange, "Low" ))MemoWrite("High range : " & DllStructGetData($tRange, "High"))How am i to use memowrite? Is that necessary for _Progress_GetRange? Please help me im very confusedPosting a small, working script that demostrates the problem you are having would be nice. Then I could run your script and tell what the problem is. With the code above, I can't do much. I have no idea what $window or $controlID is or what external application you are trying to access.If the compiler complains that "_Progress_GetRange" is an unknown function, it's probably because you don't have "A3LProgress.au3" as an include at the top of your script.If the external window is destroyed and recreated, then the handle to the progress bar will change. The same is true of any windows program, regardless of the language it's written in.MemoWrite is used to write information to the memo control in the demo. It has nothing to do with the operation of _Progress_GetRange. Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
The_Noob Posted June 9, 2007 Share Posted June 9, 2007 (edited) Posting a small, working script that demostrates the problem you are having would be nice. Then I could run your script and tell what the problem is. With the code above, I can't do much. I have no idea what $window or $controlID is or what external application you are trying to access. If the compiler complains that "_Progress_GetRange" is an unknown function, it's probably because you don't have "A3LProgress.au3" as an include at the top of your script. If the external window is destroyed and recreated, then the handle to the progress bar will change. The same is true of any windows program, regardless of the language it's written in. MemoWrite is used to write information to the memo control in the demo. It has nothing to do with the operation of _Progress_GetRange. Thank you very much for this. I did forget the include. Im still using #include <A3LProgress.au3> $window = "windowname" $controlID = "ControlID here" do $handle = ControlGetHandle ( "$window", "", "$controlID" ) $value = _Progress_GetRange($handle) tooltip($value) until 1 = 2 but its not displaying anything to the tooltip... Is there somthing special i need to do to make it work? I know my control and window names are correct as i tested with tooltip($handle) and that worked fine - edit - I added in $rangehi = _Progress_GetRangeHi($handle) $rangelo = _Progress_GetRangeLo($handle) and made a tooltip pause a second on each $range, $rangehi, and $rangelo. Its giving nothing for range, 0 for low, and 3000 for hi. No matter what the value of the progress bar. Edited June 9, 2007 by The_Noob Link to comment Share on other sites More sharing options...
PaulIA Posted June 9, 2007 Author Share Posted June 9, 2007 Thank you very much for this. I did forget the include. Im still using #include <A3LProgress.au3> $window = "windowname" $controlID = "ControlID here" do $handle = ControlGetHandle ( "$window", "", "$controlID" ) $value = _Progress_GetRange($handle) tooltip($value) until 1 = 2 but its not displaying anything to the tooltip... Is there somthing special i need to do to make it work? I know my control and window names are correct as i tested with tooltip($handle) and that worked fineI take it that you missed the part about "posting a small, working script". Below is a script that creates an external progress bar, obtains the handle to the progress bar and shows the current postion and hi/lo ranges. #include <A3LProgress.au3> Global $hProg ProgressOn("My Progress", "Main Text", "SubText") ProgressSet(33) $hProg = ControlGetHandle("My Progress", "", "msctls_progress321") if $hProg = 0 then _Lib_ShowError("Unable to obtain progress handle") _Lib_ShowMsg("Progress bar position: " & _Progress_GetPos ($hProg)) _Lib_ShowMsg("Progress bar range lo: " & _Progress_GetRangeLo($hProg)) _Lib_ShowMsg("Progress bar range hi: " & _Progress_GetRangeHi($hProg)) Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
The_Noob Posted June 9, 2007 Share Posted June 9, 2007 (edited) ahh you used _Progress_GetPos, where i was using _Progress_GetRange. Thats the problem -edit- Strange, when i try to convert the code to work with my window, its giving me errors: _Mem_CtrlInt: Unable to allocate memory what does that mean? - Edit - I can get Getpos to work, but getrangelo and getrangehi dont seem to want to cooperate. Same error. Edited June 9, 2007 by The_Noob Link to comment Share on other sites More sharing options...
PaulIA Posted June 9, 2007 Author Share Posted June 9, 2007 ahh you used _Progress_GetPos, where i was using _Progress_GetRange. Thats the problem -edit-Strange, when i try to convert the code to work with my window, its giving me errors:_Mem_CtrlInt: Unable to allocate memorywhat does that mean? - Edit -I can get Getpos to work, but getrangelo and getrangehi dont seem to want to cooperate. Same error.We're not learning, are we? I can't help you debug a problem with your code if you're not going to post it. Post a small, working example that shows the problem you're having and I'll be glad to take a look. Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
The_Noob Posted June 10, 2007 Share Posted June 10, 2007 (edited) We're not learning, are we? I can't help you debug a problem with your code if you're not going to post it. Post a small, working example that shows the problem you're having and I'll be glad to take a look. i tried modifying what you supplied to: #include <A3LProgress.au3> $hProg = ControlGetHandle("My Program", "", "ControlID");where "My Program" and "ControlID" are replaced with the name and control ID of the program i am working with. It is a private program which i cannot provide. if $hProg = 0 then _Lib_ShowError("Unable to obtain progress handle") _Lib_ShowMsg("Progress bar position: " & _Progress_GetPos ($hProg)) _Lib_ShowMsg("Progress bar range lo: " & _Progress_GetRangeLo($hProg)) _Lib_ShowMsg("Progress bar range hi: " & _Progress_GetRangeHi($hProg)) What confuses me is how it works if Autoit makes the progress bar, however it doesnt work when its a progress bar on the program i am working with. Perhaps it does not work with all programs? Unfortunately i am unable to provide the program i am working with, as it is a private program and i dont have permission to share it. Thanks for bearing with my lack of skill Edited June 10, 2007 by The_Noob Link to comment Share on other sites More sharing options...
PaulIA Posted June 10, 2007 Author Share Posted June 10, 2007 i tried modifying what you supplied to: #include <A3LProgress.au3> $hProg = ControlGetHandle("My Program", "", "ControlID");where "My Program" and "ControlID" are replaced with the name and control ID of the program i am working with. It is a private program which i cannot provide. if $hProg = 0 then _Lib_ShowError("Unable to obtain progress handle") _Lib_ShowMsg("Progress bar position: " & _Progress_GetPos ($hProg)) _Lib_ShowMsg("Progress bar range lo: " & _Progress_GetRangeLo($hProg)) _Lib_ShowMsg("Progress bar range hi: " & _Progress_GetRangeHi($hProg)) What confuses me is how it works if Autoit makes the progress bar, however it doesnt work when its a progress bar on the program i am working with. Perhaps it does not work with all programs? Unfortunately i am unable to provide the program i am working with, as it is a private program and i dont have permission to share it. Thanks for bearing with my lack of skill A progress control is a progress control. It doesn't matter if AutoIt creates it or your super secret program creates it. It's the same control as long as it returns the same class name. At this point, there are only a couple of things that I can suggest: 1. Make sure you truly have the handle to a progress bar. Validate this by passing $hProg to the _API_GetClassName function in A3LWinAPI.au3. If it doesn't return something that starts with "msctls_progress32", then you do not have the handle to a progress bar. 2. Find a common application (preferrably one that ships with XP) that has a progress bar in it and try the code on that application. If it doesn't work, then you can post a small, working example of the problem that you are having and I can help. Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
The_Noob Posted June 10, 2007 Share Posted June 10, 2007 A progress control is a progress control. It doesn't matter if AutoIt creates it or your super secret program creates it. It's the same control as long as it returns the same class name. At this point, there are only a couple of things that I can suggest:1. Make sure you truly have the handle to a progress bar. Validate this by passing $hProg to the _API_GetClassName function in A3LWinAPI.au3. If it doesn't return something that starts with "msctls_progress32", then you do not have the handle to a progress bar.2. Find a common application (preferrably one that ships with XP) that has a progress bar in it and try the code on that application. If it doesn't work, then you can post a small, working example of the problem that you are having and I can help.Ok thanks for your assistance. Great bit of work you did here, i really like it Link to comment Share on other sites More sharing options...
BassPlayer Posted June 10, 2007 Share Posted June 10, 2007 Hi First off, Thanks for all your hard work! I too have received the dreaded cannot redeclare constant error even though I'm using the latest AI version 3.2.4.9 and your code downloaded yesterday. Here is what I'm trying to do Run("mmc.exe") If WinWaitActive("Console1", "", 60) Then Send("!fo") Send ($systemRoot & "\system32\compmgmt.msc") Send("{ENTER}") EndIf WinWaitActive("Computer Management", "", 60) #include <A3LMenu.au3> #include <A3LListView.au3> #include <A3LToolbar.au3> #include <A3LTreeView.au3> Opt("MustDeclareVars", 1) Global $hTree, $hNode, $hList, $text, $iI, $sItem, $aRect $hTree = ControlGetHandle("Computer Management", "", "SysTreeView321") if @Error then _Lib_ShowError("Unable to find TreeView window") $hNode = _TreeView_FindNode($hTree, "Local Users and Groups") if $hNode = 0 then _Lib_ShowError('Unable to find "Local Users and Groups') _TreeView_Click($hTree, $hNode) _TreeView_Expand($hTree, $hNode) $hNode = _TreeView_FindNode($hTree, "Groups") _TreeView_Click($hTree, $hNode) $hList = ControlGetHandle("Computer Management", "", "SysListView321") if $hList = 0 then _Lib_ShowError("Unable to obtain ListView handle in ClickItem") for $iI = 0 to _ListView_GetItemCount($hList) - 1 MsgBox(0, "text ..................: " & _ListView_GetItemText($hList, $iI)) next I'm not sure I'm using the lib right but I was under the impression that I needed to use the TreeVew lib to get to the right node and the ListView lib to display the contents. Again, Thanks for some great code. Link to comment Share on other sites More sharing options...
BassPlayer Posted June 10, 2007 Share Posted June 10, 2007 Apparently I only get the error when I include both of these libs #include <A3LListView.au3> #include <A3LTreeView.au3> If I remove the list view lib and calls all the tree view stuff works. Link to comment Share on other sites More sharing options...
PaulIA Posted June 10, 2007 Author Share Posted June 10, 2007 Apparently I only get the error when I include both of these libs #include <A3LListView.au3> #include <A3LTreeView.au3> If I remove the list view lib and calls all the tree view stuff works.When I run your script, I get the following error: >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\Test.au3" D:\Test.au3 (5) : ==> Variable used without being declared.: Send ($systemRoot & "\system32\compmgmt.msc") Send (^ ERROR >Exit code: 1 Time: 1.012This says that you're using $systemRoot without declaring it first. To get your script to run, I had to change the line the error is in to: Send (@SystemDir & "\compmgmt.msc") There are duplicate constants declared between the ListView and TreeView modules. Open both modules and move all of the constants that begin with $CDDS_, $CDIS_ and $CDRF_ to the A3LConstants.au3 file. I will include this change in the next release. Thanks for reporting this. Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
PaulIA Posted June 11, 2007 Author Share Posted June 11, 2007 Release 4.0.11This release contains the help file examples up through the Toolbar control. In going through this module, I found a lot of duplicated function calls and a few that were missing. This was the second module that I wrote for Auto3Lib and it need a bit of cleaning up.Fixed duplicate constant declarations in the ListView and TreeView modules (thanks BassPlayer). Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
BassPlayer Posted June 11, 2007 Share Posted June 11, 2007 Release 4.0.11This release contains the help file examples up through the Toolbar control. In going through this module, I found a lot of duplicated function calls and a few that were missing. This was the second module that I wrote for Auto3Lib and it need a bit of cleaning up.Fixed duplicate constant declarations in the ListView and TreeView modules (thanks BassPlayer).Wow that was a quick turnaround thanks! I think the systemroot thing worked for me because I pasted your example code after my test code so the Opt("MustDeclareVars", 1) setting was not in effect when that statement was executed. Later when I pasted the code I must of "improved" my code so it would not work =/Testing out the new version now. Link to comment Share on other sites More sharing options...
BassPlayer Posted June 11, 2007 Share Posted June 11, 2007 The latest version works great! Thanks Link to comment Share on other sites More sharing options...
PaulIA Posted June 12, 2007 Author Share Posted June 12, 2007 The latest version works great!ThanksGlad to hear it. Thanks again for the bug report. Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
acada Posted June 12, 2007 Share Posted June 12, 2007 Hi I have problem with capturing images on Win 2000 and older. I am using these commands: CODE#include <A3LScreenCap.au3> ; Capture full screen _ScreenCap_Capture("C:\Image1.jpg") ; Capture region _ScreenCap_Capture("C:\Image2.jpg", 0, 0, 796, 596) The error I get on Win 2000 is: Line 0 (File "<my_file>"): Return SetError($aResult[0], 0, $aResult[1]) Return SetError($aResult^ ERROR Error: Subscript used with non-Array variable. The very same example script runs fine on the WinXP. I have tracked the problem to the A3LGDIPlus.au3 library, because no other lib contains the "Return SetError($aResult[0], 0, $aResult[1])". What can be the problem? I have latest autoit and latest a3lib... Link to comment Share on other sites More sharing options...
PaulIA Posted June 12, 2007 Author Share Posted June 12, 2007 Hi I have problem with capturing images on Win 2000 and older. I am using these commands: CODE#include <A3LScreenCap.au3> ; Capture full screen _ScreenCap_Capture("C:\Image1.jpg") ; Capture region _ScreenCap_Capture("C:\Image2.jpg", 0, 0, 796, 596) The error I get on Win 2000 is: Line 0 (File "<my_file>"): Return SetError($aResult[0], 0, $aResult[1]) Return SetError($aResult^ ERROR Error: Subscript used with non-Array variable. The very same example script runs fine on the WinXP. I have tracked the problem to the A3LGDIPlus.au3 library, because no other lib contains the "Return SetError($aResult[0], 0, $aResult[1])". What can be the problem? I have latest autoit and latest a3lib...Auto3Lib uses GDI+ for all screen capture functions. From MSDN: GDI+ can be used in all Windows-based applications. GDI+ is new technology that is included in Windows XP and the Windows Server 2003. It is required as a redistributable for applications that run on the Microsoft Windows NT 4.0 SP6, Windows 2000, Windows 98, and Windows Millennium Edition (Windows Me) operating systems.If you search your Win2K machine, you'll find that GDIPlus.dll does not exist. You can get a version to include with your application from here. Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
acada Posted June 12, 2007 Share Posted June 12, 2007 Auto3Lib uses GDI+ for all screen capture functions. From MSDN:If you search your Win2K machine, you'll find that GDIPlus.dll does not exist. You can get a version to include with your application from here.O my... I should have known it. Now it is working like charm. I will try FileInstall to copy this library whenever the utility is executed from. The whole script is for massive remote deploying of installation (no it is is not a virus, nor spyware) using UDP. Link to comment Share on other sites More sharing options...
PaulIA Posted June 12, 2007 Author Share Posted June 12, 2007 O my... I should have known it. Now it is working like charm. I will try FileInstall to copy this library whenever the utility is executed from. The whole script is for massive remote deploying of installation (no it is is not a virus, nor spyware) using UDP.You should be able to use @OSVersion to detect whether you need to install the file or not. Or, you could just install the file in the script directory all the time. There are a lot of applications that have a copy of the GDI+ DLL in their home directory, so this would not be anything unusual.Glad you got it working. Let me know if you need anything else. Auto3Lib: A library of over 1200 functions for AutoIt Link to comment Share on other sites More sharing options...
Recommended Posts