Jump to content

IUIAutomation MS framework automate Problem


 Share

Recommended Posts

hi guys , i try to understund how work IUIAutomation MS framework automate , i try to run example  notepad , in windows 7 , my scenario is 

UIA_V0_64 , with  ex31_Notepad.au3 , but when run it open a notepad and give me error

"C:\Users\SviluppoGest\Downloads\UIA_V0_64 (1)\UIAWrappers.au3" (1661) : ==> Variable must be of type "Object".:
$tPattern.SetWindowVisualState($WindowVisualState_Normal)
$tPattern^ ERROR
->11:31:48 AutoIt3.exe ended.rc:1

someone can help me  ??   thankz

 

Link to comment
Share on other sites

  • Developers

@faustf, Sorry for my Dutch bluntness, but you really have an issue using your brain when you are around this forum ...  don't you?

In which Forum did you post this?

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

hi guys , i try to understund how work IUIAutomation MS framework automate , i try to run example  notepad , in windows 7 , my scenario is 

UIA_V0_64 , with  ex31_Notepad.au3 , but when run it open a notepad and give me error

"C:\Users\SviluppoGest\Downloads\UIA_V0_64 (1)\UIAWrappers.au3" (1661) : ==> Variable must be of type "Object".:
$tPattern.SetWindowVisualState($WindowVisualState_Normal)
$tPattern^ ERROR
->11:31:48 AutoIt3.exe ended.rc:1

someone can help me  ??   thankz

Link to comment
Share on other sites

i tryed also this  code 

;~ *** Standard code ***
#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)
run("C:\Program Files\Internet Explorer\iexplore.exe")



;~ IE definitions
_UIA_setVar("browser1.mainwindow","classname:=IEFrame;controltype:=WindowControl;instance:=1")
_UIA_setVar("browser1.addressbar","Title:=Adresbalk;controltype:=UIA_PaneControlTypeId;class:=Address Band Root;indexrelative:=1")

;~ 2nd and 3rd browser definition (as an example)
_UIA_setVar("browser2.mainwindow","classname:=IEFrame;controltype:=WindowControl;instance:=2")
_UIA_setVar("browser3.mainwindow","classname:=IEFrame;controltype:=WindowControl;instance:=3")


;~ _UIA_setVar("browser4.addressbar","ControlType:=EditControl;instance:=1")

;~ So first on internet explorer
_UIA_action("browser1.mainwindow","setfocus")
_UIA_action("browser1.addressbar","setfocus")
_UIA_action("browser1.addressbar","click")
_UIA_action("browser1.addressbar","setvalue", "www.autoitscript.com")
_UIA_action("browser1.addressbar","sendkeys", "{ENTER}")
;~ Just to show something happened before we go home again
sleep(5000)
_UIA_action("browser1.addressbar","sendkeys", "{BROWSER_HOME}")



Exit

but open explore and show red round , and dont do nothing o_O

 

Link to comment
Share on other sites

  • Moderators
1 hour ago, faustf said:

hi guys , i try to understund how work IUIAutomation MS framework automate , i try to run example  notepad , in windows 7 , my scenario is 

UIA_V0_64 , with  ex31_Notepad.au3 , but when run it open a notepad and give me error

"C:\Users\SviluppoGest\Downloads\UIA_V0_64 (1)\UIAWrappers.au3" (1661) : ==> Variable must be of type "Object".:
$tPattern.SetWindowVisualState($WindowVisualState_Normal)
$tPattern^ ERROR
->11:31:48 AutoIt3.exe ended.rc:1

someone can help me  ??   thankz

The error is telling you what is wrong. $tPattern is obviously not an object. What more do you need, go figure out why it doesn't exist.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

ok, so, it's the fact that he's looking for Notepad in different langues causing the bug... lol

here is my fixed code, working now, on Windows 10, working reliably, for ENGLISH windows.

#include "..\UIAWrappers.au3"

AutoItSetOption("MustDeclareVars", 1)

;~ Start the application
Run("notepad.exe")
Sleep(1000)

#REGION UIA_LOGICAL_NAMES
;~ Give logical names
;~ _UIA_setVar("notepad.mainwindow","title:=((Naamloos.*Kladblok)|(.*Notepad));classname:=Notepad")
_UIA_setVar("notepad.mainwindow","title:=Notepad; classname:=Notepad")
_UIA_setVar("notepad.mainwindow.edit","title:=; classname:=Edit")

;~ When closing when text is changed
_UIA_setVar("Notepad.closewindow","title:=Notepad; classname:=#32770")
;~ The three buttons
_UIA_setVar("Notepad.closewindow.Save","title:=Save;classname:=CCPushButton")
_UIA_setVar("Notepad.closewindow.Don'tSave","title:=Don't Save;classname:=CCPushButton")
_UIA_setVar("Notepad.closewindow.Cancel","title:=Cancel; classname:=CCPushButton")
#ENDREGION

#REGION ACTIONS
;~ Do some actions on the logical named objects
_UIA_action("notepad.mainwindow","setfocus")
_UIA_action("notepad.mainwindow","move",300,300)
_UIA_action("notepad.mainwindow","resize",300,300)
_UIA_action("notepad.mainwindow","minimize",300,300)
_UIA_action("notepad.mainwindow","maximize",300,300)
_UIA_action("notepad.mainwindow","resize",400,400)

_UIA_action("notepad.mainwindow.edit","setfocus")
_UIA_action("notepad.mainwindow.edit","setvalue","set value: hello world")
_UIA_action("notepad.mainwindow.edit","type","type command: hello world")

_UIA_action("notepad.mainwindow","close",400,400)
if _UIA_action("Notepad.closewindow","exists") Then
    _UIA_action("Notepad.closewindow.Don'tSave","click")
Else
EndIf
#ENDREGION

for some reason, you must sleep a second after running. it only works every time if you already have notepad running unless you sleep. I tried WinActivate for notepad but it still does nothing. So, it works if you place a sleep after the run

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

I noticed the browser automation always need external tool/file and doing external action from autoIT. That may need more time to be executed. 

That was my case when i tested (I am learning browsers automation too) i noticed the same thing as you. 

 

But i am using WebDriver. So it s maybe not the same "issue".

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
Share on other sites

it's just timing for sure. I just don't like having to use static sleep and was too lazy to write a routine to dynamically wait for the example. as it was written by junkew, it just runs and then attempts to automate notepad, but that is why there is no object, it's not fully up yet. and so it fails. but my code runs for me on Win7 and Win10 64 bit every time.

like i said, I thought WinActivate was enough, but it wasn't, the sleep was

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

2 hours ago, faustf said:

but this WebDriver is necessary  have  skill in java ?? 

 

Starting with autoIT following VBA a little actualy and maybe next java why not haha

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...