Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/13/2020 in all areas

  1. Slightly modified code and new function parameters: ; Create Checkbox Combo for multiple selections ; ; Flag values ; 0 => Display comma-delimited list of checked items in Edit control of Combo (default) ; 1 => Display number of checked items in Edit control, leading text in Edit control ; 2 => Display number of checked items in Edit control, trailing text in Edit control ; ; Error code in @error Return value ; 1 => Invalid item info string/array Success => $idComboBox (Dummy control) ; 2 => Error creating ComboBox Failure => 0 ; 3 => Too many ComboBoxes ; Func CheckboxCombo_Create( _ $x, $y, $w, $h, _ ; Left, top, width, height $iListRows, _ ; Rows in drop-down ListBox $vItemInfo, _ ; Item info string/array $iFlag = 0, _ ; Set option flag values $sEdit = "" ) ; Edit text if $iFlag = 1/2 CheckboxCombo.7z
    2 points
  2. TheSaint

    Check-If-Same

    Check-If-Same is a little program, with a big heart (window), that I have been working on since the end of August. It's a somewhat simple affair, and one of the many file checkers out there, but I have put my own slant on it. The screenshot probably says it all. It was built to purpose for me, and you can see the MD5 stuff as an added extra. It has been suggested by my good buddy TheDcoder, that I should also add CRC32 checking, which I may do at some point. However, I just wanted a simple folder content comparison, where I was more interested in file names being matched, not the state of the files ... they having had their integrity checked already by TeraCopy. Files only appear on either list, if they are missing in the other folder or they fail the chosen compare test. If desired, missing files can be skipped (File Name option excepted). 'Source Size' and 'Compare Size' can alternatively be 'Source Date' and 'Compare Date', as specified by the Bytes combo field. Anyway, for what its worth, enjoy! Some of you might find it handy. Source is included in the zip. Check-If-Same v1.1.zip 589.41 kB (111 downloads) Check-If-Same v1.2.zip NEW You have two methods of MD5 checking, one is the AutoIt Crypt hash checking, the other is using third party FSUM. In my limited number of tests, I found the crypt method was faster with small files and FSUM much faster with big files, so take your pick. If you are keen to see timing comparisons, then with the individual MD5 button option, the times are stored in the 'Settings.ini' file for the entry you selected (see the [MD5 Test] section).
    1 point
  3. Ok, here is what i came up with after 3-4 hours of scripting well ok, it has been long time since then, so... after an year or so of hard scripting/testing!!! (inspired by this topic)... GUICtrlSetOnHover UDF... Syntax: _GUICtrl_OnHoverRegister(ControlID [, OnHoverFunc [, OnLeaveHoverFunc [, PrimaryDownFunc [, PrimaryUpFunc [, KeepCall_PrDn_Func [, KeepCall_Hover_Func]]]]]]) ControlID can be -1 as in Build-In functions! Example: #include "GUICtrlOnHover.au3" Opt("GUIOnEventMode", 1) $Btn_Color = 0x7A9DD8 $Hover_Color = 0xFF0000 ;0x7AC5D8 $GUIMain = GUICreate("Letters Hovering Example", 570, 200) GUISetOnEvent(-3, "Quit") _CreateLetters_Proc(10, 60, 18, 20) GUICtrlCreateButton("Close", 30, 120, 100, 30) GUICtrlSetOnEvent(-1, "Quit") GUICtrlSetFont(GUICtrlCreateLabel("Letter: ", 35, 170, 200, 20), 9, 800) $Status_Label = GUICtrlCreateLabel("", 80, 171, 200, 20) GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetFont(-1, 8.5, 800) GUISetState() While 1 Sleep(100) WEnd Func _CreateLetters_Proc($iLeft, $Top, $Width=15, $Height=15) Local $iLeft_Begin = $iLeft Local $iAsc_Char = 64 For $i = 0 To 25 $iLeft_Begin += 20 $iAsc_Char += 1 GUICtrlCreateButton(Chr($iAsc_Char), $iLeft_Begin, $Top, $Width, $Height) _GUICtrl_OnHoverRegister(-1, "_Hover_Func", "_Leave_Hover_Func") GUICtrlSetOnEvent(-1, "_Letter_Events") GUICtrlSetBkColor(-1, $Btn_Color) GUICtrlSetFont(-1, 6) Next EndFunc Func _Letter_Events() MsgBox(64, "Pressed", "Letter = " & GUICtrlRead(@GUI_CtrlId)) EndFunc Func _Hover_Func($iCtrlID) GUICtrlSetBkColor($iCtrlID, $Hover_Color) GUICtrlSetData($Status_Label, GUICtrlRead($iCtrlID)) Beep(1000, 20) EndFunc Func _Leave_Hover_Func($iCtrlID) GUICtrlSetBkColor($iCtrlID, $Btn_Color) GUICtrlSetData($Status_Label, "") EndFunc Func Quit() Exit EndFunc Attachments: [The archive include few nice examples, and the UDF itself of course .] * New (v2.1) (Redirection to Zip-file, 159 kb) _GUICtrlSetOnHover.html GUICtrlSetOnHover.zip GUICtrlSetOnHover_UDF.au3 GuiCtrlSetOnHover.zip GUICtrlSetOnHover_UDF_For_3.2.10.0.au3 Old Beta - GUICtrlSetOnHover_UDF_beta.zip Enjoy! P.S Thanks to piccaso for the greatest CallBack tool! Without it, this UDF would never been created! ============================================ History version:
    1 point
  4. This UDF allows to create formatted label using pseudo element RichLabel (RichEdit actually). Formating is set by using special modificator similar to <font> tag in Html. Notes: This UDF is a transformation-continuation of related UDF Example: Download: GUIRichLabel_1.2.zip Small syntax related fix: GUIRichLabel_1.1.zip GUIRichLabel_1.1.zip History version:
    1 point
  5. As the title implies, trying to mimic Microsoft Word (Older version) using RichEdit. Not an easy task, it's not even 1/10th of what word really is but I wanted to make a small text editor (That supported changing an individual word/letters properties). Some of the functions I wanted to use didn't have a whole lot of information/topics about them so I spent many many hours trying to figure out how to do some things... (Like getting the text from a ExComboBox or changing the color of the rich edit text without changing ALL of the rich edit text (Turns out I just needed to update my AutoIt version....)) Some of the things I struggled with was reading the Font Size from the ComboBoxEx (GUICtrlRead and ControlGetText do not work, by themselves, but if you use _GUICtrlComboBoxEx_GetEditControl to get the GUICtrlID of the ComboBoxEx you can use ControlGetText), trying to track a Popup menu for the font size (I didn't want to use a dropdown menu, trying to use the scroll wheel to increment/decrement the text in the ComboBoxEx, making sure the correct attribute buttons are Checked depending on the location of the caret (This isn't 100% perfect, I got it to pretty much work though... I originally had it checking the letter 1 left of the caret all the time, except when the caret is at the 0,0 mark, but if the caret is at the very end and the user presses one of the attribute buttons, it won't keep the button checked correctly). There are a few other things but I can't think of them. I don't know enough about the WinAPI in order to make a truly amazing wordpad but maybe this will help some others out there trying to use some of the controls I used. Also, this was actually made to be attached (_WinAPI_SetParent($frmEditor, WinGetHandle("[Class:LWJGL]")) to a game I play (PokeMMO), so there may be some remnants of the game stuff in here. I don't think so, but there might be... It still functions properly. (There is no gameplay automation, it's just supposed to be a child of the game and work as a simple text editor. I've currently submitted it to one of mods of the game so I can release it to the community) Beginnings of a Wordpad.rar
    1 point
  6. though you should get about 2 minutes of relief a day from the loud fan noise, if I’m reading the script right
    1 point
  7. TheSaint

    Check-If-Same

    I am busy for a good while, but I may test that later. It makes me sad, that I paid for 100%, and you are now telling me I only got 25%.
    1 point
  8. @Musashi For the fun #include <Array.au3> $txt = FileRead(@ScriptDir & '\input_file.txt') Local $sSearch1 = "b.imageUrl", $sSearch2 = "Preview.png" $aResult = StringRegExp(Execute ( "'" & StringRegExpReplace(StringReplace($txt, "'", "''"), "(?m)^", "' & Assign(""iReplace"", Eval(""iReplace"")+1) * Eval(""iReplace"") & ' - ") & "'" ), '(?i).*?\Q' & $sSearch1 & '\E.*?\Q' & $sSearch2 & '\E.*', 3) _ArrayDisplay($aResult)
    1 point
  9. This seems to be incorrect. I wasn't aware of the app going away before and just now transferred all of my (not-at-all-pirated) music to the new app. I wouldn't ever pay to listen to my own music and mostly use Pandora for streaming. All of my songs are listed under Library (at the bottom) and then Uploads. It also looks like they upped the cap to 100K songs (from 50K) per ConsumerReports. The transfer from Google Play Music to YouTube Music took about 1 minute, but I do have all of my songs loaded onto my Android (under \Music\* on a Samsung)
    1 point
  10. if my_GUI_active then ignore the registered event =)
    1 point
  11. Hi everybody There's an interesting feature in PaintShop Pro (PSP) and I succeeded in doing same with AutoIt. When you got "inner child" windows inside a GUI (the ones created with $WS_CHILD style) and you minimize them, here is what happens : 1) With PSP 2) With AutoIt Until now, it's the same behavior : child windows are minimized at the left bottom corner of the parent window. But when you resize the parent GUI (or Maximize it) then things become very different : 3) With PSP : minimized child windows are still docked in the left bottom corner, great ! (I upload a small parent image, but it would show same if higher or maximized) 4) With AutoIt : minimized child windows vanish or are not docked anymore after you resize or maximize the parent window Of course they're still here somewhere, visible or not, but you'll have to dock them by hand after you resized or maximized the parent window. So, with the following script, based on WM_SIZE message, the behavior is now the same as PSP #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPISysWin.au3> $hGUI0 = GUICreate("Minimize child then resize parent", 500, 300, 100, 100, _ BitOr($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX), $WS_EX_COMPOSITED) ; parent $hGUI1 = GUICreate("Child1 with style", 200, 200, 20, 20, _ BitOR($WS_CHILD, $WS_OVERLAPPEDWINDOW), -1, $hGUI0) ; child 1 GUISetBkColor(0xF0F4F9) GUICtrlCreateCheckbox('Filler 1', 10, 10, 50, 20) $hGUI2 = GUICreate("Child2 with style", 200, 200, 250, 20, _ BitOR($WS_CHILD, $WS_OVERLAPPEDWINDOW), -1, $hGUI0) ; child 2 GUISetBkColor(0xFFFFDD) GUICtrlCreateCheckbox('Filler 2', 10, 10, 50, 20) GUISetState(@SW_SHOW, $hGUI0) GUISetState(@SW_SHOW, $hGUI1) GUISetState(@SW_SHOW, $hGUI2) GUIRegisterMsg($WM_SIZE, "WM_SIZE") While 1 $aMsg = GUIGetMsg($GUI_EVENT_ARRAY) Switch $aMsg[1] Case $hGUI0 Switch $aMsg[0] Case $GUI_EVENT_CLOSE _Exit() EndSwitch Case $hGUI1 Switch $aMsg[0] Case $GUI_EVENT_CLOSE GUIDelete($hGUI1) EndSwitch Case $hGUI2 Switch $aMsg[0] Case $GUI_EVENT_CLOSE GUIDelete($hGUI2) EndSwitch EndSwitch WEnd ;========================================== Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam) If $hWnd = $hGUI0 Then ; parent ; Parent client width = BitAND($lParam, 0xFFFF) = _WinAPI_LoWord($lParam) ; Parent client height = BitShift($lParam, 16) = _WinAPI_HiWord($lParam) Local $aEnumChild = _WinAPI_EnumChildWindows($hWnd) If IsArray($aEnumChild) Then Local Static $iWidth_Child = 0, $iHeight_Child = 0 Local $hChild, $iNb_Child_Minimized = 0 For $i = 1 To $aEnumChild[0][0] If $aEnumChild[$i][1] = "AutoIt v3 GUI" Then $hChild = $aEnumChild[$i][0] If BitAND(WinGetState($hChild), $WIN_STATE_MINIMIZED) _ And _WinAPI_GetParent($hChild) = $hWnd Then ; ignore eventual grand child If $iWidth_Child = 0 Then ; only once (as Static variable) Local $aPos_Child = WinGetPos($hChild) $iWidth_Child = $aPos_Child[2] ; minimized $iHeight_Child = $aPos_Child[3] ; minimized EndIf Winmove($hChild, "", $iWidth_Child * $iNb_Child_Minimized, _ BitShift($lParam, 16) - $iHeight_Child) $iNb_Child_Minimized +=1 EndIf EndIf Next EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;========================================== Func _Exit() GUIDelete($hGUI2) GUIDelete($hGUI1) GUIDelete($hGUI0) Exit EndFunc If you want to compare with AutoIt original behavior, just comment out this line : ; GUIRegisterMsg($WM_SIZE, "WM_SIZE") This function WM_SIZE seems portable : only the parent GUI handle is required once at 1st line of function. * Update Sept 10, 2020 : ignore an eventual grand child window (a child window created inside another child window) * Update Sept 11, 2020 : got rid of $iInc counter variable
    1 point
  12. ; Here's a quick example use: ; run a full list from a CMD box ; we should have more or less the same content without disclosing personal details ; can also be done with AutoIt functions, recursively enumerating subfolders and files ; C:\Program Files (x86)\AutoIt3>dir /b /a:-d /s > C:\Users\jc\Documents\AutoMAT\tmp\au3files.txt #include <File.au3> #include <SQLite.au3> Const $SQLITE_DLL = "C:\SQLite\bin\sqlite3.dll" ;<-- Change to the location of your sqlite dll ; Init sqlite _SQLite_Startup($SQLITE_DLL, False, 1) If @error Then Exit MsgBox($MB_ICONERROR, "SQLite Error", "Unable to start SQLite. Check existence of DLL") OnAutoItExitRegister(_SQLite_Shutdown) ConsoleWrite("SQlite version " & _SQLite_LibVersion() & @LF & @LF) ; optional! Local $hDB = _SQLite_Open("AllFiles.sq3") If @error Then Exit OnAutoItExitRegister(SQ3Close) ; as requested, drive isn't stored _SQLite_Exec($hDB, "CREATE TABLE if not exists Dirs (" & _ "ID INTEGER PRIMARY KEY, " & _ "Dir CHAR NOT NULL UNIQUE)") _SQLite_Exec($hDB, "CREATE TABLE if not exists 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 '')") _SQLite_Exec($hDB, "CREATE INDEX if not exists ixFileExt ON Files (File, Ext);") _SQLite_Exec($hDB, "CREATE INDEX if not exists ixExt ON Files (Ext);") ; can also be done with AutoIt functions, recursively enumerating subfolders and files Local $aFiles = FileReadToArray("C:\Users\jc\Documents\AutoMAT\tmp\au3files.txt") Local $aRow, $iId, $sDrive, $sDir, $sFile, $sExt ; Make the whole insert block into a transaction to speed up things. _SQLite_Exec($hDB, "begin") For $v In $aFiles _PathSplit($v, $sDrive, $sDir, $sFile, $sExt) _SQLite_QuerySingleRow($hDB, "select id from dirs where dir = " & _SQLite_FastEscape($sDir), $aRow) If @error Then _SQLite_Exec($hDB, "insert into dirs (dir) values (" & _SQLite_FastEscape($sDir) & ")") $iId = _SQLite_LastInsertRowID($hDB) Else $iId = $aRow[0] EndIf If $sFile = '' Then ContinueLoop _SQLite_Exec($hDB, "insert into files (dirid, file, ext) values (" & $iId & ", " & _SQLite_FastEscape($sFile) & ", " & _SQLite_FastEscape($sExt) & ")") Next ; commit _SQLite_Exec($hDB, "end") Func SQ3Close() _SQLite_Close($hDB) EndFunc ; preferably use Expert to query the DB. Copy this query into a SQL tab and execute it ; select dir || file || ext "File" from dirs D join files F on d.id = f.dirid where dir not like '%beta%' and file like '%extended%' and ext = '.au3' This is a basic schema. SQL Foreign key reference work the opposite of pointers in conventional programming! An entry in the Dirs table holds a DirId (the unique identifier of the directory where the file resides). This is pretty standard SQL and how most tables in large DBs relate to each other. Put it otherwise, you don't store ID of every children to every parent, you store the ID of mother and father in each child entry. Run the sample code (adjust paths if necessary) and use Expert to see what's stored where. Then use an SQL tab to launch the sample query in final comment of the code to see what you get. You may want to create an extra table Params containing for instance: the drive for that DB, a schema version in case you need to upgrade to a new schema, the timestamp of last data retrieval or update, whatever information you find useful. Don't store counts, use SQL to retrieve counts by using AutoIt or (simpler) another Expert SQL tab (I get 47 but I've some more than bare minimum): _SQLite_QuerySingleRow($hDB, "select count(*) from files where ext = '.exe', $aRow) count is then in $aRow[0] A golden rule in SQL schema design: don't duplicate information, never, no, no. Create as many tables as required, and make relationships explicit (using foreign keys). Dirs table should contain information pertinent to directory entries, Files should contain information for files and hold a FK to the Dir where it lives.
    1 point
  13. Like this guy here, I'm a big fan of Windows "ShellNew" template entries. I have a right-click list of items so long that I'm embarassed. But I found the default AutoIt template a little too sparse for my liking. Since most of my scripts are for automated software installs, I modified the default AutoIt script and placed it in the Windows\ShellNew directory so when I right-click on my desktop and choose new AutoIt file, the script below automatically populates the new file. Keep in mind this script may or may not be useful for folks that do development or automate other tasks. But becasue I'm not an AutoIt OG like @Melba23 or @water, this script keeps me from going back and forth to the help file to remember the syntax for, example, shortcuts, message boxes or creating carriage returns: #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: Copyleft Script Function: New Unattended Setup Template #ce ---------------------------------------------------------------------------- #RequireAdmin #include <MsgBoxConstants.au3> ; remove if no message box function #include <File.au3> #include <TrayConstants.au3> ; remove if no tray function $SetupDir= "D:\PROGRAMS\MyCustomProgramPath" $IconDir = "C:\Bin\Icons" $serial1 = "Serial number" $Proces = "MyApp.exe" ; create setup folder (test. some programs fail with existing directory) If not FileExists($SetupDir) Then DirCreate($SetupDir) ; Setup triggers RunWait(@ComSpec & ' /c command', @SW_HIDE) ; runs Windows command RunWait(@COMSPEC & '/c AUTORUN_BAT.CMD', @SW_HIDE) ; runs batch file ShellExecute( RunWait( ; for fill-in forms ControlSetText("MyApp", "", "Edit1", $serial1) ControlClick("MyApp", "", "Button1") ; New Shortcut FileCreateShortcut($SetupDir & "\MyApp.exe", @StartMenuCommonDir & "\Programs\MyStuff\MyApp.lnk", $SetupDir, "", "Manage MyApp installations", $IconDir & "\CustomIcon.ico", "" , 0, @SW_SHOWNORMAL) ; If | then | else If ProcessExists("MyApp.exe") Then ; Check if MyApp process is running. ProcessClose("MyApp.exe") Else ; Add configuration settings sleep(1000) RegWrite('HKCU\Software\AMP Soft\MyApp', 'Language','REG_DWORD',Number('0')) ; Relocate startmenu directory and delete desktop shortcut to unclutter user software environment DirMove ("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\MyApp", @StartMenuCommonDir & "\Programs\UtilitiesDirectory") DirMove ("C:\ProgramData\Microsoft\Windows\Start Menu\Programs\MyApp", @StartMenuDir & "\Programs\UtilitiesDirectory") FileDelete (@DesktopCommonDir & "\MyApp.lnk") FileDelete (@DesktopDir & "\MyApp.lnk") ;double line message box MsgBox(64, "MyApp", "MyApp has been installed" & @LF & "shortcuts have been installed . .", 3) EndIf ; end Exit
    1 point
  14. @RandalBY The follow options (set before calling _WD_Startup()) will tell geckodriver to attach to previously launched instance of Firefox -- _WD_Option('Driver', 'C:\Path\to\the\executable\geckodriver.exe') _WD_Option('DriverParams', '--log trace --connect-existing --marionette-port 2828') _WD_Option('Port', 4444) I haven't tried it myself, but others have posted about saving the sessionid and then using it to communicate with an existing instance of chromedriver.
    1 point
  15. borup

    How to add text to image

    Finally.... he he. But how do i center the text??? The $sString will be replaced with a automatic pull from the system... #include <GDIPlus.au3> Global $hBitmap, $hImage, $hGraphic, $hFamily, $hFont, $tLayout, $hFormat, $aInfo, $hBrush1, $hBrush2, $iWidth, $iHeight, $hPen Global $sString="SERVERNAME" ; Initialize GDI+ library _GDIPlus_StartUp() ; Load image and emboss text $hImage = _GDIPlus_ImageLoadFromFile('C:\Temp\1.jpg') $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage) $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hFont = _GDIPlus_FontCreate($hFamily, 38, 1) $hFormat = _GDIPlus_StringFormatCreate(0x4000) $hBrush2 = _GDIPlus_BrushCreateSolid(0xff000000) $hPen = _GDIPlus_PenCreate(0xC4000000, 1) $tLayout = _GDIPlus_RectFCreate (150, 250 ) $aInfo = _GDIPlus_GraphicsMeasureString($hGraphic, $sString, $hFont, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($hGraphic, $sString, $hFont, $aInfo[0], $hFormat, $hBrush2) ; Save image _GDIPlus_ImageSaveToFile($hImage, @MyDocumentsDir & '\AutoItImage2.bmp') ; Free resources _GDIPlus_PenDispose ($hPen ) _GDIPlus_BrushDispose ($hBrush1 ) _GDIPlus_BrushDispose ($hBrush2 ) _GDIPlus_StringFormatDispose($hFormat ) _GDIPlus_FontDispose ($hFont ) _GDIPlus_FontFamilyDispose ($hFamily ) _GDIPlus_GraphicsDispose ($hGraphic) _GDIPlus_ImageDispose ($hImage ) _GDIPlus_ShutDown() ; Show image Run("MSPaint.exe " & '"' & @MyDocumentsDir & '\AutoItImage2.bmp"')
    1 point
  16. TheDcoder

    Check-If-Same

    I think we missed another important aspect while discussing disk bottlenecks... a faster algorithm also means less CPU usage, which should especially be evident in your low-powered netbook, can you maybe check this? Something like SHA256 hash computing would probably use one of your cores in full-speed but CRC32 might only use less than 25% of it.
    0 points
×
×
  • Create New...