Leaderboard
Popular Content
Showing content with the highest reputation on 06/07/2019 in all areas
-
Local $r = "", $s = "111AB11111111AB11AB111111AB11", $f = "AB" For $i = 1 to StringLen($s) $r &= StringInStr($s, $f, 1, $i) ? StringInStr($s, $f, 1, $i) & @crlf : "" Next Msgbox(0, "", $r)3 points
-
a dirty example: local $str = "111AB11111111AB11AB111111AB11" , $i = 0 , $pos = "" Do $i += 1 $pos &= StringInStr($str , "AB" , 1 , $i) & "," Until stringright($pos , 3) = ",0," msgbox(0 , '' , stringtrimright($pos , 3))3 points
-
... we can still save a few bits Local $str = '111AB11111111AB11AB111111AB11', $key = "AB", $r For $i = 1 To StringSplit($str, $key, 1)[0] - 1 $r &= StringInStr($str, $key, 1, $i) & ',' Next MsgBox(0, '', StringTrimRight($r, 1))2 points
-
How to remove a global variable?
argumentum reacted to Exit for a topic
After some research I found out that it is not possible to remove variables in C ++. You can only set them to "NULL". Therefore, it is probably also not possible in Autoit. I'm used to remove variables in powershell scripts where the command would be: PS> Remove-variable x But the tip of @argumentum can help me further. Thanks.1 point -
How to remove a global variable?
Exit reacted to argumentum for a topic
how about Local Static $var = "x" ?1 point -
How to remove a global variable?
FrancescoDiMuro reacted to BrewManNH for a topic
Because you're redeclaring it as local inside the function every other iteration of the function call, just as I explained above. In the first call to the function, local $x isn't declared, so it's using the Global, the second call to the function is declaring a local variable with the same name so it uses the local. Every time you leave the function, the Local variable is destroyed, so it's no longer declared when you go back into it, until you declare it again. I don't see why that's hard to understand. Strong statement because it's true. Also, my comment had nothing to do with the Opt you used, that's just one way of doing things, that didn't really need to be done, as shown above. The terrible part was the point that you declared a Global inside a function, and then tried to use Global inside your If statement. Also thinking that a local variable will "kill" a global that way isn't killing anything, it's just giving a new value to your Global variable, and won't affect a local variable. This would have worked, but would still have been wrong to do it. If $i= 4 Then Global $x = 0 EndIf But, as the question has been answered, I'll leave it at this.1 point -
I very often use Google Translate. When you are asking for help, in many language, and cultures, you must remember to use words like: could you please how I can do how to btw. We are here very happy to help people, but no one like to give fish, instead of we like to give fishing rod. Edit: So what you have done, so far ?1 point
-
#include <Misc.au3> HotKeySet("{ESC}", "Terminate") Local $dll = DllOpen("user32.dll") Local $i = 0 While 1 If _IsPressed("01",$dll) Then ; Left MouseClick Do $i=$i+1 Send("1") Sleep(250) Until $i=10 ElseIf _IsPressed("0D",$dll) Then ; {Enter} Do $i=$i+1 Send("2") Sleep(250) Until $i=10 EndIf WEnd DllClose($dll) Func Terminate() Exit EndFunc1 point
-
Positions of searchstring in a string
Earthshine reacted to FrancescoDiMuro for a topic
@dolphins Another example with SRE, even if the @iamtheky one is more beautiful #include <StringConstants.au3> Global $strString = "111AB11111111AB11AB111111AB11" MsgBox($MB_ICONINFORMATION, "", _GetStringPositions($strString, "AB")) Func _GetStringPositions($strString, $strSubstring) Local $intOffset, _ $strReturn While 1 StringRegExp($strString, $strSubstring, $STR_REGEXPARRAYMATCH, $intOffset) If @error Then ExitLoop $intOffset = @extended $strReturn &= ($intOffset - StringLen($strSubstring)) & "," WEnd Return StringLeft($strReturn, StringLen($strReturn) - 1) EndFunc1 point -
Your first loop steals focus, so it never gets past that. Remove it.1 point
-
UIAutomation to detect controls that have repeated AutomationID and properties
RadicalKoncepts reacted to junkew for a topic
Ok full example on how to come where you want to be Start calc.exe Start Simplespy Hover on button 1 and press ctrl+w Example for a dutch W10 system ;~ *** Standard code maintainable *** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) _UIA_setVar("oP1","Title:=Rekenmachine;controltype:=UIA_WindowControlTypeId;class:=ApplicationFrameWindow") ;Rekenmachine _UIA_setVar("oP2","Title:=Rekenmachine;controltype:=UIA_WindowControlTypeId;class:=Windows.UI.Core.CoreWindow") ;Rekenmachine _UIA_setVar("oP3","Title:=;controltype:=UIA_GroupControlTypeId;class:=LandmarkTarget") ; _UIA_setVar("oP4","Title:=Numeriek toetsenbord;controltype:=UIA_GroupControlTypeId;class:=NamedContainerAutomationPeer") ;Numeriek toetsenbord ;~ $oUIElement=_UIA_getObjectByFindAll("Een.mainwindow", "title:=Een;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree) _UIA_setVar("oUIElement","Title:=Een;controltype:=UIA_ButtonControlTypeId;class:=Button") ;ControlType:=UIA_ButtonControlTypeId;classname:=Button") ;~ Actions split away from logical/technical definition above can come from configfiles ;~_UIA_Action("oP1","highlight") _UIA_Action("oP1","setfocus") ;~_UIA_Action("oP2","highlight") _UIA_Action("oP2","setfocus") ;~_UIA_Action("oP3","highlight") _UIA_Action("oP3","setfocus") ;~_UIA_Action("oP4","highlight") _UIA_Action("oP4","setfocus") _UIA_action("oUIElement","highlight") ;~_UIA_action("oUIElement","click") Clean up to something like this I leave out the hierarchy of the different parents as mainly mainwindow is needed and leaf in ui hierarchy. If you observe speedissues it can help to put in additional layers of the hierarchy ;~ *** Standard code maintainable *** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) _UIA_setVar("oP1","Title:=Rekenmachine;controltype:=UIA_WindowControlTypeId;class:=ApplicationFrameWindow") ;Rekenmachine _UIA_setVar("oUIElement","Title:=Een;controltype:=UIA_ButtonControlTypeId;class:=Button") ;ControlType:=UIA_ButtonControlTypeId;classname:=Button") ;~ Actions split away from logical/technical definition above can come from configfiles _UIA_Action("oP1","highlight") _UIA_Action("oP1","setfocus") _UIA_action("oUIElement","highlight") _UIA_action("oUIElement","click") And play with instance property #_UIA_setVar("oUIElement","Title:=Een;controltype:=UIA_ButtonControlTypeId;class:=Button") ;ControlType:=UIA_ButtonControlTypeId;classname:=Button") _UIA_setVar("oUIElement","controltype:=UIA_ButtonControlTypeId;instance:=1") ;ControlType:=UIA_ButtonControlTypeId;classname:=Button") And transformed to a full example (hopefully works in different languages of W10 directly) AutoItSetOption("MustDeclareVars", 1) #include "UIAWrappers.au3" Example() Func Example() Local $sp=wingetprocess("[active]") ; Run calc with the window maximized. Local $iPID = Run("calc", "", @SW_SHOWMAXIMIZED) ; Wait for the calc window to appear and be active Local $maxTry=1 while ($sp=wingetprocess("[active]")) and $maxTry <= 10 sleep(1000) $maxTry=$maxTry+1 WEnd ; Wait for 2 seconds. Sleep(2000) Local $calcTitle=wingettitle("[active]") ;~ Declaration of reference definitions could be put in UIA.CFG ;~ [calc] ;~ oP1=Title:=Rekenmachine;controltype:=UIA_WindowControlTypeId;class:=ApplicationFrameWindow ;~ oUIElement=controltype:=UIA_ButtonControlTypeId;instance:=11 ;~ But will do it for demo in coding _UIA_setVar("oP1","Title:=" & $calcTitle & ";controltype:=UIA_WindowControlTypeId;class:=ApplicationFrameWindow") ;Rekenmachine _UIA_setVar("oUIElement","controltype:=UIA_ButtonControlTypeId;instance:=11") ;ControlType:=UIA_ButtonControlTypeId;classname:=Button") ;~ Actions split away from logical/technical definition above can come from configfiles _UIA_Action("oP1","highlight") _UIA_Action("oP1","setfocus") _UIA_action("oUIElement","highlight") _UIA_action("oUIElement","click") ;~ Just a bunch of buttons to highlight using instance property with dynamic description for $i=10 to 34 _UIA_action("controltype:=UIA_ButtonControlTypeId;instance:=" & $i ,"highlight") Next sleep(5000) ; Close the calc process using the PID returned by Run. ProcessClose($iPID) EndFunc ;==>Example1 point -
UIAutomation to detect controls that have repeated AutomationID and properties
RadicalKoncepts reacted to junkew for a topic
Try the concept of index and indexrelative on calc.exe and start new thread in supportforum with example code. In iuiautomation thread you can see examples on treewalkers and uaage of indexrelative. Just search with your editor in the examples.1 point -
UIAutomation to detect controls that have repeated AutomationID and properties
RadicalKoncepts reacted to junkew for a topic
Uiawrappers also have index, instance and indexrelative. So if simplespy highlights the object you just have to tweak description to identify object. Make sure to use latest version from uiawrappers.1 point -
Notify - New version 17 Mar 22
argumentum reacted to Melba23 for a topic
[NEW VERSION] - 26 Apr 19 Added: _Notify_RetractCheck allows the user to determine the retraction method (title clicked/message clicked/timeout) and content (title/message) of the last retracted notification. New UDF and additional example in the zip in the first post. M231 point