3 posts in this topic
Please answer me these questions three, ere the other side you see:
Are you running a 64-bit machine with a 64-bit Windows operating system? Can your AutoIt scripts cope with having directive #AutoIt3Wrapper_UseX64=Y, and thus @AutoItX64=True? Are you sick and tired of seeing this error message?
If you (like me) answered "YES" to all three questions, then the _HighMem library may ease your pain (the name commemorates a useful utility from the days when CPUs were still steam-powered). Forget about pathetic boot switches /3GB and /userva; in a full-fledged 64-bit environment, _HighMem can pre-allocate all available physical/virtual RAM you've got (or any smaller size you need), and manage individual allocations therein with four simple functions:
_HighMem_StartUp( $nSize, $sUnit="GB" ) ; parse size of total region to pre-allocate, e.g. (10,"GB") _HighMem_Allocate( $nSize, $sUnit="B" ) ; returns $pOffset (new allocation's base address) _HighMem_Release( $pOffset ) ; existing allocations are identified by their offset (base address) _HighMem_CleanUp() ; close handles, release all pre-allocated memory Of course, existing AutoIt limitations remain in force (e.g., DllstructCreate() is still limited to 2 GB per call), but the maximum of 2-4 GB of virtual memory per Windows process can (under the right circumstances, in the proper environment) be circumvented. However, this is the first beta release, so glitches are likely, and performance may vary. In fact, it may not work at all for you (if you're running 32-bit, for example). And since this involves your own hardware, it's unlikely I would be able to reproduce your issues in my own work environment. Nevertheless, if you find obvious bugs or mistakes in the code, please do post. And if it works for you, that's also good to hear. My own motivation for developing it was to supercharge my matrix computing environment (Eigen4AutoIt), so it can handle matrices of any size that fit in machine RAM.
The attached zip contains the library itself (HighMem.au3) and two test examples. HighMem_Test1 performs a dry run stress test of the allocation management system; it does not actually do any memory I/O. By contrast, HighMem_Test2 pre-allocates a 6 GB space, stores 3 x 2GB structs there, performs some basic I/O, and releases the allocations one by one. Obviously, for this to work you'll need at least that much free RAM to begin with (check with Task Manager -> Performance -> Memory if you're unsure). My own test environment has 16 GB of physical RAM, and runs W10Pro/64.
EDIT: minor edits added to improve user experience (many more status messages if $_HighMem_Verbose=True)
EDIT: from beta version 0.9, HighMem supports shared memory, including mutex negotiation.
Looking for working code to get full path of process - both 32 & 64 bit.
I tryed this bellow, but it works only for 32-bit processes, even if compiled for x64...
Thanx for suggestions!
Func _ProcessGetPath($vProcess) ;get the program path done by MrCreatoR Local $iPID = ProcessExists($vProcess) If NOT $iPID Then Return SetError(1, 0, -1) Local $aProc = DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', BitOR(0x0400, 0x0010), 'int', 0, 'int', $iPID) If NOT IsArray($aProc) OR NOT $aProc Then Return SetError(2, 0, -1) Local $vStruct = DllStructCreate('int') Local $hPsapi_Dll = DllOpen('Psapi.dll') If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@SystemDir & '\Psapi.dll') If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@WindowsDir & '\Psapi.dll') If $hPsapi_Dll = -1 Then Return SetError(3, 0, '') DllCall($hPsapi_Dll, 'int', 'EnumProcessModules', _ 'hwnd', $aProc, _ 'ptr', DllStructGetPtr($vStruct), _ 'int', DllStructGetSize($vStruct), _ 'int_ptr', 0) Local $aRet = DllCall($hPsapi_Dll, 'int', 'GetModuleFileNameEx', _ 'hwnd', $aProc, _ 'int', DllStructGetData($vStruct, 1), _ 'str', '', _ 'int', 2048) DllClose($hPsapi_Dll) If NOT IsArray($aRet) OR StringLen($aRet) = 0 Then Return SetError(4, 0, '') Return $aRet EndFunc
I'm developing again (everybody ruuun! )
I would like to develope a script that goes through basicly every user control on a window, and log things that happens, and maybe do some screenshots. I did something like this before.
My problem, which I would like to avoid this time (to improve my understanding and skill) , was that when I was unable to get a ControlID or handler or anything, I simply did some math and clicked on the coordinates it should have been (for example, maxing the window, and knowing the initial set up I was ablo to calculate given control position). I know that this is a bad solution for a number of reasons.
Now I got authorization to install autoIT here, and i started to the work, AU3Info was unable to find anything on the window (this could be a problem, since autoIT doesn't see anything on it then, if I understood the help file) So I got the SimpleSpy script (source:
I added a bit of code to the original to display ID as well, what I received is this:
Mouse position is retrieved 115-207
At least we have an element title: [ADD] class: [Button] ID:  (<-- coded this to display ID here as well)
Having the following values for all properties:
Title is: <ADD> Class := <Button> controltype:= <UIA_ButtonControlTypeId> ,<50000> , (0000C350) 10;187;120;35
*** Parent Information top down ***
3: Title is: <Compass> Class := <Window> controltype:= <UIA_WindowControlTypeId> ,<50032> , (0000C370) -8;-8;1936;1056
2: Title is: <> Class := <MainView> controltype:= <UIA_CustomControlTypeId> ,<50025> , (0000C369) 0;23;1920;1017
1: Title is: <> Class := <TileNavigationView> controltype:= <UIA_CustomControlTypeId> ,<50025> , (0000C369) 0;23;1920;967
0: Title is: <> Class := <AreasView> controltype:= <UIA_CustomControlTypeId> ,<50025> , (0000C369) 0;132;1920;858
so far I wrote this script:
WinActivate('Test') ;It works!! :D first official interaction Sleep(1000) ;1 sec sleep to be sure ControlClick('Test', '', '50000') If @error Then MsgBox($MB_SYSTEMMODAL, 'Error', 'ControlClick error') EndIf Sleep(1000) MsgBox(1,"Tracer message", 'ControlClick has happened') ;MouseClick() ;ControlCommand() AutoIt activates the window, but the click on the given button doesnt happen (I tried to write 50000 without ' ' on ID).
M'I doing the @error part correctly ? (no error Msg has been displayed), sorry I rarely use AutoIT and seems to forget less and less after each neglect, but still I'm far from a proffessional
Any help or suggestion is welcome, thank you for your time and insight!
I am parsing the rows of a tree control, but the parent window's title is variable along the lines of
Local $oP4=_UIA_getObjectByFindAll($oP5, "Title:=List: Items (1);controltype:=UIA_PaneControlTypeId;class:=WindowsForms10.Window.8.app.0.13f082a_r27_ad1", $treescope_children) the (1) may be anything, I was hoping I could partial match with "Title:=List: Items" but this does not work
Is there a way to get an object based on a partial title match?
Have to start learning UIAutomation since I need to use MS EDGE or Chrome. I downloaded Examples_V0_5.zip and UIA_V0_51.zip.
Compiled simplespy.au3 to get started. Appears to work. Did Ctrl+R and get error Line 15226 Error: Subscript used on non-accessible variable. What am I doing wrong?
Example 1 tried to run. It was missing CUIAutomation2.au3. Moved it into folder from UIA.zip to Examples and now works.
Example 2 failed. Added switch to case 0409 and "Start" and it worked.
Example 3 failed. Can't fix.
Code starting at Line 50.
Consolewrite("Get the menu that is after the start button" & @crlf)
$oMenuStart=_UIA_getFirstObjectOfElement($UIA_oDesktop,"Start Menu", $treescope_children) "I tried Start, Menu Start, and Start Menu, none seem to work."
if isobj($oMenuStart) Then
consolewrite("Menu start found" & @crlf)
consolewrite("I bet the text has to change to Start instead of Starten" & @crlf)
Get the menu that is after the start button
I bet the text has to change to Start instead of Starten
"C:\Users\xxxx\Autoit Scripts\UI Automation\EXAMPLES_V0_5\UIAWrappers.au3" (1726) : ==> Variable must be of type "Object".:
$t = $obj.Findfirst($treeScope, $oCondition, $UIA_pUIElement)
$t = $obj^ ERROR
Example 4 fails the same as in see below.
Code starting at Line 30
;~ Start the calculator and notepad
$oCalc=_UIA_getFirstObjectOfElement($UIA_oDesktop,"class:=" & $cCalcClassname, $treescope_children)
$oNotepad=_UIA_getFirstObjectOfElement($UIA_oDesktop,"class:="& $cNotepadClassName, $treescope_children)
if isobj($oCalc) Then
;~ You can comment this out just there to get the names of whats available under the calc window
$oButton=_UIA_getFirstObjectOfElement($oCalc,"name:=" & $cButton1, $treescope_subtree)
ConsoleWrite("I am hee" )
$oButton=_UIA_getFirstObjectOfElement($oCalc,"name:=" & $cButtonAdd, $treescope_subtree)
$oInvokeP.Invoke() This is where it fails
Example text is for dutch calculator so please change text to english or other language to identify controls
"C:\Users\xxxxxxxxxxx\Autoit Scripts\UI Automation\EXAMPLES_V0_5\ex4_calculator.au3" (44) : ==> Variable must be of type "Object".:
There must me something I am missing on why these codes are not working. XML file below of example 4.