jslegers Posted January 15, 2008 Share Posted January 15, 2008 Hi, I have made a script which runs md5deep on a selected file in Total Commander. Works nice only have one cosmetic problem. Here is the script : expandcollapse popup#include <GUIConstants.au3> #include <Constants.au3> ;Autoit Options AutoItSetOption ( "TrayIconHide", 1 ) ;Variables $inputpst = "" $inputpst2 = "" $varfile = "" $varmd5 = "" ;Creating GUI GUICreate ( "Calculating MD5", 320, 105, -1, -1, $WS_BORDER ) GUISetState ( @SW_SHOW ) ;Creating labels $label = GUICtrlCreateLabel ( "MD5 Hash Code : ",5 ,5 ,200 ) ;Creating action button $button1 = GUICtrlCreateButton ( "Calculate" ,5 ,50 ,60 ) $button2 = GUICtrlCreateButton ( "Compare" ,135, 50, 60 ) $button3 = GUICtrlCreateButton ( "Exit" ,250 ,50, 60 ) ;Displaying GUI until it is closed. While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE or $msg = $button3 ExitLoop Case $msg = $button1 WinSetTitle ( "Calculating MD5", "", "Calculating Hashes please wait... " ) $varfile = Run ( @ScriptDir & "\md5deep.exe " & $CmdLineRaw, '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ;$varfile = Run ( @ScriptDir & "\md5deep.exe " & "c:\windows\notepad.exe", '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) $varmd5 = StringUpper (StringLeft (StdoutRead($varfile), 32)) WinSetTitle ( "Calculating Hashes please wait... ", "", "Calculating MD5" ) GUICtrlCreateLabel ( "MD5 Hash Code : " & $varmd5 ,5 ,5 ,310 ) GUICtrlCreateLabel ( "Original MD5 : ", 5, 25, 70 ) $inputpst = GUICtrlCreateInput ( "Paste MD5 hash here..." ,90 ,25 ,215 ) Case $msg = $button2 $inputpst2 = GUICtrlRead ( $inputpst ) ;If $inputpst2 = "" or "Paste MD5 hash here..." Then ; MsgBox ( 0, "Result", "Nothing to compare." ) ;Else If $varmd5 = $inputpst2 Then MsgBox ( 0, "Result", "Hashes match." ) Else MsgBox ( 0, "Result", "Hashes do not match." ) EndIf ;EndIf EndSelect Wend The problem is in the last section : Case $msg = $button2 $inputpst2 = GUICtrlRead ( $inputpst ) ;If $inputpst2 = "" or "Paste MD5 hash here..." Then ; MsgBox ( 0, "Result", "Nothing to compare." ) ;Else If $varmd5 = $inputpst2 Then MsgBox ( 0, "Result", "Hashes match." ) Else MsgBox ( 0, "Result", "Hashes do not match." ) EndIf ;EndIf If the input field is empty or Paste MD5 hash here... is filled and you press button2 it has to come with the MsgBox ( 0, "Result", "Nothing to compare." ). This works but it doesn't go to If $varmd5 = $inputpst2 Then. It doesn't do a hash check. It stay's in a loop with MsgBox ( 0, "Result", "Nothing to compare." ). For testing you could uncomment ;$varfile = Run ( @ScriptDir & "\md5deep.exe " & "c:\windows\notepad.exe", '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD). I have also used Select and case but no result. What I'm a doing wrong ? Grtz John Link to comment Share on other sites More sharing options...
rasim Posted January 15, 2008 Share Posted January 15, 2008 (edited) What the $inputpst? InputControl id or just variable? Show the full script. And attach the md5deep.exe Edited January 15, 2008 by rasim Link to comment Share on other sites More sharing options...
jslegers Posted January 15, 2008 Author Share Posted January 15, 2008 What the $inputpst? InputControl id or just variable? Show the full script.And attach the md5deep.exeThis is the full script.$inputpst = GUICtrlCreateInput ( "Paste MD5 hash here..." ,90 ,25 ,215 ) Link to comment Share on other sites More sharing options...
Siao Posted January 15, 2008 Share Posted January 15, 2008 If the input field is empty or Paste MD5 hash here... is filled and you press button2 it has to come with the MsgBox ( 0, "Result", "Nothing to compare." ). This works but it doesn't go to If $varmd5 = $inputpst2 Then. It doesn't do a hash check. It stay's in a loop with MsgBox ( 0, "Result", "Nothing to compare." ).I don't get the logic in your dismay.If the input is wrong and there is "nothing to compare", why should it proceed to compare? "be smart, drink your wine" Link to comment Share on other sites More sharing options...
rasim Posted January 15, 2008 Share Posted January 15, 2008 This? expandcollapse popup#include <GUIConstants.au3> #include <Constants.au3> ;Autoit Options AutoItSetOption ( "TrayIconHide", 1 ) ;Variables $inputpst = "" $inputpst2 = "" $varfile = "" $varmd5 = "" ;Creating GUI GUICreate ( "Calculating MD5", 320, 105, -1, -1, $WS_BORDER ) GUISetState ( @SW_SHOW ) ;Creating labels $label = GUICtrlCreateLabel ( "MD5 Hash Code : ",5 ,5 ,200 ) ;Creating action button $button1 = GUICtrlCreateButton ( "Calculate" ,5 ,50 ,60 ) $button2 = GUICtrlCreateButton ( "Compare" ,135, 50, 60 ) $button3 = GUICtrlCreateButton ( "Exit" ,250 ,50, 60 ) ;Displaying GUI until it is closed. While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE or $msg = $button3 ExitLoop Case $msg = $button1 WinSetTitle ( "Calculating MD5", "", "Calculating Hashes please wait... " ) $varfile = Run ( @ScriptDir & "\md5deep.exe " & "c:\windows\notepad.exe", '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ;ConsoleWrite(StdoutRead($varfile)) $varmd5 = StringLeft(StdoutRead($varfile), 32) WinSetTitle ( "Calculating Hashes please wait... ", "", "Calculating MD5" ) GUICtrlCreateLabel ( "MD5 Hash Code : " & $varmd5 ,5 ,5 ,310 ) GUICtrlCreateLabel ( "Original MD5 : ", 5, 25, 70 ) $inputpst = GUICtrlCreateInput ( "Paste MD5 hash here..." ,90 ,25 ,215 ) Case $msg = $button2 $inputpst2 = GUICtrlRead ($inputpst) If ($inputpst2 = "") Or ($inputpst2 = "Paste MD5 hash here...") Then MsgBox ( 0, "Result", "Nothing to compare." ) ElseIf $varmd5 = $inputpst2 Then MsgBox ( 0, "Result", "Hashes match." ) Else MsgBox ( 0, "Result", "Hashes do not match." ) EndIf EndSelect Wend Link to comment Share on other sites More sharing options...
jslegers Posted January 15, 2008 Author Share Posted January 15, 2008 Thanks rasim this is the good version. Learned one thing again. Thanks. Link to comment Share on other sites More sharing options...
ptrex Posted January 15, 2008 Share Posted January 15, 2008 @jslegersYou might be interested in this ?MD5 Duplicate File Finderregardsptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now