Leaderboard
Popular Content
Showing content with the highest reputation on 09/09/2020 in all areas
-
You could do something like this -- Local $aList = WinList("Google Chrome") ; Loop through the array displaying only visable windows with a title. For $i = 1 To $aList[0][0] If StringInStr($aList[$i][0], "<Static Name>") = 0 Then WinActivate($aList[$i][1]) ExitLoop EndIf Next1 point
-
@FuncName ?
TheDcoder reacted to argumentum for a topic
I believe mLipok is right. Looking around, I asked for a @IncludeScriptFullPath and it got picked up in ticket 2886, so, yeah, AutoIt is still actively worked on. At times we, "the scripting kids", ask ourselves "where is the new version", but one can not rush a cook, as we don't know what is going on in the kitchen. It is an uplifting share. Nice to see. Thanks for sharing @mLipok1 point -
Fine. Here's a first attempt at a useable schema : EDIT: don't trust that, typed too fast without thinking enough! CREATE TABLE "Dirs" ( "ID" INTEGER PRIMARY KEY, "Drive" CHAR NOT NULL, "Dir" CHAR NOT NULL) WITHOUT ROWID; CREATE TABLE "Files" ( "ID" INTEGER PRIMARY KEY, "DirId" INTEGER NOT NULL CONSTRAINT "fkFileDir" REFERENCES "Dirs"("ID") ON DELETE CASCADE ON UPDATE CASCADE DEFERRABLE INITIALLY DEFERRED, "File" CHAR NOT NULL, "Ext" CHAR NOT NULL DEFAULT '') WITHOUT ROWID; CREATE INDEX "ixFileExt" ON "Files" ("File", "Ext"); CREATE INDEX "ixExt" ON "Files" ("Ext"); Note the foreign key from Files to Dirs. I recommend using the x86 version of Expert as the extension below are readily pre-compiled as 32-bit DLLs. The C source is included for your convenience. unifuzz.zip To load an SQLite extension from AutoIt use this: You can register auto-loadable extension within Expert. EDIT: this feature is only available in the paid version, sorry for misleading information. EDIT: wrong schema, see post below.1 point
-
This might work... $action_item = "abcd (see section A1B2c3) 1234" $action_item = StringRegExpReplace($action_item, "(see section \w+)", '<font color="FF8300">$1</font>') Msgbox(0,"", $action_item)1 point
-
Prove it Donkey (A$$) expert ... horse by another name. Clearly, so you fell into a trap of your own making. Damn, I was hoping you couldn't come up with anything ... now I have to pretend I never saw that bit or check it out. P.S. I do recall checking that program out way back when ... maybe even before you suggested it, and I'm not using it ... so I wonder what that means?1 point
-
I did my comment because I saw that many awesome things are done in track ticketing system, so I was interested to review/refresh/bump old things. I think that @jpm focus on this topic because of my comment, but this is quite possible that this was on his TODO list, much more faster than my comment.1 point
-
If you go the SQLite route, no problem. SQLite DBs can easily reach dozens of Tb, so you'll never hit a hard limit in your use case. Create at least two tables: one for each directory and one for files with a reference to its directory. Depending on your needs you may as well want to split the directory path into drive (or server) and folder. Storing file extensions and/or other attributes in separate column(s) may also help, still depending on your query/update requirements. SQLite supports partial indices natively as well as indices on expressions. I can provide SQLite loadable libraries to search Unicode text fields in uncommon ways (e.g. unaccented, fuzzy search, and much more) as well as support for PCRE regexps (same as in AutoIt). As usual I recommend building a workbench DB using a good SQLite DB manager (I warmly recommend SQLite Expert). Create tables indices, triggers, queries with more or less real-world data, fine tune the schema until everything works nicely. Only then start coding want you need in AutoIt.1 point
-
Remember the days when you couldn't run AutoIT on MAC?
argumentum reacted to TheDcoder for a topic
LOL, maybe Might be, that video does show the cursed fork of AUT, pretty sure that is illegal around these parts1 point -
@FuncName ?
argumentum reacted to mLipok for a topic
Thanks to @jpm https://www.autoitscript.com/trac/autoit/ticket/2833#comment:9 Now the only one thing is to wait for @Jon aprooval and releasing version. Please do not ask when...... It will be done when he had free spare time.....1 point -
multi threading
Petrask24 reacted to markyrocks for a topic
untested but should look something like this. You need to have a main thread otherwise the main script will just execute in a matter of seconds and exit Global $slots = -1 _AuThread_Startup() _GetAvailableSlots() ;<~~~~~~~~~was no () here ;main thread while 1 $slots=_auThread_GetMessage() sleep(5) ;if slots do something ;else wait so long and bug out if slots Then if ProcessExists($thread1) then ProcessClose($thread1) if ProcessExists($thread2) then ProcessClose($thread2) if ProcessExists($thread3) then ProcessClose($thread3) if ProcessExists($thread4) then ProcessClose($thread4) endif WEnd Func thread1() local $result Local $x1 = 0, $y1 = 0, $WindowX = 0, $WindowY = 0, $WindowXX = 1200, $WindowYY = 900, $Timeout = 5000 Local $Image1 = "Images/Image1.PNG", $Image2 = "Images/Image2.PNG" Local $Image1 = "Images/Image3.PNG", $Image3 = "Images/Image4.PNG" $Timer = TimerInit() do ;$result = _ImageSearchArea($Image1, 1, $WindowX, $WindowY, $WindowXX, $WindowYY, $x1, $y1, 0, 0) until $result or TimerDiff($Timer) >= $Timeout If ($result) Then $slots = 1 _AuThread_SendMessage(_AuThread_MainThread(),$slots) EndIf EndFunc I'd also like to add that you should probably have the main thread do some of the work otherwise its just sitting there waiting. Kinda pointless. edit it also looks like you define $Image1 and then redefine it again, i'm assuming that's a mistake.1 point -
$title = "VitalSource Downloader" $start = 10 $end = 19 While 1 If $end > 180 Then ExitLoop ControlSetText($title, "", "TEdit3", $start) ControlSetText($title, "", "TEdit1", $end) ControlClick($title, "", "TButton1") Sleep(60000) $start += 10 $end += 10 WEnd1 point
-
Remember the days when you couldn't run AutoIT on MAC?
TheDcoder reacted to argumentum for a topic
Maybe is unity, go figure. He may have started by playing PC games in a Mac and games goes against forum policy WineBottler maybe ?1 point -
Are there any benchmarks?
markyrocks reacted to xSunLighTx3 for a topic
I tested a file io interaction with c++ and autoit. The speed was the same (file read etc.). But in general autoit is very slow when it comes to special things and also there is no modern gui theme. In my opinion you cannot compare autoit to languages like java. AutoIt is here to automate processes with simple syntax.1 point -
I have been playing with this example for about a week, off and on. May this example help someone. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Date.au3> #include <Array.au3> ; https://www.autoitscript.com/forum/topic/203556-_guictrlmonthcal-select-different-days/?do=findComment&comment=1462072 Global $g_idMemo Global $iFrmt = "other" ; Format MM/DD/YYYY ; or ; ;Global $iFrmt = "au" ; Format DD/MM/YYYY ; Example() Func Example() Local $idMonthCal GUICreate("Select Dates", 250, 340, -1, 20, BitOR($WS_SIZEBOX, $WS_MINIMIZEBOX, $WS_CAPTION, $WS_SYSMENU)) Local $idMonthCal = GUICtrlCreateMonthCal("", 10, 10, 230, 160, $WS_BORDER) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetTip(-1, "Left mouse click on date to select") $g_idMemo = GUICtrlCreateEdit("", 10, 180, 230, 110) GUICtrlSetFont(-1, 9, 400, 0, "Courier New") GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH + $GUI_DOCKLEFT) GUICtrlSetTip(-1, "Drag bottom edge of the GUI window is possible") Local $idButSort = GUICtrlCreateButton("Sort (Asc/Desc)", 10, 295, 100, 20) GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKBOTTOM + $GUI_DOCKLEFT) GUICtrlSetTip(-1, 'Toggle ascending and descending date sort order.') Local $idButUniq = GUICtrlCreateButton("Unique", 120, 295, 50, 20) GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKBOTTOM + $GUI_DOCKLEFT) GUICtrlSetTip(-1, 'Remove duplicate dates.') Local $idButParse = GUICtrlCreateButton("Parse", 180, 295, 50, 20) GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKBOTTOM + $GUI_DOCKLEFT) GUICtrlSetTip(-1, "Change a range of dates (if present) to a list of dates" & @CRLF & _ 'eg. "12/08/202014/08/2020" or "12/08/2020 14/08/2020" or "14/08/2020:12/08/2020" or "12/08/2020 to 14/08/2020" will return:-' & @CRLF & _ '12/08/2020' & @CRLF & _ '13/08/2020' & @CRLF & _ '14/08/2020') Local $idButFormat = GUICtrlCreateButton("MM/DD/YYYY", 10, 318, 100, 20) GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKBOTTOM + $GUI_DOCKLEFT) GUICtrlSetTip(-1, 'Toggle date format between "DD/MM/YYYY" and "MM/DD/YYYY"') GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idMonthCal ;GUICtrlSetData($g_idMemo, GUICtrlRead($idMonthCal) & @CRLF, 1) GUICtrlSetData($g_idMemo, StringRegExpReplace(GUICtrlRead($idMonthCal), "(\d{4})/(\d{2})/(\d{2})", ($iFrmt = "au" ? "$3/$2/$1" : "$2/$3/$1") & @CRLF), 1) ; YYYY/MM/DD to (DD/MM/YYYY or MM/DD/YYYY) Case $idButSort _Parse() ; Default parameter is "1" to sort. And, will change a range of dates (if present) to a list of dates. Case $idButUniq _Unique() Case $idButParse _Parse(0) ; Parameter "0" will not sort, but will change a range of dates (if present) to a list of dates. Case $idButFormat GUICtrlSetData($idButFormat, ($iFrmt = "au" ? "MM/DD/YYYY" : "DD/MM/YYYY")) $iFrmt = ($iFrmt = "au" ? "other" : "au") GUICtrlSetData($g_idMemo, StringRegExpReplace(GUICtrlRead($g_idMemo), "(\d{2})/(\d{2})/(\d{4})", "$2/$1/$3"), "") EndSwitch WEnd GUIDelete() EndFunc ;==>Example ; Any two dates on the same line separated by any character(s) that are not a digit or a "/", ; will be replaced with a sequencial range of dates between the two dates. ; eg. "12/08/202014/08/2020" or "12/08/2020 15/08/2020" or "15/08/2020:12/08/2020" or "12/08/2020 to 15/08/2020" will return:- ; 12/08/2020 ; 13/08/2020 ; 14/08/2020 ; 15/08/2020 Func _Parse($iSort = 1) Local $Y, $M, $D, $iStart, $iEnd, $iStep = 1, $iIndex = 0 Local $aRet[1000][2] Local Static $iDesc = 1 If $iSort Then $iDesc = Not $iDesc ; Toggle ascending and descending date sort order. Local $a = StringRegExp(GUICtrlRead($g_idMemo), "[\d\V]+", 3) For $j = 0 To UBound($a) - 1 $aTemp = StringRegExp($a[$j], "[^\D]{2,4}", 3) ; Note: "[^\D]{2,4}" is faster than "\d{2,4}" If UBound($aTemp) = 6 Then ; Expand date range to date list. In 2D array, 1st column is sorting date,"y/m/d". 2nd column is formatted date, either "d/m/y" or "m/d/y"." $iStart = _DateToDayValue($aTemp[2], ($iFrmt = "au" ? $aTemp[1] : $aTemp[0]), ($iFrmt = "au" ? $aTemp[0] : $aTemp[1])) If @error Then ContinueLoop (Abs(MsgBox(16, "Error", "Error iInvalid range start date", 4))) ; Check valid date. $iEnd = _DateToDayValue($aTemp[2], ($iFrmt = "au" ? $aTemp[4] : $aTemp[3]), ($iFrmt = "au" ? $aTemp[3] : $aTemp[4])) If @error Then ContinueLoop (Abs(MsgBox(16, "Error", "Error invalid range end date", 4))) ; Check valid date. If $iStart > $iEnd Then $iStep = -1 For $i = $iStart To $iEnd Step $iStep _DayValueToDate($i, $Y, $M, $D) $aRet[$iIndex][0] = $Y & "/" & $M & "/" & $D $aRet[$iIndex][1] = ($iFrmt = "au" ? $D & "/" & $M : $M & "/" & $D) & "/" & $Y $iIndex += 1 Next Else If _DateIsValid($aTemp[2] & "/" & ($iFrmt = "au" ? $aTemp[1] & "/" & $aTemp[0] : $aTemp[0] & "/" & $aTemp[1])) = 0 Then _ ; Check valid date. ContinueLoop (Abs(MsgBox(16, "Error", "Invalid date: " & $a[$j], 4))) ; Check valid date. $a[$j] = StringRegExpReplace($a[$j], "([^\d/\v]+)", "") $aRet[$iIndex][0] = StringRegExpReplace($a[$j], "(\d{2})/(\d{2})/(\d{4})", ($iFrmt = "au" ? "$3/$2/$1" : "$3/$1/$2")) ; DD/MM/YYYY to YYYY/MM/DD for sorting on YYYY/MM/DD. $aRet[$iIndex][1] = $a[$j] $iIndex += 1 EndIf Next ReDim $aRet[$iIndex][2] If $iSort Then _ArraySort($aRet, $iDesc) _ArrayColDelete($aRet, 0) GUICtrlSetData($g_idMemo, _ArrayToString($aRet, @CRLF) & @CRLF) EndFunc ;==>_Parse Func _Unique() Local $a = StringRegExp(GUICtrlRead($g_idMemo), "[\d/]+", 3) $aU = _ArrayUnique($a) _ArrayDelete($aU, 0) GUICtrlSetData($g_idMemo, _ArrayToString($aU, @CRLF) & @CRLF) EndFunc ;==>_Unique1 point
-
Here is more general example showing working with ADO directly without any includes: ; https://www.w3schools.com/asp/ado_intro.asp $objErr = ObjEvent("AutoIt.Error","MyErrFunc") $sServer = 'server1' $sDatabase = 'master' $sUID = 'admin' $sPWD = 'pwd' $DSN = 'DRIVER={SQL Server};SERVER=' & $sServer & ';DATABASE=' & $sDatabase & ';UID=' & $sUID &';PWD=' & $sPWD & ';' $oConn = ObjCreate ("ADODB.Connection") $oConn.ConnectionTimeout = 3 ; default is 15 s (must be supported by data provider DSN) $oConn.Open($DSN) If @error Then Exit ; simple select returns 1 value (1 column and 1 row: count() max() TOP 1) $value = $oConn.Execute('select max(col1) from admin.table').Fields(0).Value ConsoleWrite($value & @CRLF) ; simple SQL command INSERT/UPDATE/DELETE without return value $oConn.Execute('update admin.table set col1 = value where key = id') ; general SELECT returns more columns/rows $oRS = ObjCreate ("ADODB.Recordset") $oRS.CursorType = 2 $oRS.LockType = 3 $oRS.Open ('select * from admin.table', $oConn) If @error Then Exit If $oRS.RecordCount Then ; -1 While Not $oRS.EOF $value = $oRS.Fields(0).Value & ' | ' & $oRS.Fields(1).Value ; read only first and second column ConsoleWrite($value & @CRLF) $oRS.MoveNext WEnd EndIf ; execute stored procedure, doesn't support input params and result set Local $rowcount $oConn.Execute('admin.sp_my_procedure', $rowcount, 132) ; adCmdStoredProc=4 + adExecuteNoRecords=0x80 (128) $oRS.Close $oConn.Close MsgBox(64, 'OK', 'Finished') Func MyErrFunc() MsgBox(48, 'COM Error', $objErr.description) SetError(1) EndFunc1 point
-
i have a question iam trying to get the image search to work and it says error line 1 #include <ImageSearch.au3> i think because i dont have that downloaded to my library but i tried to download theses and it didnt really do anything how could i get this ?1 point