Jump to content
zreo15

iuiautomation error Variable must be of type "Object" in some examples

Recommended Posts

zreo15

well i tried the examples of iuiautomation and i keep on gettin errors on starting example 

ex2- "C:\Users\1406378\Downloads\EXAMPLES_V0_5\ex2_Taskbar.au3" (42) : ==> Variable must be of type "Object".:
$oInvokeP.invoke()
$oInvokeP^ ERROR

ex3-"C:\Users\1406378\Downloads\EXAMPLES_V0_5\UIAWrappers.au3" (1726) : ==> Variable must be of type "Object".:
$t = $obj.Findfirst($treeScope, $oCondition, $UIA_pUIElement)
$t = $obj^ ERROR

ex4 theres a missing endif i guess thats maybe editing error 

ex5-"C:\Users\1406378\Downloads\EXAMPLES_V0_5\UIAWrappers.au3" (1726) : ==> Variable must be of type "Object".:
$t = $obj.Findfirst($treeScope, $oCondition, $UIA_pUIElement)
$t = $obj^ ERROR

ex6-Action 1
Action 2
"C:\Users\1406378\Downloads\EXAMPLES_V0_5\UIAWrappers.au3" (1464) : ==> Variable must be of type "Object".:
$oElementStart.FindAll($treeScope, $UIA_oTRUECondition, $pElements)
$oElementStart^ ERROR

ex7-Action 7 retrieve document after clicking a hyperlink
Action 7 failed 

if firefox is already strted then it fails at action 6 only, the cursor goes to top-left corner n right clicks there then action fails , but if firefox is initially off then it fails at action 7

ex8-Action 5
"C:\Users\1406378\Downloads\EXAMPLES_V0_5\ex8_ie.au3" (121) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
_UIA_DrawRect($t[1],$t[3]+$t[1],$t[2],$t[4]+$t[2])
_UIA_DrawRect($t[1],^ ERROR

ex-9/10-debug.au3 i cant find it on net where to download it from 

ex11(event)->Running AU3Check (3.3.12.0)  from:C:\Program Files (x86)\AutoIt3  input:C:\Users\1406378\Downloads\EXAMPLES_V0_5\Ex11Events.au3
"C:\Users\1406378\Downloads\EXAMPLES_V0_5\Ex11Events.au3"(15,68) : warning: $objUIAutomation: possibly used before declaration.
$hr=$objUIAutomation.AddFocusChangedEventHandler(0, $oFCEHandler())
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\1406378\Downloads\EXAMPLES_V0_5\Ex11Events.au3"(40,28) : warning: $sIID_IUnknown: possibly used before declaration.
        Case $sIID_IUnknown,
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\1406378\Downloads\EXAMPLES_V0_5\Ex11Events.au3"(15,68) : error: $objUIAutomation: undeclared global variable.
$hr=$objUIAutomation.AddFocusChangedEventHandler(0, $oFCEHandler())
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\1406378\Downloads\EXAMPLES_V0_5\Ex11Events.au3"(40,28) : error: $sIID_IUnknown: undeclared global variable.
        Case $sIID_IUnknown,
~~~~~~~~~~~~~~~~~~~~~~~~~~~^
"C:\Users\1406378\Downloads\EXAMPLES_V0_5\Ex11Events.au3"(13,112) : error: UIA_ObjectFromTag(): undefined function.
Global $oFCEHandler = UIA_ObjectFromTag("_MyHandler_", $dtagIUIAutomationFocusChangedEventHandler, $tFCEHandler)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
C:\Users\1406378\Downloads\EXAMPLES_V0_5\Ex11Events.au3 - 3 error(s), 2 warning(s)

anyone have any idea why m I getting so many errors specially the " variable should be an object " 

Edited by zreo15

Share this post


Link to post
Share on other sites
LarsJ

zreo15, There are a few things that are good to know when you test the examples: junkew who has created the examples is Dutch and he has developed the examples on a Windows 7 64 bit PC.

If you are not Dutch or is running another OS it can be necessary to change a few words or commands.

First of all most of the text strings that are used to identify objects are localized and are case sensitive.

Ex 2. I had to add these lines:

case 0409
    $CaptionStartButton="start"

Ex 3 line 52: Replace $treescope_children with $TreeScope_Descendants

Ex 5. Start Chrome manually. Copy and paste chrome://accessibility in the addressbar.
Line 53: Replace $oChromeToolbar with $oChrome

Now you can edit the rest of the examples yourself. If the problem persists then please refer to the line in the example that fails. You can find the line by inserting a couple of ConsoleWrite commands.

Share this post


Link to post
Share on other sites
zreo15

m running windows 8.1  64 bit english and yes simplespy is working fine no problem with it 

my accessibility is turned on and i had to change the paths for exe startup they are sumhow weird in my system and i did replace the dutch words 

ex2( after edit ) -Your languagecode influences name of start button and your languagecode is: 0409
I bet you did not read the messagebox"C:\Users\1406378\Downloads\EXAMPLES_V0_5\ex2_Taskbar.au3" (42) : ==> Variable must be of type "Object".:
$oStart.getCurrentPattern($UIA_InvokePatternId, $pInvoke)
$oStart^ ERROR

ex3( after edit ) - Menu start found
scite not found
Get the pattern to click on the menu after the start button. Invoke possible: ** NO PROPERTYVALUE DUE TO NONEXISTING OBJECT **
"C:\Users\1406378\Downloads\EXAMPLES_V0_5\UIAWrappers.au3" (514) : ==> Variable must be of type "Object".:
$obj.getCurrentPattern($patternID, $pPattern)
$obj^ ERROR 

been a year since i last updated my OS maybe thats why all the problem (( will update soon in a month when i go back to classes )) and will try to reinstall whole autoit again this time 

Share this post


Link to post
Share on other sites
LarsJ

You are on Windows 8.1. I have not used Windows 8/8.1. As far as I know the Start menu is replaced with a Start screen on Windows 8.1. That's the reason why it's not working. You probably have to change most of the code in Ex 2 to make it work with the Win 8.1 Start screen.

Share this post


Link to post
Share on other sites
zreo15

ah okay well what about the browser ones they should be working correctly i hope and i saw many times it happened that even though simplespy can get the details of the DOM elements correct but when the code is run its not accuratly performing it m guessing it maybe because of googles problems with chromes built system but even IE and firefox show same problem

ex i copy pasted code from simplespy of opening minimised firefox then i pasted the code of search button of speedialer page then when i ran the code it opened firefox properly then tried to find serch box but couldnt do it same result for chrome 

in another test i made them open a webpage and click on a few links on that page chrome kept on clicking on the same link everytym for each test n firefox kept on clickin on the firefox button 

sumhow other then browser automation everythin else is workin fine probably some fault in my system i guess

Share this post


Link to post
Share on other sites
junkew

Difficult to say. As simple spy is recognizing everything can work as long as you can find out the proper elementtree. Thats the harder part and simplespy cannot fully help with that. I have stuff working for all browsers but have seen with especially chrome versions object hierarchy and classnames are changing. I am working on the iuiwrappers to get it more stable in finding objects.

Share this post


Link to post
Share on other sites
zreo15

yup well i went through that thread and read about the problem good luck with it 

and i will report the result after updating my os

Share this post


Link to post
Share on other sites
zreo15

yup well i went through that thread and read about the problem good luck with it 

and i will report the result after updating my os

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×