Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/10/2023 in all areas

  1. The first new addition in a while, to the second post of this topic. June 10 2023 - Glance - GUI library for AutoIt, based on Windows api by kcvinu
    1 point
  2. TheSaint

    Kobo Cover Fixer

    Nothing to report at this point, as I got sidetracked ... by life and a couple of other programs updates ... and reading ... and a birthday. Hopefully I will get to that testing later today or tomorrow. I only want to do it, when I can dedicate myself to it properly, without pressing time limits and distractions. I need to do it soon though, as I have some new purchases to add to my Kobo device, and I don't really want to reload everything (database etc) again so soon.
    1 point
  3. @argumentum Problem found and a temporary fix applied. You can test it with downloading the dll again from my repo. I just pushed it now.
    1 point
  4. I made some modifications. For one, I used GUISetAccelerators to make the Enter key activate the hashing process if you paste or type the file location into the input box. Second, I noticed that dropping a file, the combo and a new method I added all did the same things, so I combined them into one Case. Third, to save space, I converted your selector of the the algorithms into an array. Lastly, and in most importantly, I added a tooltip to show the whole output when you hover over the output. Being in a disabled state, you cannot scroll the text to see the whole string, so if it is too big for the box (and many are), then the what you see is useless. I also added an option to put the results in the clipboard. If you want to enable it, just delete the semicolon. I hope these examples give you some ideas on how you can get things done in AutoIt. #include <Crypt.au3> #include <WinAPIConv.au3> #include <GUIConstants.au3> #include <Array.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) $idDummy = GUICtrlCreateDummy() Local $aAccelKeys[1][2] = [["{ENTER}", $idDummy]] GUISetAccelerators($aAccelKeys) 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, "") GUICtrlSetTip($g_idOutputEdit, "") _Hash($sFile, $Progress1) Case $GUI_EVENT_DROPPED, $idCombo, $idDummy $sFileName = GUICtrlRead($idInput, 1) GUICtrlSetData($g_idOutputEdit, "") GUICtrlSetTip($g_idOutputEdit, "") _Hash($sFileName, $Progress1) EndSwitch WEnd EndFunc ;==>Example Func _Hash($sFile, $Progress1) If Not FileExists($sFile) Then GUICtrlSetData($g_idOutputEdit, "If File not found show this text") Else Local $dHash = 0 _Crypt_Startup() Local $aCrypt[8][2] = [["MD2 (128bit)", $CALG_MD2],["MD4 (128bit)", $CALG_MD4],["MD5 (128bit)",$CALG_MD5],["SHA1 (160bit)",$CALG_SHA1],["SHA_256 (256bit)",$CALG_SHA_256],["SHA_256 (256bit)",$CALG_SHA_256],["SHA_384 (384bit)",$CALG_SHA_384],["SHA_512 (512bit)",$CALG_SHA_512]] $hashSelect = GUICtrlRead($idCombo) $hashLoc = _ArraySearch($aCrypt, $hashSelect) $hashAlgo = $aCrypt[$hashLoc][1] $dHash = _Crypt_HashFile2($sFile, $hashAlgo, $Progress1) $hexHash = Hex($dHash, 8) GUICtrlSetData($g_idOutputEdit, $hexHash) GUICtrlSetTip($g_idOutputEdit, $hexHash) ;ClipPut($hexHash) ; copies hash value to clipboard _Crypt_Shutdown() EndIf 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
    1 point
  5. @argumentum Thank you. I will check this soon and let you know.
    1 point
  6. @TheDcoder, The colored button drawing is not that complex even with AUtoIt's own DllCall feature & win api functions. Before writing this Glance library, I have started one with pure autoit code using DllCall. In that project, I created a window & button successfully. The button had colors too. But I dropped that project because of heavy usage of your map. It is a value type we need to keep two maps. One for the user and one for the internal book keeping. That will end up in a heavy bloat code base. So I dropped that and used my nim gui lib "NimForm"'s code.
    1 point
  7. ..you can always fork. look in my signature.
    1 point
  8. HJL

    Tapi Call

    Does anyone perhaps also have an idea how to query a line? Line busy or line free? I would like to use this to control an "On Air" display via a Shelly when I am on the phone.
    1 point
  9. Sorry to resurect an old topic, no solution - but I've stumbled across some interesting behaviour that may help explain what is going on. I am using Assign and Eval because I am trying to assign a value to a propery. the Execute funciton works only for methods; as someone said earier Execute will perform a comparison when doing this: Execute("$a = 4") To run the following code you will need some dependancies from the native wifi project, but there is probably no need to see what is going on. #include "NativeWifi.au3" _Wlan_StartSession() _Test1() _Test2() ;Scenario 1 Func _Test1() ConsoleWrite("-Scenario 1-" & @CRLF) Local $oProfile, $vResult $oProfile = _Wlan_CreateProfileObject() $oProfile.XML = "OldValue" ConsoleWrite("VarGetType:" & VarGetType("oProfile.XML") & @CRLF) ; VarGetType:String ConsoleWrite("IsDeclared:" & IsDeclared("oProfile.XML") & @CRLF) ; IsDeclared:0 ;Because IsDclared() returns 0, It is no supprise these fail... $vResult = Eval("oProfile.XML") ConsoleWrite("Eval: Return=[" & $vResult & "] Error=" & @error & @CRLF) ; Eval: Return=[] Error=1 $vResult = Assign("oProfile.XML", "NewValue", 4) ;4 = Fail if not declared ConsoleWrite("Assign: Return=" & $vResult & " Error=" & @error & @CRLF) ; Assign: Return=0 Error=2 ConsoleWrite(@CRLF) EndFunc ;Scenario 2 Func _Test2() ConsoleWrite("-Scenario 2-" & @CRLF) Local $oProfile, $vResult $oProfile = _Wlan_CreateProfileObject() $oProfile.XML = "OldValue" ConsoleWrite("VarGetType:" & VarGetType("oProfile.XML") & @CRLF) ; VarGetType:String ConsoleWrite("IsDeclared:" & IsDeclared("oProfile.XML") & @CRLF) ; IsDeclared:0 $vResult = Assign("oProfile.XML", "NewValue") ConsoleWrite("Assign: Return=" & $vResult & " Error=" & @error & @CRLF) ; Assign: Return=1 Error=0 ;Assign has now declared oProfile.XML - so eval will work. ConsoleWrite("IsDeclared:" & IsDeclared("oProfile.XML") & @CRLF) ; IsDeclared:-1 $vResult = Eval("oProfile.XML") ConsoleWrite("Eval: Return=[" & $vResult & "] Error=" & @error & @CRLF) ; Eval: Return=[NewValue] Error=0 ;But in the end, the declared oProfile.XML with Assign is just a new variable. ConsoleWrite($oProfile.XML & @CRLF); Returns OldValue EndFunc
    0 points
×
×
  • Create New...