Jump to content
SorryButImaNewbie

UDF Add fail in SciTe

Recommended Posts

SorryButImaNewbie

Hello,

I try to add a new UDF to my AutoIT library, and it seems I fail. I started to work following the insturctions found on the wiki . 

I made an extra folder just next to my AutoIT folder, called ExtraUDF, and copied the file CUIAutomation2.au3 in it (I try to use this UDF for automating a program) then I run sciteconfig, set this folder up as User Include Folder, applied the changes, then run the calltip manager and got a msg when I tried to parse it. I attach a few pictures for better present the problem.

I think I miss something here, should i put anything else on the ExtraUDF folder? I dont think that the CallTip manager added the udf to scite, If I try to run it i get a msg saying that I Scite cant open the include file and naturally after that, It can't use the functions called from it.

Thank you for your help and insight as always! Please ask, if anything is fuzzy about the problem

 

AutoIT3 folders.PNG

ExtraUDF.PNG

SciteConfig1.PNG

SciteConfig2.PNG

Trial.PNG

Share this post


Link to post
Share on other sites
Subz

Is UIAWrappers.au3 in the D:\AutoIT\ExtraUDF folder?

  • Like 1

Share this post


Link to post
Share on other sites
SorryButImaNewbie

ohhh.....Ohh... ohhh....

No I only added CUIAutomation2 so far

Share this post


Link to post
Share on other sites
Subz

Also the CUIAutomation2 doesn't have any functions, so call tips aren't going to work, you need to use call tips manager on UIAWrappers.au3 to get these functions.

Share this post


Link to post
Share on other sites
SorryButImaNewbie

Thank you, I added the UIAWrappers.au3 already with no problems.

I'm reading junkew post about how to use it. Its a bit hard but not impossible to follow. I try to get somehandels on the controls the program is using with SimpleSpy or Inspectx64 version, but so far not so good.

once _UIA_setVar has set itslef to oP1,2 etc, shouldn't the above code _UIA_Action part do some given action? (I tried with click, but nothing so far)

Thank you for your help!

(code is from SimpleSpy)

#include <UIAWrappers.au3>
#include <EditConstants.au3>
#include <AutoItConstants.au3>
#include <GUIConstantsEx.au3>
#include <CUIAutomation2.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPI.au3>
#include <Misc.au3>

#AutoIt3Wrapper_UseX64

Opt("TrayIconDebug", 1)
Opt("MustDeclareVars", 1)

consolewrite("*** Some important settings you can find in " & @scriptdir & "\UIA.CFG ***" & @CRLF)
consolewrite("*** " & _UIA_getVersionInfoString() )
consolewrite("*** If logging is turned on you can find it here :" & _UIA_getVar("logFileName") & @CRLF)

_UIA_setVar("oP1","Title:=Program;controltype:=UIA_WindowControlTypeId;class:=Window")  ;Program
_UIA_setVar("oP2","Title:=;controltype:=UIA_CustomControlTypeId;class:=MainView")   ;
_UIA_setVar("oP3","Title:=;controltype:=UIA_CustomControlTypeId;class:=TileNavigationView") ;

;~ $oUIElement=_UIA_getObjectByFindAll(".mainwindow", "title:=;ControlType:=UIA_ImageControlTypeId", $treescope_subtree)
_UIA_setVar("oUIElement","Title:=;controltype:=UIA_ImageControlTypeId;class:=Image") ;ControlType:=UIA_ImageControlTypeId;classname:=Image")

;~ Actions split away from logical/technical definition above can come from configfiles

;~_UIA_Action("oP1","highlight")
_UIA_Action("oP1","click") ;setfocus
;~_UIA_Action("oP2","highlight")
_UIA_Action("oP2","click") ;setfocus
;~_UIA_Action("oP3","highlight")
_UIA_Action("oP3","click") ;setfocus

;~_UIA_action($oUIElement","highlight")
;~_UIA_action($oUIElement,"click")
;~_UIA_action("oUIElement","highlight")
;~_UIA_action("oUIElement","click")

 

Edited by SorryButImaNewbie

Share this post


Link to post
Share on other sites
Subz

Try changing click to highlight it should then show you what op1, op2, op3 is attempting to click on.  Whats the software you're trying to automate?

Share this post


Link to post
Share on other sites
SorryButImaNewbie

Its a software my new company is developing, I try to make an automatic tester program, I'm now able to write code that click on the given coordinates where the controls should be (maxsizeing the window before), so I can technicly make it happen, but I would like to write one that finds the controls in the given window, for A) code don't needs to know coordinates of controls beforhand and B ) I would like to better myself in automatization with AutoIT :)

brb trying your proposed code changes with highlights

Edit: it highlights the softwarewindow and an additional control (language change options) and I think the windows startmenu? trying to look at them with SimpleSpy soon

Edit2: Ohh it should highlight an icon on a button btw :) at least the code I copied from simplespy was highlighted an icon

Edited by SorryButImaNewbie

Share this post


Link to post
Share on other sites
SorryButImaNewbie

I would like to get the controls handels or IDs or something, but so far the controlClick seems not to work, or maybe the coordinates of them, so I can move the mouse there to click on them. Not with predefined coordinates, but the script would find it on its own,

Share this post


Link to post
Share on other sites
Subz

Have you tried Autoit Info Tool?

Share this post


Link to post
Share on other sites
SorryButImaNewbie

Yes, it was my first try, It only saw the main window, nothing else, no control, text, or pictures

Edit:

Then I tried SimpleSpy and Inspector, they seems to find all the relevant controls but I can't act upon their information yet (I don't know the handle or ID or something that I can use, maybe text alone, but that could be problematic). Thats my goal right now, make a click command on a control without mouseclick by found coordinates or handle or title or something. 

It seems a few button can't be found by Inspector/SimpleSpy (fleshy design I guess), but lucky for me these buttons have text or text and pic on them, which can be found, so I think i will be able to click on them in the future.

Edited by SorryButImaNewbie

Share this post


Link to post
Share on other sites
LarsJ
SorryButImaNewbie

Thank you Master LarsJ, I have that very thread open in my browser and to be honest its the source of like 75-85% of my work :)

Inspect (and SimpleSpy) was able to detect every control I will need for the automatization. The only bump is that two pretty important control can't be detected, but the text on them can, so I plan to click on the text, which should translate to a click on the button, right? (since the textbox is on the button or the pic is on the button)

Unfourtunetly, Inspect treeview isnt giving back as a straight forward "clean" view as with the Intel Example and I'm not that experienced (let say this is my second day of using it) with them.

Edit: I post a few pic with the Inspect results momentarly

Edit2: Attaching the returned values of Inspect x64 on an icon of the target software (sorry for the redout, but I have to follow regulations, I think its still usefull)

This is what I get back

InspectResultsOnIcon.PNG

Edited by SorryButImaNewbie

Share this post


Link to post
Share on other sites
LarsJ

If nothing else works then you may want to click with the usual MouseClick command. Calculate the bounding rectangle of the text control and make a MouseClick in the center of the rectangle. See here how to do it. Especially posts 17 - 22.

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

  • Similar Content

    • MFrancisca
      By MFrancisca
      Hello! 
      I've been checking the logging UDFs in the wiki, mostly Log4a and Loga and I wanted to ask which one would you recommend for a script that will be executed remotely through PSExec. My main question is where the logs are located in that situation and if I can change that location to a custom one., because I need to retrieve them at the end of execution.
      So in a rough description the process is
      Open PSExec
      Send compiled AutoIT script to remote machine
      Execute script
      Copy logs from the remote to the local machine.
       
      Any opinions? 
    • timmy2
      By timmy2
      I've noticed in several YouTube tutorials about AutoIt that every time the instructor types EndFunc a comment "<==(function name)" is automatically added. I understand that Tidy will do this after the fact but what I'm writing about happens in real time. Where's the setting for this?  Thank you.
    • caramen
      By caramen
      I watched _OL_ItemSend&_OL_ItemFind&_OL_ItemCreate in OutlookEx UDF but hmmm
       
      Since it use the test environnement i cant get the orders of the mail creation
       
      Can someone make me win some time of reading all exemples script and lead me how to do one ?
      That whould be lovely.
      Gnight
    • ademon
      By ademon
      Hi. I can open the editor with out problems but I can not compile because it is placed on another partition diferent from C.
      Can you provide an update of this bug?


    • Myicq
      By Myicq
      This may be a dumb question.. but my vertical screen space is fairly limited. I don't need (always) to see all the debug output from autoIT compiler, wrapper etc.
      Can I turn this part off: (optionally)
      >"D:\AutoIt3\SciTE\..\AutoIt3.exe" "D:\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "D:\temp\xx.au3" +>11:35:44 Starting AutoIt3Wrapper v.15.920.938.0 SciTE v.3.6.0.0 Keyboard:00000406 OS:WIN_7/Service Pack 1 CPU:X64 OS:X86 Environment(Language:0406) +> SciTEDir => D:\AutoIt3\SciTE UserDir => C:\Users\XXX\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\XXX\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.12.0) from:D:\AutoIt3 input:D:\temp\XX.au3 +>11:35:44 AU3Check ended.rc:0 >Running:(3.3.12.0):D:\AutoIt3\autoit3.exe "D:\temp\xx.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop  
×