Leaderboard
Popular Content
Showing content with the highest reputation on 06/09/2023 in all areas
-
Hi all, I am happy to introduce my latest AutoIt hobby project. Glance. It is a gui library created with windows api functions. Back end of this library is a dll file created in Nim programming language. So you have to place the dll near to your exe. Here is a screenshot. Please see the image. And here is the sample code for the window in the image. #AutoIt3Wrapper_UseX64=y #include "glance.au3" Local $frm = glf_NewForm("My Autoit window in Nim", 1100, 500) ; Create new Form aka Window glf_FormCreateHwnd($frm) ; Create the form's handle Local $mbar = glf_FormAddMenuBar($frm, "File|Edit|Help") ; Create a menubar for this form glf_FormAddMenuItems($frm, "File", "New Job|Remove Job|Exit") ; Add some sub menus for 'File' & 'Edit' menus glf_FormAddMenuItems($frm, "Edit", "Format|Font") glf_FormAddMenuItems($frm, "New Job", "Basic Job|Intermediate Job|Review Job") ; Add some submenus to 'New Job' glf_MainMenuAddHandler($frm, "Basic Job", $gMenuEvents.onClick, "menuClick"); Add an event handler for 'Basic Job' Local $btn1 = glf_NewButton($frm, "Normal", 15) ; Now create some buttons Local $btn2 = glf_NewButton($frm, "Flat", 127) Local $btn3 = glf_NewButton($frm, "Gradient", 240) glf_ControlSetProperty($btn2, $gControlProps.backColor, 0x90be6d) ; Set back color property glf_ButtonSetGradient($btn3, 0xf9c74f, 0xf3722c) ; make this button gradient glf_ControlAddHandler($btn1, $gControlEvents.onClick, "onBtnClick") ; Add an event handler for btn1 Local $cal = glf_NewCalendar($frm, 15, 70) ; A simple calendar control. Local $cb1 = glf_NewCheckBox($frm, "Compress", 40, 280) ; Create two checkboxes Local $cb2 = glf_NewCheckBox($frm, "Extract", 40, 310) glf_ControlSetProperty($cb2, $gControlProps.foreColor, 0xad2831) ; Set the checked property to True Local $cmb = glf_NewComboBox($frm, 350, 25) ; Create new ComboBox glf_ComboAddRange($cmb, "Windows|Linux|Mac|ReactOS") ; Add some items. You can use an array also glf_ControlSetProperty($cmb, $gControlProps.backColor, 0x68d8d6) ; Set the back color Local $dtp = glf_NewDateTimePicker($frm, 350, 72) ; Create new DateTimePicker aka DTP Local $gb = glf_NewGroupBox($frm, "My Groupbox", 25, 245, 150, 100) ; Create new GroupBox glf_ControlSetProperty($gb, $gControlProps.foreColor, 0x1a659e) ; Set the fore color Local $lbl = glf_NewLabel($frm, "Static Label", 260, 370) ; Create a Label glf_ControlSetProperty($lbl, $gControlProps.foreColor, 0x008000) ; Set the fore color Local $lbx = glf_NewListBox($frm, 500, 25) ; Create a ListBox glf_ListBoxAddRange($lbx, "Windows|Linux|Mac OS|ReactOS") ; Add some items glf_ControlSetProperty($lbx, $gControlProps.backColor, 0xffc2d4); Set the back color Local $lv = glf_NewListView($frm, 270, 161, 330, 150) ; Create a ListView glf_ListViewSetHeaderFont($lv, "Gabriola", 18) ; Set header font glf_ControlSetProperty($lv, $gListViewProps.headerHeight, 32) ; Set header height glf_ControlSetProperty($lv, $gListViewProps.headerBackColor, 0x2ec4b6) ; Set header back color glf_ControlSetProperty($lv, $gControlProps.backColor, 0xadb5bd) ; Set list view back color glf_ListViewAddColumns($lv, "Windows|Linux|Mac OS", "0") ; Add three columns glf_ListViewAddRow($lv, "Win 8|Mint|OSx Cheetah") ; Add few rows glf_ListViewAddRow($lv, "Win 10|Ubuntu|OSx Catalina") glf_ListViewAddRow($lv, "Win 11|Kali|OSx Ventura") Local $cmenu = glf_ControlSetContextMenu($lv, "Forums|General|GUI Help|Dev Help") ; Add a context menu to list view Local $np1 = glf_NewNumberPicker($frm, 385, 114) ; Create two new NumberPicker aka Updown control Local $np2 = glf_NewNumberPicker($frm, 300, 114) glf_ControlSetProperty($np2, $gNumberPickerProps.buttonLeft, True) ; Set the buttons position to left. Default is right glf_ControlSetProperty($np2, $gControlProps.backColor, 0xeeef20) ; Set back color glf_ControlSetProperty($np2, $gNumberPickerProps.decimalDigits, 2) ; Set the decimal precision to two glf_ControlSetProperty($np2, $gNumberPickerProps.stepp, 0.25) ; Set the step value to 0.25 Local $pgb = glf_NewProgressBar($frm, 25, 363) ; Create a progressbar glf_ControlCreateHwnd($pgb) glf_ControlSetProperty($pgb, $gProgressBarProps.value, 30) ; Set the value to 30% glf_ControlSetProperty($pgb, $gProgressBarProps.showPercentage, True) ; We can show the percentage in digits Local $rb1 = glf_NewRadioButton($frm, "Compiled", 655, 25) ; Create new RadioButtons Local $rb2 = glf_NewRadioButton($frm, "Interpreted", 655, 55) glf_ControlSetProperty($rb1, $gRadioButtonProps.checked, True) ; Set one of them checked Local $tb = glf_NewTextBox($frm, "Some text", 270, 326, 150) ; Create a new TextBox glf_ControlSetProperty($tb, $gControlProps.foreColor, 0xd80032) ; Set the foreColor Local $tkb1 = glf_NewTrackBar($frm, 760, 351) ; Create new TrackBars Local $tkb2 = glf_NewTrackBar($frm, 540, 351) glf_ControlSetProperty($tkb1, $gTrackBarProps.customDraw, True) ; If set to True, we can change lot of aesthetic effects glf_ControlSetProperty($tkb2, $gTrackBarProps.customDraw, True) glf_ControlSetProperty($tkb1, $gTrackBarProps.showSelRange, True) ; We can see the selection are in different color. glf_ControlSetProperty($tkb2, $gTrackBarProps.ticColor, 0xff1654) ; Set tic color ; glf_ControlSetProperty($tkb2, $gTrackBarProps.channelColor, 0x006d77) ; Set channel color. Local $tv = glf_NewTreeView($frm, 760, 25, 0, 300) ; Create new TreeView glf_ControlSetProperty($tv, $gControlProps.backColor, 0xa3b18a) ; Set back color glf_ControlCreateHwnd($tv) glf_TreeViewAddNodes($tv, "Windows|Linux1|MacOS|ReactOS" ) ; Add some nodes glf_TreeViewAddChildNodes($tv, 0, "Win 7|Win 8|Win 10|Win 11") ; Add some child nodes glf_TreeViewAddChildNodes($tv, 1, "Mint|Ubuntu|Red Hat|Kali") glf_TreeViewAddChildNodes($tv, 2, "OSx Cheetah|OSx Leopard|OSx Catalina|OSx Ventura") func onBtnClick($c, $e) ; $c = sender of this event aka, the button itself. $e = EventArgs, like in .NET print("Calendar view mode", glf_ControlGetProperty($cb1, $gControlProps.width)) EndFunc func menuClick($m, $e) ; Here $m is menu itself. $e is MenuEventArgs print("Menu clicked", $m) EndFunc glf_FormShow($frm.ptr) ; All set, just show the form You can get the files from my git repo. Here is the link https://github.com/kcvinker/Glance.git3 points
-
Glance - GUI library for AutoIt, based on Windows api.
argumentum reacted to kcvinu for a topic
@argumentum, Thank you for the image. It seems that the WM_ERASEBKGND is not working as intended in dark themed systems. Edit: The gray color is the window class's color.1 point -
Glance - GUI library for AutoIt, based on Windows api.
argumentum reacted to kcvinu for a topic
@argumentum Sorry, there is a mistake in my last comment. You should use glf_ControlSetProperty($frm, $gControlProps.backColor, 0x...)1 point -
Glance - GUI library for AutoIt, based on Windows api.
argumentum reacted to kcvinu for a topic
@argumentum, Thanks for testing. Sadly, I didn't wrote anything related to handle dark theme. There are certain things which you can't change. Calendar back color is one of them. But you can change form's back color to a dark one. Anyhow, I am interested to see the whole window image. I am curious about the flat color button showed in black color. But the same time, gradient button is showing perfect colors. Edit: @argumentum, Now I see your code $frm.backColor = 0x... This will not work. You need to use the glf_ControlSetProperty($frm, 0x...)1 point -
@UEZ, Thank you. I have already written a GUI library in Nim. If I don't use an external DLL, then data grouping is a problem AutoIt. More over, I can complete this project by making small changes to the existing UI library I wrote in Nim. Only about 250 more lines of code needed to be added. Of course I will push glance.dll's source code to the repo.1 point
-
No, i haven't. I have had visited many other signature-links, but this one i do not recall. Maybe because i already have a tool which i use (well it looks like (at least) 2 times in a week) - WinScraper (when you start my app, you may notice the similarities) I started my app with the idea (see previous post about whatapp) to remotely disable the close button without the need to have a script running in background and checking the window positioning ... Recently, by a mistake, i clicked the x button which made an online game close ... but it did not closed right away, but has crashed it ... which made the chance to get back to where i was even harder (as it already is). And so i found a working script somewhere on this forum (see the links in the sourcecode), built a gui around it and then added some buttons JFF. Ofc, it had to have the resizing functions !1 point
-
Dan's misc. Scripts
argumentum reacted to TheDcoder for a topic
Sure but KaFu is an MVP and this program is mentioned in his signature Also I was sharing the info because if Dan had not seen it, now maybe a good time to do so. He might save on additional work or learn something new, win win!1 point -
Program window freezing during the hashing process
AIG reacted to abberration for a topic
If you are interested in the progressbar version, I got it working. When something is changed (the combo or a new file put in), I made it clear out the old data so you won't glance at it and think it's done. #include <Crypt.au3> #include <WinAPIConv.au3> #include <GUIConstants.au3> #include <GuiEdit.au3> Global $idInput, $g_idOutputEdit, $hashAlgo = $CALG_MD5 Global $idCombo Global $hGUI, $hChildGUI Example() Func Example() ; Create GUI $hGUI = GUICreate("Hash File", 400, 105, -1, -1, -1, $WS_EX_ACCEPTFILES) $idInput = GUICtrlCreateInput("", 10, 20, 300, 20) GUICtrlSetState (-1, $GUI_DROPACCEPTED) $sFilePath = GUICtrlRead($idInput) Local $idBrowseButton = GUICtrlCreateButton("Browse", 320, 20, 70, 20) $idCombo = GUICtrlCreateCombo("", 321, 50, 68, 20, $CBS_DROPDOWNLIST) GUICtrlSetData($idCombo, "MD2 (128bit)|MD4 (128bit)|MD5 (128bit)|SHA1 (160bit)|SHA_256 (256bit)|SHA_384 (384bit)|SHA_512 (512bit)", "MD5 (128bit)") $g_idOutputEdit = GUICtrlCreateInput("", 10, 50, 300, 20, BitOR($ES_READONLY, $ES_CENTER)) $Progress1 = GUICtrlCreateProgress(10, 80, 300, 10) GUISetState(@SW_SHOW, $hGUI) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop Case $idBrowseButton Local $sFile = FileOpenDialog("Select file", "", "All (*.*)") If @error Then ContinueCase GUICtrlSetData($idInput, $sFile) GUICtrlSetData($g_idOutputEdit, "") _Hash($sFile, $Progress1) Case $GUI_EVENT_PRIMARYDOWN _GUICtrlEdit_SetSel($idInput, 0, -1) Case $GUI_EVENT_DROPPED $sFileName = GUICtrlRead($idInput, 1) GUICtrlSetData($g_idOutputEdit, "") _Hash($sFileName, $Progress1) Case $idCombo $sFileName = GUICtrlRead($idInput) GUICtrlSetData($g_idOutputEdit, "") _Hash($sFileName, $Progress1) EndSwitch WEnd EndFunc ;==>Example Func _Hash($sFile, $Progress1) Local $dHash = 0 _Crypt_Startup() Switch GUICtrlRead($idCombo) Case "MD2 (128bit)" $hashAlgo = $CALG_MD2 Case "MD4 (128bit)" $hashAlgo = $CALG_MD4 Case "MD5 (128bit)" $hashAlgo = $CALG_MD5 Case "SHA1 (160bit)" $hashAlgo = $CALG_SHA1 Case "SHA_256 (256bit)" $hashAlgo = $CALG_SHA_256 Case "SHA_384 (384bit)" $hashAlgo = $CALG_SHA_384 Case "SHA_512 (512bit)" $hashAlgo = $CALG_SHA_512 EndSwitch If Not FileExists($sFile) Then GUICtrlSetData($g_idOutputEdit, "If File not found show this text") Else $dHash = _Crypt_HashFile2($sFile, $hashAlgo, $Progress1) $hexHash = Hex($dHash, 8) GUICtrlSetData($g_idOutputEdit, $hexHash) EndIf _Crypt_Shutdown() EndFunc Func _Crypt_HashFile2($sFilePath, $iAlgID, $Progress1) $iFileSizeForProgress = FileGetSize($sFilePath) Local $dTempData = 0, _ $hFile = 0, $hHashObject = 0, _ $iError = 0, $iExtended = 0, _ $vReturn = 0 If @error Then Return SetError(@error, @extended, -1) Do $hFile = FileOpen($sFilePath, $FO_BINARY) If $hFile = -1 Then $iError = 1 $iExtended = _WinAPI_GetLastError() $vReturn = -1 ExitLoop EndIf Do $dTempData = FileRead($hFile, 512 * 1024) If @error Then $vReturn = _Crypt_HashData($dTempData, $iAlgID, True, $hHashObject) If @error Then $iError = @error $iExtended = @extended $vReturn = -1 ExitLoop 2 EndIf ExitLoop 2 Else $hHashObject = _Crypt_HashData($dTempData, $iAlgID, False, $hHashObject) If @error Then $iError = @error + 100 $iExtended = @extended $vReturn = -1 ExitLoop 2 EndIf EndIf GUICtrlSetData($Progress1, filegetpos($hFile) / $iFileSizeForProgress * 100) Until False Until True GUICtrlSetData($Progress1, 0) If $hFile <> -1 Then FileClose($hFile) Return SetError($iError, $iExtended, $vReturn) EndFunc ;==>_Crypt_HashFile Edit: added code to prevent dragging a new file into the input box and concatenating them instead of overwriting the last file location.1 point -
Problem with Number function
_Func reacted to mistersquirrle for a topic
Here's something to keep in mind regarding data types and comparing them (or even checking if they are a specific type): https://www.autoitscript.com/autoit3/docs/intro/lang_operators.htm#:~:text=Comparing different datatypes Another thing to look at is: https://www.autoitscript.com/autoit3/docs/functions/VarGetType.htm Maybe not entirely useful here, but it's along the same lines and is important to keep in mind.1 point -
AutoIt/Wiki broken?
argumentum reacted to water for a topic
A magic number is the opposite of a Constant. If you want to avoid magic numbers you have to use Constants. It does not matter where you define them. In your script or in a separate file which you include (that is meant by "optional file"). There is no such thing like an optional Constant. The wiki is managed by volunteers. It is a source of information like the forum. Your first source is the official help file provided with AutoIt. In the wiki you find in depth information about a lot - but not all - subjects. If you do not find the needed information in the wiki then you get help in the forum. This might then lead to an update in the wiki - if someone finds some spare time and the wiki works1 point -
@kpdozer & @n3wbie I have updated my original responses with more information.1 point
-
Got it. When I first tried what you mentioned @Danp2 in an older post, it didn't work and showed a similar error as before: Turns out @UserName does not match the directory username that was on my Win10 PC. Not sure why but I manually added it in as shown here: ;$UserDataDir = 'C:/Users/' & @UserName & '/AppData/Local/Google/Chrome/User Data/' $UserDataDir = 'C:/Users/' & 'mickey' & '/AppData/Local/Google/Chrome/User Data/' $sDesiredCapabilities = '{"capabilities": {"alwaysMatch": {"unhandledPromptBehavior": "ignore", "goog:chromeOptions": {"w3c": true, "excludeSwitches": ["enable-automation"], "useAutomationExtension": false, "prefs": {"credentials_enable_service": true}, "args": ["user-data-dir=' & $UserDataDir & ', profile-directory=Default"] }}}}' ;300,851 point