Jump to content

abberration

Active Members
  • Posts

    553
  • Joined

  • Last visited

2 Followers

Recent Profile Visitors

3,999 profile views

abberration's Achievements

  1. I think this has to do with #RequireAdmin, which will run the script as an administrator. Try creating the Sageset configuration the exact same way that you run the command. I have created a small example where you can create the command and run it exactly the same way. Maybe it will help? (oh, I prefer shellexecute over run). #RequireAdmin #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 270, 179) $Label1 = GUICtrlCreateLabel("Pick a task:", 16, 16, 60, 17) $Radio1 = GUICtrlCreateRadio("Set Sageset task", 16, 40, 113, 17) $Label2 = GUICtrlCreateLabel("Task #", 48, 64, 38, 17) GUICtrlSetState($Label2, $GUI_DISABLE) $Input1 = GUICtrlCreateInput("", 96, 64, 49, 21) GUICtrlSetState($Input1, $GUI_DISABLE) $Radio2 = GUICtrlCreateRadio("Run Sagetask:", 16, 104, 113, 17) GUICtrlSetState($Radio2, $GUI_CHECKED) $Label3 = GUICtrlCreateLabel("Task # ", 48, 128, 41, 17) $Input2 = GUICtrlCreateInput("", 96, 128, 49, 21) GUICtrlSetState($Input2, $GUI_FOCUS) $Button1 = GUICtrlCreateButton("Go!", 176, 104, 75, 49, $WS_GROUP) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Radio1 GUICtrlSetState($Label2, $GUI_ENABLE) GUICtrlSetState($Input1, $GUI_ENABLE) GUICtrlSetState($Label3, $GUI_DISABLE) GUICtrlSetState($Input2, $GUI_DISABLE) GUICtrlSetState($Input1, $GUI_FOCUS) Case $Radio2 GUICtrlSetState($Label3, $GUI_ENABLE) GUICtrlSetState($Input2, $GUI_ENABLE) GUICtrlSetState($Label2, $GUI_DISABLE) GUICtrlSetState($Input1, $GUI_DISABLE) GUICtrlSetState($Input2, $GUI_FOCUS) Case $Button1 $iRun = GUICtrlRead($Radio1) If $iRun = 4 Then ShellExecute("cleanmgr", "/SAGERUN:1") Else ShellExecute("cleanmgr", "/sageset:1") EndIf Exit EndSwitch WEnd
  2. Tonight, I wanted to be able to add a tab to my GUI like some programs allow with a plus sign on the end. I couldn't find any examples in my search (although I did see a cool UDF that was more complicated than I wanted - and still no plus sign). So, here's what I came up with (oh, right click the tab to be able to delete the current tab that you are on): #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GuiTab.au3> #include <Array.au3> $sAddTabSymbol = " +" Global $aTabs[100] ; make whatever you want or with more code, it can be dynamic $Form1 = GUICreate("My Tabbed Form", 625, 442) $aTabs[0] = GUICtrlCreateTab(16, 24, 585, 385) $Tab1 = $aTabs[0] $aTabs[1] = _GUICtrlTab_InsertItem($Tab1, 0, "TabSheet1") $aTabs[2] = _GUICtrlTab_InsertItem($Tab1, 1, $sAddTabSymbol) $Menu1 = GUICtrlCreateContextMenu($aTabs[0]) $MenuDelTab = GUICtrlCreateMenuItem("Delete Current Tab", $Menu1) GUICtrlSetState(-1,$GUI_SHOW) GUICtrlCreateTabItem("") _GUICtrlTab_SetCurSel($Tab1, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Tab1 $iPos = GUICtrlRead($Tab1) $sTabText = _GUICtrlTab_GetItemText($Tab1, $iPos) If $sTabText = $sAddTabSymbol Then $sAns = InputBox("Create New Tab", "Enter new tab name: ", "New Tab") If $sAns <> "" Then _GUICtrlTab_InsertItem($Tab1, $iPos, $sAns) _GUICtrlTab_SetCurSel($Tab1, $iPos) EndIf EndIf Case $MenuDelTab $iPos = GUICtrlRead($Tab1) $sTabText = _GUICtrlTab_GetItemText($Tab1, $iPos) $iAns = MsgBox(4, "Delete Current Tab", "Do you really want to delete the current tab:" & @CRLF & @CRLF & $sTabText) If $iAns = 6 Then _GUICtrlTab_DeleteItem($Tab1, $iPos) _GUICtrlTab_SetCurSel($Tab1, $iPos - 1) EndIf EndSwitch WEnd
  3. I have had similar troubles with 32-bit dlls. There are two ways I use to make sure I run the AutoIt script as 32 bit to work properly with 32 bit dlls: 1. Compile the script to a 32 bit executable. 2. Right-click the script and go to the bottom option "Run Script (x86)". But yeah, since it is working now that you have your 32 bit stuff sorted out, that was your problem.
  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
  5. 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.
  6. And out of curiosity if I can do it, I'm trying to get a progressbar working. I think I'm close, but no luck so far.
  7. I overlooked that. Simple fix. #include <Crypt.au3> #include <WinAPIConv.au3> #include <GUIConstants.au3> Global $idInput, $g_idOutputEdit, $hashAlgo = $CALG_MD5 Global $idCombo Global $hGUI, $hChildGUI Example() Func Example() ; Create GUI $hGUI = GUICreate("Hash File", 400, 95, -1, -1, -1, $WS_EX_ACCEPTFILES) $idInput = GUICtrlCreateInput("", 10, 20, 300, 20) GUICtrlSetState (-1, $GUI_DROPACCEPTED) 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)) 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) _Hash($sFile) Case $GUI_EVENT_DROPPED $sFileName = GUICtrlRead($idInput) _Hash($sFileName) Case $idCombo $sFileName = GUICtrlRead($idInput) _Hash($sFileName) EndSwitch WEnd EndFunc ;==>Example Func _Hash($sFile) 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_HashFile($sFile, $hashAlgo) $hexHash = Hex($dHash, 8) GUICtrlSetData($g_idOutputEdit, $hexHash) EndIf _Crypt_Shutdown() EndFunc
  8. I made some modifications that eliminate the WM_Command. I tried this code with a 3.3 GB file. It took about 10 seconds to hash, but the gui did not lock up. #include <Crypt.au3> #include <WinAPIConv.au3> #include <GUIConstants.au3> Global $idInput, $g_idOutputEdit, $hashAlgo = $CALG_MD5 Global $idCombo Global $hGUI, $hChildGUI Example() Func Example() ; Create GUI $hGUI = GUICreate("Hash File", 400, 95, -1, -1, -1, $WS_EX_ACCEPTFILES) $idInput = GUICtrlCreateInput("", 10, 20, 300, 20) GUICtrlSetState (-1, $GUI_DROPACCEPTED) 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)) 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) _Hash($sFile) Case $GUI_EVENT_DROPPED $sFileName = GUICtrlRead($idInput) _Hash($sFileName) EndSwitch WEnd EndFunc ;==>Example Func _Hash($sFile) 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_HashFile($sFile, $hashAlgo) $hexHash = Hex($dHash, 8) GUICtrlSetData($g_idOutputEdit, $hexHash) EndIf _Crypt_Shutdown() EndFunc
  9. I meant to mark argumentum's post as the solution. He's the hero today!
  10. Thanks, argumentum! AutoIt3Wrapper.au3 compiles it silently and uses the wrappers. Perfect solution. All I need is to shellexecute it and run the specify the script.
  11. Hi, everyone! I am able to compile from command line and got everything to work except specifying the language. I understand the wrapper uses a 4 digit number for the languages and tried that. However, nothing worked and I do not think there is a switch for specifying the language at all. Is this correct? I also tried writing wrappers to the header and they compile fine if I do so manually, but compiling from command line ignores the wrappers. Is there any way to compile from command line and use the wrappers? I also noticed that "compile with options" does not use Aut2exe, rather it uses AutoIt3.exe (or at least this disappears in task manager when I close the window). Could I possibly pass arguments to it compile? I tried some things, but just get errors. Any insight into this would be appreciated. Thanks!
  12. Personally, I would prefer ShellExecute because of the "parameter" parameter. ShellExecute("MusicPlayer.exe", "C:\Program Files\MusicPlayer\SongSelections\Michael Jackson - Smooth Criminal.mp3 10") But if you really want to run it from command line, I think this would do it. Run("cmd") WinWaitActive("C:\Windows\SYSTEM32\cmd.exe") Send('MusicPlayer.exe ' & '"' & 'C:\Program Files\MusicPlayer\SongSelections\Michael Jackson - Smooth Criminal.mp3 10' & '"') Send("{ENTER}")
  13. My best advice is to type your password in Notepad to make sure you are typing it correctly, your keyboard is not skipping any letters and the caps lock is not turned on. Has the program worked well until now? Are you using it on a different computer than before? Can you copy the files and try it on another computer? Basically, the only reasons I can think of why it would not work is if the encryption DLL built into Windows is not working or if you modified certain parts of the .ini file or the autoit script itself. Rebooting the computer would be worth trying. If you have any details to add that could be affecting the program, it might help in troubleshooting.
  14. Perhaps the easiest way to create an array: #include <Array.au3> $array = StringSplit("one|two|three|birds in a tree", "|", $STR_NOCOUNT) _ArrayDisplay($array)
  15. I am not familiar with Runtime Process, but I suspect it may have something to do with your issue. How about starting calc, waiting for the window to appear, then use WinGetProcess to retrieve the PID?
×
×
  • Create New...