Search the Community
Showing results for tags 'execute'.
-
Local $a = 1 Local $v = Execute("$a+1") ; $v is set to 2 I've been wondering if there's something similar to Execute that would work with function names, something like: Func _IncrementNumber($thisnumber) Return $thisnumber + 1 EndFunc Local $Number = 10 Local $IncrementedNumber = ExecuteFunction("_IncrementNumber", $Number) ; $IncrementedNumber becomes 11 I haven't found anything similar to "ExecuteFunction" in the docs.
-
I am trying to figure out why my mouse move does not end up in the same spot as the test version I am on the struggle bus. (Both Examples below) #include <IE.au3> Local $xWidth = 2 Local $xHeight = 2 Local $vOperator = '/' Local $oIE = _IE_Example("form") Local $oForm = _IEFormGetObjByName($oIE, "ExampleForm") Local $oTextArea = _IEGetObjByName($oForm, "imageExample") Local $iScreenX = _IEPropertyGet($oTextArea, "screenx") Local $iScreenY = _IEPropertyGet($oTextArea, "screeny") Local $iWidth = _IEPropertyGet($oTextArea, "width") Local $iHeight = _IEPropertyGet($oTextArea, "height") Local $iMousespeed = 20 MouseMove($iScreenX + $iWidth / 2, $iScreenY + $iHeight / 2, $iMousespeed) ;Test Example ;;MouseMove(Execute(($iScreenX + $iWidth) & $vOperator & $xWidth), Execute(($iScreenY + $iHeight) & $vOperator & $xHeight), 25) ;My Example
-
Hi, I have a software which has a 'run file'-ie; when i double click on that file, the input file of the software is run by the software. I wish to double click/execute this run file using autoit. how do i achieve this. i opened the software and it shows the input file and run file in same folder, i will put my autoitscript file too in same location. how do i simulate double clicking the run file (using its file name, say - abc.run ). I entered the following lines to make software window active - it became active, dont know how to go forward Winactivate("program title") winwaitactivate("program title") controlclick("program title","abc.run",1000,"primary",2) ; 1000 is ctrl id
- 2 replies
-
- third party software
- execute
-
(and 1 more)
Tagged with:
-
Hello, following my previous question, I have moved all potentially instable object interactions into Executes. But it Looks like "="-assignments to object Attributes cannot be done with Execute, only method calls. Using an "$obj = 1" construct, it compares (Eval) instead of sets (Execute) the value. I have tested multiple different combinations, using Execute and Assign, but it seems not to work with object Attributes. :-( Gives following Output: The assign Action using apply (a3) Fails, while assigning it directly, without Assign() works fine. The execute versions compare and do not assign, in both cases. Though, the "Execute" topic in the help file says it executes, not evaluates. I have found a similar, old thread, which explains this behavious but does not give a solution. https://www.autoitscript.com/forum/topic/110228-pass-object-property-as-a-variable/ Is there a way to assign to a com object's Attribute? Or is there anything new to this unexpected behaviour of Execute (at least compared to the help file description and Python's exec). Any help is appreciated, and thank you for all the help so far. Regards, Michael
-
Hi I am trying to insert line numbers in to a string with this script Func _MyInc () Static Local $i = 0 $i += 1 Return $i EndFunc Exit _InsertLines() Func _InsertLines() $String = "A" & @CRLF & "B" & @CRLF & "C" & @CRLF & "D" $NewString = Execute("'" & StringRegExpReplace($String,"[\r\n]*", "' & _MyInc () & '\1" ) & "'") MsgBox (0, "", $NewString) EndFunc but I get this: 1A23B45C67D8 I never really could master how Execute works here and I always get some working example and make substitutions. But this is the closest i could get...
- 12 replies
-
- stringregexpreplace
- execute
-
(and 1 more)
Tagged with:
-
hi I'm trying to execute files I want it to run in order. for instance, if there's folder like below, I want to run 1.exe > 2.exe > 3.exe root folder |___folder 1 > 1.exe |___folder2 > 2.exe |___folder3 > 3.exe What I did to do the above, was to make a text file that contains the path to each of those files and put those in array form. but copying and pasting every path of those files into a text file is very exhausting thing to do when there's like hundreds of files to execute. So I was wondering if there is a simple way to run those files. I'd be thankful if anybody answers it.
-
Is there a way to execute the text inside a variable is if it was part of the script? In this example I'd like to get a message box pop up but I don't: ;testme.au3 local $var = 'msgbox(64,"hello","world")' $var is there a command that can be used like maybe 'Exec' or 'Execute' or something? local $var = 'msgbox(64,"hello","world")' Execute $var
-
Hello, I need to assign data to array: Global $Test[3][4] $Array = "Test" SetArrayData($Array,"Hello world!",1,3) ConsoleWrite($Array[1][3]&@CRLF) Exit Func SetArrayData($Array,$Data,$1,$2) $Array[$1][$2] = $Data; <-- ??? EndFunc I need that somebody would help me with that function
-
Hi All, I've got a script setup to drop a program into a temp folder and then run it from there, but I have mixed results, the Run() command will work on some computers but not others. The file will be placed into the temp folder in all cases. Running AutoIT 3.3.14.0. The computers are all either Win 7 or 8.1, x64 (exe is compiled to x64 too), UAC is off, all have local admin rights - if I've missed something ask and I'll update the details. If Not FileExists (@TempDir & "\HCTB") Then DirCreate(@TempDir & "\HCTB") FileInstall("G:\IT\Downloads\TB\12.0.45471\Host\TB_Setup-sif7r8pgcq.exe", @TempDir & "\HCTB\TB_Setup-sif7r8pgcq.exe", 1) Local $iPID = Run(@TempDir & "\HCTB\TB_Setup-sif7r8pgcq.exe", "") Any suggestions? Thanks!
-
Greetings y'all, While tracing an issue flagged by user MagicSpark here: I came across this puzzling AutoIt behaviour: Seterror(1) If @error Then Beep(1111,100) ; this works Seterror(1) If Execute('@error') Then Beep(1111,100) ; this fails Now I'm not sure whether this should be considered a bug or a feature. I presume Execute starts by resetting @error (and @extended) and updates it with a non-zero error code when something fails along the way. Trouble is, this makes evaluation of @error's origiinal content within an Execute envelope impossible, thereby breaking my decryption (see my CodeCrypter thread). The example above is of course just for illustration, but in Codecrypter any line containing @error no longer works (always returns zero for successful Execute). In the absence of "onError' or some form of previous-error logging facilities, would it be possible to preserve the state of @error and @extended (for example, through internal tempvars) inside the Execute handling itself just sufficiently long for actual evaluation to be possible? I realise this is a bit of a chicken-and-egg situation, but before I code up an elaborate work-around in CodeCrypter, I'd like to check with you devs whether a simple fix would resolve this. Thanks for looking into this, RT
-
I don't know if it has been done before But Here is a CMD version of Autoit. source code now available #NoTrayIcon #region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=..\..\..\..\Desktop\Autoit CMD.exe #AutoIt3Wrapper_Res_Description=Command Line Interpreter for Autoir3 #AutoIt3Wrapper_Res_Fileversion=1.0.0.0 #AutoIt3Wrapper_Res_LegalCopyright=Sycam Inc #AutoIt3Wrapper_Res_requestedExecutionLevel=highestAvailable #AutoIt3Wrapper_Run_AU3Check=n #AutoIt3Wrapper_Run_Tidy=y #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** ;#AutoCMD.au3#================================== ;File Name.......:AutoCMD.au3 ;Creator.........:sean.campbell7 ;Created with....:Created with ISN AutoIt Studio ;Version.........:0.95 BETA ;============================================= #include <console.au3> #include <array.au3> #include <file.au3> #include <string.au3> Local $CharSet = "qwertyuiopasdfghjkzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890_" Assign("$cd", @UserProfileDir, 2) Cout('Welcome to the Autoit Command line interpreter' & @LF) While 1 _CMD() WEnd Func _CMD() Local $cmd Cout(">>") Cin($cmd) $exe = DoCmd($cmd) If $exe = '' Then $exe = "Null" ElseIf StringInStr($exe, "-ret") Then Return Cout(StringReplace($exe, "-ret", '')) EndIf Cout('Ret:' & $exe & @LF) EndFunc ;==>_CMD Func DoCmd($cmd) If StringLeft($cmd, 1) = "$" Then $var = StringLeft($cmd, StringInStr($cmd, "=") - 1) $icmd = StringReplace(StringTrimLeft($cmd, StringInStr($cmd, "=")), " ", '') $exe = _Execute($icmd) Assign(StringReplace($var, ' ', ''), $exe, 2) Return $exe ElseIf $cmd = "exit" Then Exit Else Return _Execute($cmd) EndIf EndFunc ;==>DoCmd Func About() $ret = "Name....: Autoit Console" & @LF & _ "Creator.: Sycam Inc (sean Campbell)" & @LF & _ "Version.: 1.1" & @LF & _ "About...: Command line interpreter For AutoIt3-ret" & @LF Return $ret EndFunc ;==>About Func _Execute($icmd) Local $cmd = $icmd Local $varpos[1][2] Local $vars[1] Local $str_3[1][2] $str_1 = _StringGetSub($cmd, '"') For $i = 0 To UBound($str_1) - 1 If $str_1[$i] <> '' Then $rep = _StringRepeat(';', StringLen($str_1[$i])) $cmd = StringReplace($cmd, '"' & $str_1[$i] & '"', $rep) ReDim $str_3[UBound($str_3) + 1][2] $str_3[UBound($str_3) - 1][0] = $rep $str_3[UBound($str_3) - 1][1] = '"' & $str_1[$i] & '"' EndIf Next $str_2 = _StringGetSub($cmd, "'") For $i = 0 To UBound($str_2) - 1 If $str_2[$i] <> '' Then $rep = _StringRepeat(';', StringLen($str_2[$i])) $cmd = StringReplace($cmd, "'" & $str_2[$i] & "'", $rep) ReDim $str_3[UBound($str_3) + 1][2] $str_3[UBound($str_3) - 1][0] = $rep $str_3[UBound($str_3) - 1][1] = "'" & $str_2[$i] & "'" EndIf Next For $i = 1 To _StringGetOccurances($cmd, "$") $chars = StringMid($cmd, StringInStr($cmd, "$", 0, $i) + 1) ReDim $vars[UBound($vars) + 1] $vars[UBound($vars) - 1] = "$" For $x = 1 To StringLen($chars) $chr = StringMid($chars, $x, 1) If StringInStr($CharSet, $chr) Then $vars[UBound($vars) - 1] &= $chr Else ExitLoop EndIf Next Next For $i = 1 To UBound($vars) - 1 $cmd = StringReplace($cmd, $vars[$i], &"'" Eval($vars[$i]) & "'") Next Local $x = 0 For $i = 1 To UBound($str_3) - 1 Do $x += 1 $cmd = StringReplace($cmd, $str_3[$i][0], $str_3[$i][1], 0, $x) Until $x >= UBound($str_3) - 1 Next Return Execute($cmd) EndFunc ;==>_Execute Func CmdPad($icmd) Local $cmd = StringReplace($icmd, "'", '"') Local $varpos[1][2] Local $vars[1] Local $str_3[1][2] $str_1 = _StringGetSub($cmd, '"') For $i = 0 To UBound($str_1) - 1 If $str_1[$i] <> '' Then $rep = _StringRepeat(';', StringLen($str_1[$i])) $cmd = StringReplace($cmd, '"' & $str_1[$i] & '"', $rep) ReDim $str_3[UBound($str_3) + 1][2] $str_3[UBound($str_3) - 1][0] = $rep $str_3[UBound($str_3) - 1][1] = '"' & $str_1[$i] & '"' EndIf Next $str_2 = _StringGetSub($cmd, "'") For $i = 0 To UBound($str_2) - 1 If $str_2[$i] <> '' Then $rep = _StringRepeat(';', StringLen($str_2[$i])) $cmd = StringReplace($cmd, "'" & $str_2[$i] & "'", $rep) ReDim $str_3[UBound($str_3) + 1][2] $str_3[UBound($str_3) - 1][0] = $rep $str_3[UBound($str_3) - 1][1] = "'" & $str_2[$i] & "'" EndIf Next For $i = 1 To _StringGetOccurances($cmd, "$") $chars = StringMid($cmd, StringInStr($cmd, "$", 0, $i) + 1) ReDim $vars[UBound($vars) + 1] $vars[UBound($vars) - 1] = "$" For $x = 1 To StringLen($chars) $chr = StringMid($chars, $x, 1) If StringInStr($CharSet, $chr) Then $vars[UBound($vars) - 1] &= $chr Else ExitLoop EndIf Next Next For $i = 1 To UBound($vars) - 1 $cmd = StringReplace($cmd, $vars[$i], &"'" Eval($vars[$i]) & "'") Next Local $x = 0 For $i = 1 To UBound($str_3) - 1 Do $x += 1 $cmd = StringReplace($cmd, $str_3[$i][0], $str_3[$i][1], 0, $x) Until $x = UBound($str_3) - 1 Next system($cmd) Return "-ret" EndFunc ;==>CmdPad Func CD($dir = '') If FileExists(Eval("$cd") & "\" & $dir) And StringInStr(FileGetAttrib(Eval("$cd") & "\" & $dir), "d") Then Assign("$cd", Eval("$cd") & "\" & $dir) Return Eval("$cd") ElseIf FileExists($dir) And StringInStr(FileGetAttrib($dir), "d") Then Assign("$cd", $dir) Return Eval("$cd") EndIf Return Eval('$cd') EndFunc ;==>CD Func Dir($dir = 0, $filter = '*') If $dir = '0' Then $dir = Eval("$cd") EndIf $a = _FileListToArray($dir, $filter) Cout($dir & @LF) For $i = 1 To UBound($a) - 1 Sleep(10) Cout(@TAB & "|- " & $a[$i] & @TAB & FileGetAttrib($dir & "\" & $a[$i]) & @LF) Next Return "-ret" EndFunc ;==>Dir Func Repeat($Func, $times = 1) Local $tz For $i = 0 To $times - 1 $tz &= DoCmd($Func) & @LF Next Return StringTrimRight($tz, 1) & @LF & "-ret";remove last line feed EndFunc ;==>Repeat Func Echo($text) Cout($text & @LF) Return "-ret" EndFunc ;==>Echo Func NSLookUp($ip) RunWait(@SystemDir & '\NSLookUp.exe "' & $ip & '"') Return ' ' EndFunc ;==>NSLookUp Func RunSelf() If @Compiled Then Return Run(@ScriptFullPath) Else Return Run(@AutoItExe & ' "' & @ScriptFullPath & '"') EndIf EndFunc ;==>RunSelf Func _StringGetPos($string, $iStart, $iEnd) Return StringLeft(StringTrimLeft($string, $iStart), $iEnd) EndFunc ;==>_StringGetPos Func _StringReplacePos($string, $iStart, $iEnd, $value) $st = StringMid($string, 0, $iStart) $en = StringMid($string, $iEnd) Return $st & $value & $en EndFunc ;==>_StringReplacePos Func _StringGetSub($string, $iDelim = '"') Local $ret[1] Local $i = 1, $l Do $l = StringTrimLeft($string, StringInStr($string, $iDelim, 0, $i)) $l = StringLeft($l, StringInStr($l, $iDelim) - 1) $i += 2 ReDim $ret[UBound($ret) + 1] $ret[UBound($ret) - 1] = $l Until $i >= _StringGetOccurances($string, $iDelim) _ArrayDelete($ret, 0) Return $ret EndFunc ;==>_StringGetSub Func _StringGetOccurances($string, $iDelim) $lo = StringSplit($string, $iDelim) Return $lo[0] EndFunc ;==>_StringGetOccurances Func Help() $ret = 'This is the Autoit Command line interpreter it has most of the standart AutoIt3 commands.' & @LF & _ "however the following functions don't work:" & @LF & _ 'tcpaccept' & @LF & _ 'tcpclosesocket' & @LF & _ 'tcpconnect' & @LF & _ 'tcplisten' & @LF & _ 'tcpnametoip - however there is NSLookUp' & @LF & _ 'tcprecv' & @LF & _ 'tcpsend' & @LF & _ 'tcpshutdown' & @LF & _ 'tcpstartup' & @LF & _ 'DllStructCreate' & @LF & _ 'DllStructGetData' & @LF & _ 'DllStructGetSize' & @LF & _ 'DllStructGetSize' & @LF & _ 'DllStructSetData' & @LF & _ 'And anything that uses an Array' & @LF & _ 'For further help go to www.autoitscript.com' & @LF & _ 'the command line version of autoit dose have some extra commands such as' & @LF & _ 'Repeat("command",times) - will Repeat any command' & @LF & _ 'RunSelf() - open a new instance of Autoit Command line interpreter' & @LF & _ 'Echo("text") - Prints text to console. however putting somthing as a string will do the same' & @LF & _ 'About() - prints information about Autoit Command line interpreter' & @LF & _ 'Clear() - Clears Autoit Command line interpreter' & @LF & _ 'Dir(dir = $cd) - Lists a directory' & @LF & _ 'Cd(dir) - sets the current directory (same as cmd''s cd)' & @LF & _ 'CmdPad("comand"&$variable) - executes a CMD DOS command' & @LF & _ 'For further help go to www.autoitscript.com' & @LF & _ "Autoit Command line interpreter is baced on Sycam Inc's _Execute function-ret" & @LF Return $ret EndFunc ;==>Help Func Clear() ;clears termanal system("cls") Return "-ret" EndFunc ;==>Clear i would add screen shots but the forums don't like embedded images from Google drive Autoit CMD.zip
-
Hey everyone, I was wondering if there was a way to use ConsoleWrite() to execute a command? I am looking to execute a command from an AutoIt program (a console app in this case), within the same shell as said AutoIT program was launched. ConsoleWrite() seemed to be the closest command available, as it writes directly to the StdOut stream. Perhaps there is an other command that I am ignorant of however, such as a way to use Run() to write to the same stream as ConsoleWrite()? As always, any help is much appreciated!
- 1 reply
-
- console
- ConsoleWrite
-
(and 3 more)
Tagged with: