
mycloutier
Members-
Posts
12 -
Joined
-
Last visited
Everything posted by mycloutier
-
IUIAutomation MS framework automate chrome, FF, IE, ....
mycloutier replied to junkew's topic in AutoIt Example Scripts
Has this been fixed? I had a modified UIAWrappers where the xml's were not generated. I lost that file and for some reason I can't get this to work. -
Have been playing around with UIAWrappers for a bit now and I am facing a challenge when trying to select a specific item in a combo box. I am able to select the combo box item as long as it is visible in the drop down menu. There are 34 different items in the combo box but only 5 are visible in the drop down menu without scrolling down the list ... This is the code I have so far ... #include "UIAWrappers1.au3" #include <MsgBoxConstants.au3> #include <File.au3> #include <FileConstants.au3> Local $oP10 Local $oP9 Local $oP8 Local $oP7 Local $oP6 Local $oP5 Local $oP4 Local $oP3 Local $oP2 Local $oP1 Local $oP0 Local $oUIElement Local $COMPORT= "COM7" AutoItSetOption("MustDeclareVars", 1) ShellExecute("C:\CampSilv\CAMPCuSv.bat") WinWait("SilverScreen") Sleep (5000) Call("InvokeCOM") Func InvokeCOM() IF Not WinActive("{CLASS:}", "SilverScreen") Then WinActivate("{CLASS:}", "SilverScreen") Local $oP6=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=SilverScreen;controltype:=UIA_WindowControlTypeId;class:=", $treescope_children) _UIA_Action($oP6,"setfocus") Local $oP5=_UIA_getObjectByFindAll($oP6, "Title:=MOSS Setup(Version Feb 2013);controltype:=UIA_WindowControlTypeId;class:=#32770", $treescope_children) _UIA_Action($oP5,"setfocus") Local $oP4=_UIA_getObjectByFindAll($oP5, "Title:=Setup;controltype:=UIA_ButtonControlTypeId", $treescope_children) _UIA_Action($oP4,"setfocus") _UIA_Action($oP3,"invoke") Local $oP3=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=SilverScreen;controltype:=UIA_WindowControlTypeId;class:=", $treescope_children) Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=Survey import[C:\CAMPSILV\DRW\];controltype:=UIA_WindowControlTypeId;class:=#32770", $treescope_children) _UIA_Action($oP2,"setfocus") Local $oP1=_UIA_getObjectByFindAll($oP2, "Title:=Data Source:;controltype:=UIA_ComboBoxControlTypeId;class:=ComboBox", $treescope_children) _UIA_Action($oP1,"setfocus") _UIA_Action($oP1,"click") Local $oP0=_UIA_getObjectByFindAll($oP1, "Title:=Data Source:;controltype:=UIA_ListControlTypeId;class:=ComboLBox", $treescope_subtree) _UIA_action($oP0,"highlight") Local $oUIElement=_UIA_getObjectByFindAll($oP0, "Title:=COM7;ControlType:=UIA_ListItemControlTypeId", $treescope_subtree) _UIA_action($oUIElement,"highlight") _UIA_action($oUIElement,"click") EndFuncThe default item selected varies and changes all the time. Is there a way to click an item without having to scroll down the list? Any ideas or help would be greatly appreciated! Thank you!
-
Thank you for all the replies. I have better idea on how to go about this ... @mikell and @ Danyfirex both your example works as long as we are searching for "Standard Serial over Bluetooth link". I will be searching for more than one possibility... @mikell with your example if I use this line of code for example, I will get a return on the array, however only getting the appropriate com number for the first option search string $exp = "Prolific USB|Standard Serial over Bluetooth link"@Danyfirex with your example I cannot get a return if I try to use more than one search string ... Local $Find = "Prolific USB|Standard Serial over Bluetooth link" I appreciate all the help! Thank you! :-)
-
Looking on some advice on how to tackle this issue! I have a text file that is generated from another program. My goal is to write a script that would read each line in the text file and set a variable if a certain expression is found. For example let's say the text file contains the following 4 lines of text : Intel(R) Active Management Technology - SOL (COM4) Communications Port (COM1) Standard Serial over Bluetooth link (COM7) Standard Serial over Bluetooth link (COM6) I need to search for the following expression "Standard Serial over Bluetooth link" and associate the corresponding COM as a variable ... in this case there are 2 ... either COM6 or COM7. This is the code I have so far : #include "UIAWrappers.au3" #include <MsgBoxConstants.au3> #include <File.au3> #include <FileConstants.au3> Call("COMPorts") Func COMPorts() $file = "C:\GunTSTool\ports.txt" FileOpen($file, 0) For $i = 1 to _FileCountLines($file) $line = FileReadLine($file, $i) If $line = "Standard Serial over Bluetooth link" Then msgbox(0,'','' & '' & $line) ElseIf $line = "Prolific USB Cable" Then msgbox(0,'','' & '' & $line) ElseIf $line = "Prolific USB to serial Cable" Then msgbox(0,'','' & '' & $line) EndIf Next FileClose($file) EndFuncMy main issue here is that the COM number will be changing all the time, I need to search only the text before the COM ... Any ideas? Marty
-
Click on item of a standard context menu
mycloutier replied to MyEarth's topic in AutoIt General Help and Support
@LarsJ You are da man! Thank you so kindly! -
Click on item of a standard context menu
mycloutier replied to MyEarth's topic in AutoIt General Help and Support
@LarsJ I am trying to use this example as a way to invoke the "Always available offline" menu item from a file that is located on a network drive. It is always bugging at Find menu controls ERR. It works great on a local file from the C:\ drive ... Any thoughts or suggestions? -
I am facing a similar challenge using the same controltype. I want my script to store a certain property (title) of a UIA_TextControlTypeId into a variable so I can then perform certain actions depending on what is stored in this variable. This is the code I have so far. You should be able to understand my logic in terms of what it is I am trying to accomplish. Any ideas on how to go about this or point me into a certain direction would be greatly appreciated. I am learning lots from theses forums. Still a newbie, just trying to figure out one challenge at a time :-) Thank you. #include "UIAWrappers1.au3" #include <CUIAutomation2.au3> AutoItSetOption("MustDeclareVars", 1) #AutoIt3Wrapper_UseX64=N ;Should be used for stuff like tagpoint having right struct etc. when running on a 64 bits os ; Run ShellExecute("mobsync.exe") ; Wait 2 seconds for windows explorer to appear. WinWait("Sync Center") IF Not WinActive("{CLASS:CabinetWClass}", "Sync Center") Then WinActivate("{CLASS:CabinetWClass}", "Sync Center") Local $oP7=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Sync Center;controltype:=UIA_WindowControlTypeId;class:=CabinetWClass", $treescope_children) _UIA_Action($oP7,"setfocus") Local $oP6=_UIA_getObjectByFindAll($oP7, "Title:=Sync Center;controltype:=UIA_PaneControlTypeId;class:=ShellTabWindowClass", $treescope_children) _UIA_Action($oP6,"setfocus") Local $oP5=_UIA_getObjectByFindAll($oP6, "Title:=;controltype:=UIA_PaneControlTypeId;class:=DUIViewWndClassName", $treescope_children) _UIA_Action($oP5,"setfocus") Local $oP4=_UIA_getObjectByFindAll($oP5, "Title:=Shell Folder View;controltype:=UIA_PaneControlTypeId;class:=DUIListView", $treescope_children) _UIA_Action($oP4,"setfocus") Local $oP3=_UIA_getObjectByFindAll($oP4, "Title:=Folder View;controltype:=UIA_ListControlTypeId;class:=SysListView32", $treescope_children) _UIA_Action($oP3,"setfocus") Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=Folders (1);controltype:=UIA_GroupControlTypeId;class:=", $treescope_children) _UIA_Action($oP2,"setfocus") Local $oP1=_UIA_getObjectByFindAll($oP2, "title:=Offline Files;ControlType:=UIA_ListItemControlTypeId", $treescope_subtree) _UIA_action($oP1,"setfocus") Local $oUIElement=_UIA_getPropertyValue($oP1, "title:=:=UIA_TextControlTypeId", $treescope_subtree) If Local $oUIElement=_UIA_getObjectByFindAll($oP1, "title:=Disconnected;ControlType:=UIA_TextControlTypeId", $treescope_subtree) Then _UIA_action($oUIElement,"setfocus") MsgBox(0, "Warning!", "Disconnected from the network!", 10) ElseIf Local $oUIElement2=_UIA_getObjectByFindAll($oP1, "title:=Sync in progress;ControlType:=UIA_TextControlTypeId", $treescope_subtree) Then _UIA_action($oUIElement,"setfocus") MsgBox(0, "Warning!", "Sync is already in progress!", 10) Elseif Local $oP10=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Sync Center;controltype:=UIA_WindowControlTypeId;class:=CabinetWClass", $treescope_children) _UIA_Action($oP10,"setfocus") Local $oP9=_UIA_getObjectByFindAll($oP10, "Title:=Sync Center;controltype:=UIA_PaneControlTypeId;class:=ShellTabWindowClass", $treescope_children) Local $oP8=_UIA_getObjectByFindAll($oP9, "title:=Sync All;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree) _UIA_Action($oP8,"invoke") EndIF
-
Hello, I am encountering a specific situation using UIAWrappers.au3. I am able to focus on my element. I want my script to execute certain actions depending on certain conditions .... The only variable that will be changing in this situation is the title ... control type will always be the same ... I want msg boxes to be displayed depending on the different titles of the controltypeid's. Here is my code so far ... Any ideas on how to code this would be greatly appreciated :-) #include "UIAWrappers1.au3" #include <MsgBoxConstants.au3> AutoItSetOption("MustDeclareVars", 1) #AutoIt3Wrapper_UseX64=N ;Should be used for stuff like tagpoint having right struct etc. when running on a 64 bits os ; Run ShellExecute("mobsync.exe") ; Wait 2 seconds for windows explorer to appear. WinWait("Sync Center") IF Not WinActive("{CLASS:CabinetWClass}", "Sync Center") Then WinActivate("{CLASS:CabinetWClass}", "Sync Center") Local $oP7=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Sync Center;controltype:=UIA_WindowControlTypeId;class:=CabinetWClass", $treescope_children) _UIA_Action($oP7,"setfocus") Local $oP6=_UIA_getObjectByFindAll($oP7, "Title:=Sync Center;controltype:=UIA_PaneControlTypeId;class:=ShellTabWindowClass", $treescope_children) _UIA_Action($oP6,"setfocus") Local $oP5=_UIA_getObjectByFindAll($oP6, "Title:=;controltype:=UIA_PaneControlTypeId;class:=DUIViewWndClassName", $treescope_children) _UIA_Action($oP5,"setfocus") Local $oP4=_UIA_getObjectByFindAll($oP5, "Title:=Shell Folder View;controltype:=UIA_PaneControlTypeId;class:=DUIListView", $treescope_children) _UIA_Action($oP4,"setfocus") Local $oP3=_UIA_getObjectByFindAll($oP4, "Title:=Folder View;controltype:=UIA_ListControlTypeId;class:=SysListView32", $treescope_children) _UIA_Action($oP3,"setfocus") Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=Folders (1);controltype:=UIA_GroupControlTypeId;class:=", $treescope_children) _UIA_Action($oP2,"setfocus") Local $oP1=_UIA_getObjectByFindAll($oP2, "title:=Offline Files;ControlType:=UIA_ListItemControlTypeId", $treescope_subtree) _UIA_action($oP1,"setfocus") Local $oUIElement=_UIA_getObjectByFindAll($oP1, "title:=Disconnected;ControlType:=UIA_TextControlTypeId", $treescope_subtree) Local $oUIElement2=_UIA_getObjectByFindAll($oP1, "title:=Sync in progress;ControlType:=UIA_TextControlTypeId", $treescope_subtree) If Local $oUIElement=_UIA_getObjectByFindAll($oP1, "title:=Disconnected;ControlType:=UIA_TextControlTypeId", $treescope_subtree) Then _UIA_action($oUIElement,"setfocus") MsgBox(0, "Warning!", "Disconnected from the network!", 10) ElseIf Local $oUIElement2=_UIA_getObjectByFindAll($oP1, "title:=Sync in progress;ControlType:=UIA_TextControlTypeId", $treescope_subtree) Then _UIA_action($oUIElement,"setfocus") MsgBox(0, "Warning!", "Sync is already in progress!", 10) Elseif $MsgBox = MsgBox(0, "Warning!", "Sync is already in progress!", 10) EndIF
-
IUIAutomation MS framework automate chrome, FF, IE, ....
mycloutier replied to junkew's topic in AutoIt Example Scripts
Trying to click the "Sync All" button inside the Sync Center in windows 7. Simple UIA Spy gives me the following code. The code simply triggers the "Control Panel Home" link .... Any ideas? #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) Local $oP6=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=Sync Center;controltype:=UIA_WindowControlTypeId;class:=CabinetWClass", $treescope_children) _UIA_Action($oP6,"setfocus") Local $oP5=_UIA_getObjectByFindAll($oP6, "Title:=Sync Center;controltype:=UIA_PaneControlTypeId;class:=ShellTabWindowClass", $treescope_children) _UIA_Action($oP5,"setfocus") Local $oP4=_UIA_getObjectByFindAll($oP5, "Title:=;controltype:=UIA_PaneControlTypeId;class:=DUIViewWndClassName", $treescope_children) _UIA_Action($oP4,"setfocus") Local $oP3=_UIA_getObjectByFindAll($oP4, "Title:=Explorer Pane;controltype:=UIA_PaneControlTypeId;class:=HWNDView", $treescope_children) _UIA_Action($oP3,"setfocus") Local $oP2=_UIA_getObjectByFindAll($oP3, "Title:=;controltype:=UIA_PaneControlTypeId;class:=Element", $treescope_children) Local $oP1=_UIA_getObjectByFindAll($oP2, "Title:=;controltype:=UIA_PaneControlTypeId;class:=Element", $treescope_children) Local $oP0=_UIA_getObjectByFindAll($oP1, "Title:=Command Module;controltype:=UIA_ToolBarControlTypeId;class:=FolderBandModuleInner", $treescope_children) ;~ First find the object in the parent before you can do something ;~$oUIElement=_UIA_getObjectByFindAll("SyncAll.mainwindow", "title:=Sync All;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree) Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=Sync All;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree) _UIA_action($oUIElement,"click")