Leaderboard
Popular Content
Showing content with the highest reputation on 03/26/2020 in all areas
-
Majority of users of AutoIt language likes it because it's easy to learn and very powerful when it comes to automating some basically very complicated stuff on windows. AutoIt often does it in just one line of code while doing it in other languages would be writing a full book of code. How to use AutoIt with other languages? One way would be to use AutoItX. Dll version of AutoIt. In this case you can access it through COM or exported functions. Downside surely is limited number of available functions and user rights for COM option. Other way is... no wait, there is no other way. But, what If I add some magic salt to the soup? Let's say I use some of the code from (thanks Manadar) and, yes you guessed AutoItObject, and make a simple (the most basic) COM server that exports almost the whole AutoIt functionality to anyone wanting to use it. AutoItObject 1.2.8.0 makes objects published to ROT (running object table) more accessible than ever. Accessing the object is as easy as GetObject(...) in any scripting language and CoGetObject() through Windows API. An example of VBS would be: Javascript could be: C# PowerShell (based on ptrex's example) Python (AdmiralAlkex) ...and so on. Server script is really minimalistic: All packed in ZIP: AccessAutoIt.zip What you'll find there is folder named AccessAutoIt. Unzip it somewhere and inside there will be five files: AutoItObject.au3 (1.2.8.0), AutoItServer.au3, Csharp.cs, JS.js and VBS.vbs. Run AutoItServer.au3 and then either vbs or js script or compile Csharp.cs and run resulting executable. I have chosen AutoIt.Application object moniker for no particular reason. Can be anything. Latest AutoItObject, if you want the whole thing, is here. AutoIt on your palm. edit: Added c# example. Don't mind about my usage of other languages. I'm not quite familiar with them.1 point
-
27 November 2019: Uploaded a new SciTe4AutoIt3.exe v19.1127.1402.0 installer. This version contains the new SciTE 4.2.0 version. Check below for all other updates to the included utilities. ==> SciTE4AutoIt3 v19.1127.1402.0 Enjoy, Jos Addition/Changes/Fixes in the current installer: -------------------------------------------------------------------------------------------------- 27-11-2019 *** Merged the SciTE v 4.2.0 by Neil Hodgson with our own version of SciTE. (Jos) *** Updated AutoIt3Wrapper v19.1127.1402.0 (Jos) - 19.102.1901.1 added encoding retrieval for UTF8/ANSI files so they are properly written back - 19.102.1901.2 Exit script with 999 when update resource copy failed . - 19.102.1901.3 Fix incrementing version number now before running au3stripper to ensure it contains the new version when increment before is requested. - 19.102.1901.4 increment version before au3stripper when increment before is Y - 19.102.1901.5 also update fileversion info in case of a3x compile when requested. - 19.102.1901.7 change au3check and tidy stop on error logic to allow for other editor programs. - 19.102.1901.8-11 Changes to allow the program to be run by other editors. - 19.102.1901.12 Updates Stop and Restartconsole message to indicate in case the HotKeys aren't set in case of second instance HotKeys are ony set when the Editor program has the focus to allow for multiple instances. - 19.102.1901.13 Updated _RefreshSystemTray, which wasn't working anymore since a long time - 19.102.1901.14 Added WinClose for the Shelled Script to nicely close that process before ultimately killing it when still needed. *** Updated Au3Stripper v19.1127.1402.0 (Jos) - 19.102.1901.2 Fixed not removing #pragma lines from Included files. - 19.102.1901.5 Fixed ternary stripping issue *** Updated SciTEConfig v19.1127.1402.0 (Jos) - 19.524.1057.1 Fixed creation of includes.txt in userdir and added some extra logging for adding includes to includes.txt - Some small updates to standard themes. *** Updated Tidy v19.1127.1402.0 (Jos) - 19.524.1057.1: Fix tidy issue adding space after closing > on #include statement. -------------------------------------------------------------------------------------------------- ==> ScitillaHistory page containing all SciTE-Scintilla updates. ==> Visit the SciTE4AutoIt3 Download page for the latest versions ==> Check the online documentation for an overview of all extra's you get with this installer.1 point
-
A ByRef argument to a function can be modified by its code and doesn't have to be returned explicitely: the calling code will see the changed variable. Look at the helpfile again: this function doesn't return the reversed array, the passed array is reversed on place. Read also about ByRef.1 point
-
[SOLVED] WMI Object low speed
argumentum reacted to Colduction for a topic
Thanks to @Subz about his old comment on my blocked account I measured his codes by calling 2000 times, it's faster than netapi32.dll and WMI objects: #Fastest Function: "_GetAccountName" 1) "_GetAccountName" time elapsed: (359.1129) ms ; @Subz codes 2) "netGetJoinInfo" time elapsed: (2304.4145) ms1 point -
you just have to get this loop out of the switch... or put it in a case1 point
-
You need to modify the statements around the switch statement: $aSecNames = IniReadSectionNames("agendaprueba3.ini") For $i = 2 To UBound($aSecNames) GUICtrlSetData($List1, $aSecNames[$i - 1]) Next $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $ButtonExit2 Exit2() Case $List1 $sDateAutoLoad = GUICtrlRead($List1) $sDateManual = IniRead("agendaprueba3.ini", $sDateAutoLoad, "Manual Date", "None") $sTimeManual = IniRead("agendaprueba3.ini", $sDateAutoLoad, "Manual Time", "None") $sInOut = IniRead("agendaprueba3.ini", $sDateAutoLoad, "In/Out", "None") $sInter = IniRead("agendaprueba3.ini", $sDateAutoLoad, "Interlocutor", "None") $sIssue = IniRead("agendaprueba3.ini", $sDateAutoLoad, "Issue", "None") $sRemarks = IniRead("agendaprueba3.ini", $sDateAutoLoad, "Remarks", "None") GUICtrlSetData($LabelsDateAutoLoad, $sDateAutoLoad) GUICtrlSetData($LabelsDateManual, $sDateManual) GUICtrlSetData($LabelsTimeManual, $sTimeManual) GUICtrlSetData($LabelsInOut, $sInOut) GUICtrlSetData($LabelsInter, $sInter) GUICtrlSetData($LabelsIssue, $sIssue) GUICtrlSetData($LabelsRemarks, $sRemarks) EndSwitch1 point
-
27 November 2019: Uploaded a new SciTE4AutoIt3.exe v19.1127.1402.0 installer.
seadoggie01 reacted to mLipok for a topic
I think I found it out by myself, where the issue was .... In my thinking. I have several of my own UDF and this @ScriptLineNumber macro was used in one of this UDF. Now I know I was wrong because I forgot that XXX is the master script linenumber and because of this XXX for UDF is not given. But I want to ask if you can add a feature which will add "UDFNAME_XXX/YYY" or something like this. ?1 point -
[SOLVED] WMI Object low speed
argumentum reacted to Colduction for a topic
Yeah i know @argumentum, i've called them for 500 times1 point -
[SOLVED] WMI Object low speed
Colduction reacted to argumentum for a topic
took 2 ms in my PC. 600 ms. is very slow for a Netapi32.dll call.1 point -
[SOLVED] WMI Object low speed
argumentum reacted to Colduction for a topic
Thanks @argumentum, that code is very speedy. i measured and compared that with _GetLocalGroupName() by calling 500 times and results was amazing!: #Fastest Function: "netGetJoinInfo" 1) "_GetLocalGroupName" time elapsed: (8836.4114) ms 2) "netGetJoinInfo" time elapsed: (601.2863) ms But it's not what i want, it's just similar, anyway thanks for your comment ❤1 point -
[SOLVED] WMI Object low speed
Colduction reacted to argumentum for a topic
https://www.autoitscript.com/forum/topic/117800-solved-get-the-workgroup-name/?do=findComment&comment=8203121 point -
controlclick
Earthshine reacted to Danp2 for a topic
You may need to look into UIAutomation since the standard command aren't working for you.1 point -
Find Administrator and Guest username
Colduction reacted to Subz for a topic
Another way: #include <Security.au3> Global $g_aComputerSID = _Security__LookupAccountName(@ComputerName) If @error Then Exit ConsoleWrite(_GetAccountName($g_aComputerSID[0] & "-500") & @CRLF) ;~ Administator Account SID ConsoleWrite(_GetAccountName($g_aComputerSID[0] & "-501") & @CRLF) ;~ Guest Account SID Func _GetAccountName($_sAccountSID) Local $aAccountSID = _Security__LookupAccountSid($_sAccountSID, @ComputerName) Local $sAccoutName = @error = 0 And IsArray($aAccountSID) ? $aAccountSID[0] : "" Return $sAccoutName EndFunc1 point -
Communication between 2 scripts
seadoggie01 reacted to argumentum for a topic
...looking around found this posting and tried the DDE. Found that it does not like the server example compiled as 64 bit. The client example work compiled as 32 and 64bit. I don't know anything about DLL calls. Could you fix the UDF to make it 64bit friendly ? Thanks ( the emoji is to manipulate you emotionally into doing it )1 point -
There has been many questions about using tesseract of late. Here is a very basic example which works for me, along with the exact version of standalone tesseract executable and English language data used I found it some time ago at a time I thought I needed it, I do not recall from where. $ImageToReadPath = @ScriptDir & "\image.bmp" $ResultTextPath = @ScriptDir & "\Result" $OutPutPath = $ResultTextPath & ".txt" $TesseractExePath = @ScriptDir & "\Tesseract.exe" ShellExecuteWait($TesseractExePath, '"' & $ImageToReadPath & '" "' & $ResultTextPath & '"', "", "", @SW_HIDE) If @error Then Exit MsgBox(0, "Error", @error) EndIf MsgBox(0, "Result", FileRead($OutPutPath)) FileDelete($OutPutPath)Some Answers: The files contained in the download, only support English language. From the only documentation I got with this version... Original Binaries and Source can be found here: http://code.google.com/p/tesseract-ocr/I do not know where to get other languages support. I do not know if there is a later standalone version. I do not know why it does not read your image accurately. It does not have a virus in it. You can search the forums or internet to learn how to create / cut / copy / paste, or otherwise manipulate your own images. TesseractExample.zip1 point
-
AutoIt Script-o-matic
Colduction reacted to Jon for a file
26,019 downloads
This is the AutoIt's version of Microsoft Scriptomatic tool by SvenP. If you don't know what Scriptomatic is, see: http://www.microsoft.com/technet/scriptcen...s/scripto2.mspx This version is written in AutoIt script AND it produces an AutoIt script ! Requirements: - AutoIt version 3.1.1.8 (or higher) - Some knowledge about WMI Have fun!1 point -
I've had a personal UDF similar to this one for some time that I was fond of, which only returned the stdout and stderr text from a command, because it's a hassle to set it up every time you want capture stdout data. And then MHz's _ProcessOpenHandle() and _ProcessGetExitCode() hit the forum, and I just had to incorporate that functionality. I think it's pretty useful at this point, so I thought I'd share it. Just be aware that it returns the stdout and stderr values with blank lines removed and tab delimited, so if that's not something you feel like dealing with, well, then change it. No includes are required. Also, it (necessarily) waits until the command is finished, similar to RunWait. Below I've written another function checkNet, which utilizes the UDF. Let me know what you think, and please point out any bugs that I missed. Edit: Added mrRevoked's changes, so you can pick a delimiter other than @tab, and optionally have it return one of the items in the array, instead of the array itself. Much more flexible, thanks mrRevoked. Edit: ptrex pointed out that it wouldn't run tasklist. It seemed to be hanging on the While ProcessExists loop, though I don't know why. So I took that out, and placed the exit code determination after the stdout and stderr reads. It runs now, and quite a bit faster too! Edit: Updated for 3.2.10.0. (Hey thanks for the kudos, flyingboz!) ;example single item return mode usage - by mrRevoked MsgBox(0,'Ipconfig...',_RunReadStd("ipconfig",0,@WorkingDir,0,1,@LF)) ; example array mode usage if checknet("localhost") then ; do stuff! EndIf func checknet($server) ConsoleWrite("Active network adapter?... ") local $aOutput = _RunReadStd("ipconfig") ;$aOutput[1] now contains the StdOut from ipconfig, so the idea here is that ;if your network cable is unplugged, ipconfig will not list a subnet mask: if not stringinstr($aOutput[1],"255.") then ConsoleWrite("FAIL" & @crlf) return false Else ConsoleWrite("PASS" & @crlf) EndIf ConsoleWrite("Checking server connection... ") if not ping($server) then ConsoleWrite("FAIL" & @crlf) return False Else ConsoleWrite("PASS" & @crlf) EndIf return true EndFunc ;=============================================================================== ; ; Function Name: _RunReadStd() ; ; Description:: Run a specified command, and return the Exitcode, StdOut text and ; StdErr text from from it. StdOut and StdErr are @tab delimited, ; with blank lines removed. ; ; Parameter(s): $doscmd: the actual command to run, same as used with Run command ; $timeoutSeconds: maximum execution time in seconds, optional, default: 0 (wait forever), ; $workingdir: directory in which to execute $doscmd, optional, default: @ScriptDir ; $flag: show/hide flag, optional, default: @SW_HIDE ; $sDelim: stdOut and stdErr output deliminter, optional, default: @TAB ; $nRetVal: return single item from function instead of array, optional, default: -1 (return array) ; ; Requirement(s): AutoIt 3.2.10.0 ; ; Return Value(s): An array with three values, Exit Code, StdOut and StdErr ; ; Author(s): lod3n ; (Thanks to mrRevoked for delimiter choice and non array return selection) ; (Thanks to mHZ for _ProcessOpenHandle() and _ProcessGetExitCode()) ; (MetaThanks to DaveF for posting these DllCalls in Support Forum) ; (MetaThanks to JPM for including CloseHandle as needed) ; ;=============================================================================== func _RunReadStd($doscmd,$timeoutSeconds=0,$workingdir=@ScriptDir,$flag=@SW_HIDE,$nRetVal = -1, $sDelim = @TAB) local $aReturn,$i_Pid,$h_Process,$i_ExitCode,$sStdOut,$sStdErr,$runTimer dim $aReturn[3] ; run process with StdErr and StdOut flags $runTimer = TimerInit() $i_Pid = Run($doscmd, $workingdir, $flag, 6) ; 6 = $STDERR_CHILD+$STDOUT_CHILD ; Get process handle sleep(100) ; or DllCall may fail - experimental $h_Process = DllCall('kernel32.dll','ptr', 'OpenProcess','int', 0x400,'int', 0,'int', $i_Pid) ; create tab delimited string containing StdOut text from process $aReturn[1] = "" $sStdOut = "" While 1 $sStdOut &= StdoutRead($i_Pid) If @error Then ExitLoop Wend $sStdOut = StringReplace($sStdOut,@cr,@tab) $sStdOut = StringReplace($sStdOut,@lf,@tab) $aStdOut = StringSplit($sStdOut,@tab,1) for $i = 1 to $aStdOut[0] $aStdOut[$i] = StringStripWS($aStdOut[$i],3) if StringLen($aStdOut[$i]) > 0 then $aReturn[1] &= $aStdOut[$i] & $sDelim EndIf Next $aReturn[1] = StringTrimRight($aReturn[1],1) ; create tab delimited string containing StdErr text from process $aReturn[2] = "" $sStderr = "" While 1 $sStderr &= StderrRead($i_Pid) If @error Then ExitLoop Wend $sStderr = StringReplace($sStderr,@cr,@tab) $sStderr = StringReplace($sStderr,@lf,@tab) $aStderr = StringSplit($sStderr,@tab,1) for $i = 1 to $aStderr[0] $aStderr[$i] = StringStripWS($aStderr[$i],3) if StringLen($aStderr[$i]) > 0 then $aReturn[2] &= $aStderr[$i] & $sDelim EndIf Next $aReturn[2] = StringTrimRight($aReturn[2],1) ; kill the process if it exceeds $timeoutSeconds if $timeoutSeconds > 0 Then if TimerDiff($runTimer)/1000 > $timeoutSeconds Then ProcessClose($i_Pid) EndIf EndIf ; fetch exit code and close process handle If IsArray($h_Process) Then Sleep(100) ; or DllCall may fail - experimental $i_ExitCode = DllCall('kernel32.dll','ptr', 'GetExitCodeProcess','ptr', $h_Process[0],'int*', 0) if IsArray($i_ExitCode) Then $aReturn[0] = $i_ExitCode[2] Else $aReturn[0] = -1 EndIf Sleep(100) ; or DllCall may fail - experimental DllCall('kernel32.dll','ptr', 'CloseHandle','ptr', $h_Process[0]) Else $aReturn[0] = -2 EndIf ; return single item if correctly specified with with $nRetVal If $nRetVal <> -1 And $nRetVal >= 0 And $nRetVal <= 2 Then Return $aReturn[$nRetVal] ; return array with exit code, stdout, and stderr return $aReturn EndFunc Changed post title at herewasplato's request to assist in finding it via forum search.1 point
-
FileExists() takes too long for an invalid UNC path
seadoggie01 reacted to CYCho for a topic
@seadoggie01 Thank you for your concern. FileExists for an invalid mapped drive took about the same time as for an invalid UNC path.0 points