Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/06/2018 in all areas

  1. It's a simple and ingenious way to avoid AutoIt crashes in some circumstances. I saw it used by @genius257 in this post: (https://www.autoitscript.com/forum/topic/185387-value-of-js-variable-in-ie/?do=findComment&comment=1332372) and in the first instance I was also perplexed, but in fact that way can save us from unwanted crashes. (see his explanation here) for example, if you want to get a reference to a javascript function you can use this code: $oIE.Document.head.eval but if the function is not yet available in the javascript environment, the above code causes the script to crash. By simply putting the code in the Execute () function, the error is not generated. You can still check if the command was successful by checking if the variable returned by Execute () is an object or not. In this way you can wait painlessly for the javascript function to be available until the returned variable is an object. Here an example of use: ...... ; create a reference to the javascript eval() function $oIE.document.parentWindow.setTimeout('document.head.eval = eval', 0) Do Sleep(250) $jsEval = Execute('$oIE.Document.head.eval') Until IsObj($jsEval) .......
    2 points
  2. But anyway, start by reading the help file, learn the basics, try a few scripts, and let us know if you hit a wall. It is easier for us to help with a base code. And I will be glad to give you a hand.
    1 point
  3. yeah, that is handy too, but since OP didn't ask about it, I never thought of it, but that is way cool
    1 point
  4. @Iulia_Vascan If you want to do all those steps without using UI Automation UDF, you could use the built-in scripting library of Dolomites, through which you can do whatever you want ( even interact with the user combining AutoIt and Python ), as I have already suggested you in PM It is well documented, and it allows you to do whatever you do through UI, and even more. That should be even better than automating the UI
    1 point
  5. No ui stands for user interface as soon as you hide it ts not availabe for x y coordinates etc. The whole concept is around userinteraction. You could hide it when you run a virtual machine or maybe virtual displaydrivers but that are in general complexer solutions.
    1 point
  6. Arlen

    UnHackable HWID protection

    Or you can hash the HWID and not store it as plain text. So even if he gets the HWID list, it hashed. You can google on "how to hash password the right way" and apply the same concept to this.
    1 point
  7. you know you don't have to do all those extra setfocus
    1 point
  8. careca

    File Open File Synthax

    Fileopen with the flag 9 or 10 should work.
    1 point
  9. Solution 1 = regular expression _UIA_setVar("oUIElement","Title:=> Winding.*;controltype:=UIA_ButtonControlType") Soluition 1b use regex plus index property if it recognizes multiple elements Solution 2 use indexrelative which you can use to go n elements further or with -n elements before another known element thats more static in property identification. Solution 3 use string functions to construct your string to recognize. Solution 4 see if the button has an automationid thats static. I doubt as i see its a qtwidget.
    1 point
  10. #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) _UIA_setVar("oP1","Title:=Dolomites;controltype:=UIA_WindowControlTypeId;class:=Qt5QWindowIcon") ;Dolomites _UIA_setVar("oP2","Title:=;controltype:=UIA_CustomControlTypeId;class:=") ; _UIA_setVar("oP3","Title:=;controltype:=UIA_SplitButtonControlTypeId;class:=") ; _UIA_setVar("oP4","Title:=;controltype:=UIA_CustomControlTypeId;class:=") ; _UIA_setVar("oP5","Title:=;controltype:=UIA_CustomControlTypeId;class:=") ; _UIA_setVar("oP6","Title:=;controltype:=UIA_SplitButtonControlTypeId;class:=") ; _UIA_setVar("oP7","Title:=;controltype:=UIA_SplitButtonControlTypeId;class:=") ; _UIA_setVar("oP8","Title:=;controltype:=UIA_TreeControlTypeId;class:=") ; ;~ $oUIElement=_UIA_getObjectByFindAll("Windingn.1Q=242p=4m=3.mainwindow", "title:=Winding n. 1 Q = 24 2p = 4 m = 3;ControlType:=UIA_TreeItemControlTypeId", $treescope_subtree) _UIA_setVar("oUIElement","Title:=Winding n. 1 Q = 24 2p = 4 m = 3;controltype:=UIA_TreeItemControlTypeId;class:=") ;ControlType:=UIA_TreeItemControlTypeId;classname:=") _UIA_action("oUIElement","highlight") _UIA_action("oUIElement","click") so I just used the wizard to create an example, but this worked for me. just type out the name, you may have to create the name using the user input however, I am not sure how you are getting the name. In my case it's Winding n. 1 Q = 24 2p = 4 m = 3 you could build that string with the collected data from the user is what I was trying to say. also, you can double click if by doing this _UIA_action("oUIElement","doubleclick") that easy, works here on my system. let me know if you need more assistance. at this point it is based off number of phases (m=3) Number of slots (Q=24) and the winding number, which is just increaing. Look at the string functions to build strings for use with the IUI kit you should be able to get those values easily
    1 point
  11. MvL

    Excel Book Attach Problem...

    First: Ok, but when I was still editing a cell in the .xls (in the formula bar of using F2) and then opened the workbook in Excel (went Ok) and then tried to do something with the workbook, only at that moment I got a message 'The requested action with this object has failed'. It happened to me several times, it is not the code that was in error. Below is put a piece of code, to show how I prevented the message ''The requested action with this object has failed'' from the Excel error handling function from firing, and check on this specific error. Second: I don't want my script to behave unexpected, and autosave on a .xls that is stored on a network disc often takes a lot of time, leaving me wondering why that is. So I disable the autosave, before I run. Third: Yes, this is much the same, but when I have al long run, I sometimes want to see the progress (I update my .xls in the run), so I start with a minimized window, and I can restore or maximize the window to 'be in touch', and minizmize it back again for speed. With ScreenUpdate = False, I don't have that option. Piece of code to find out that the .xls is Not Ready AutoItSetOption("MustDeclareVars", 1) ; 0=No, 1=Variables must be declared. Local $x_oMyError Local $o_Result, $PathArr, $ExcelFilename Local $s_string = "C:\yy.xls" ; Already open, or to be opened. $x_oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ; Initialize a COM error handler $o_Result = ObjGet($s_string) If @error Then MsgBox(4096, "Error", @error) Else If Not IsObj($o_Result) Then MsgBox(4096, "Error in .xls", $s_string & " does not exist") Else If Not $o_Result.Application.Ready Then MsgBox(4096, "Error", "The Excel Application has not started, Excel is not ready because you are editing in a cell.") Exit EndIf $o_Result.Windows(1).Visible = 1; Set the worksheet in the workbook visible $o_Result.Application.Visible = 1; Set the application visible $PathArr = StringSplit($s_string, "\") $ExcelFilename = $PathArr[$PathArr[0]] If $o_Result.Application.Activewindow.Caption <> $ExcelFilename Then $o_Result.Application.Windows($ExcelFilename).Activate ; point to this Excel file EndIf EndIf EndIf Exit
    1 point
  12. No such luck. I switched it to cdecl and tried multiple combinations of different index integers as well as adding a struct with char and wchar and I still get the same results with autoit crashing. Is there some sort of way to get back an error message from the crash to see what could cause it?
    0 points
×
×
  • Create New...