AlMax3000 Posted November 23, 2019 Share Posted November 23, 2019 Hi! editing a small compressor for the school I can't understand where I'm wrong 😟 #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 565, 160, -1, -1) $Inp = GUICtrlCreateInput("", 8, 32, 465, 21) $Out = GUICtrlCreateInput("", 8, 64, 465, 21) $Button1 = GUICtrlCreateButton("Browse", 480, 32, 75, 25) $Button2 = GUICtrlCreateButton("Save", 480, 64, 75, 25) $Button3 = GUICtrlCreateButton("Compress", 480, 128, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $7zDir = '"' & @ScriptDir & '\Bin\7z.exe"' While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $sFileSelectFolder = FileSelectFolder("", "") GUICtrlSetData($Inp, $sFileSelectFolder) Case $Button2 $sFileSaveDialog = FileSaveDialog("Save file", @WorkingDir, "(*.7z)") GUICtrlSetData($Out, $sFileSaveDialog) Case $Button3 _Seven_Zip() EndSwitch WEnd Func _Seven_Zip() $cmd = Run($7zDir & " a -mx " & GUICtrlRead($Out) & " " & GUICtrlRead($Inp) & "\*") EndFunc Link to comment Share on other sites More sharing options...
Nine Posted November 23, 2019 Share Posted November 23, 2019 Add quotes around out and inp like you did for the exe. AlMax3000 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
AlMax3000 Posted November 23, 2019 Author Share Posted November 23, 2019 (edited) 32 minutes ago, Nine said: Add quotes around out and inp like you did for the exe. not work with large files $cmd = Run($7zDir & " a -mx " & "" & GUICtrlRead($Out) & " " & GUICtrlRead($Inp) & "\*") Edited November 23, 2019 by AlMax3000 Link to comment Share on other sites More sharing options...
Developers Jos Posted November 23, 2019 Developers Share Posted November 23, 2019 (edited) you didn't add a double quote around the filenames! Try: $cmd = Run($7zDir & ' a -mx "' & GUICtrlRead($Out) & '" "' & GUICtrlRead($Inp) & '\*"') Jos Edited November 23, 2019 by Jos AlMax3000 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
AlMax3000 Posted November 23, 2019 Author Share Posted November 23, 2019 57 minutes ago, Jos said: Thanks Jos.. perfect!! Link to comment Share on other sites More sharing options...
Musashi Posted November 23, 2019 Share Posted November 23, 2019 Just a hint : If you would like to have a progress bar while zipping, you can use the command line variant 7zG.exe. This might look better than the CMD console output . You will find 7zG.exe (also needs the 7z.dll) in the full installation of 7-Zip. Replace : 5 hours ago, AlMax3000 said: $7zDir = '"' & @ScriptDir & '\Bin\7z.exe"' with : Global $7zDir = '"' & @ScriptDir & '\Bin\7zG.exe"' "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
AlMax3000 Posted November 23, 2019 Author Share Posted November 23, 2019 1 hour ago, Musashi said: Solo un suggerimento: Se si desidera avere una barra di avanzamento durante la compressione, è possibile utilizzare la variante da riga di comando 7zG.exe . Questo potrebbe apparire migliore dell'output della console CMD . Troverai 7zG.exe (necessita anche di 7z.dll ) nell'installazione completa di 7-Zip . Sostituisci : con : Global $ 7zDir = '"' & @ScriptDir & '\ Bin \ 7zG.exe"' I would like to redirect the cmd to the inputbox or listbox to delete the 7z.exe window... is it possible? Link to comment Share on other sites More sharing options...
Nine Posted November 23, 2019 Share Posted November 23, 2019 12 minutes ago, AlMax3000 said: I would like to redirect the cmd to the inputbox or listbox to delete the 7z.exe window... is it possible? Everything is possible. But it is not clear (to me at least) what that means. Write some code, so we can figure what you are after. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
AlMax3000 Posted November 23, 2019 Author Share Posted November 23, 2019 1 hour ago, Nine said: Everything is possible. But it is not clear (to me at least) what that means. Write some code, so we can figure what you are after. $InpConsole = GUICtrlCreateInput("", 8, 176, 545, 200) Func _Seven_Zip() If GuiCtrlRead($Inp) = "" or GuiCtrlRead($Out) = "" then MsgBox (64,"Controlla le caselle", "una o più caselle sono vuote") $cmd = Run($7zDir & ' a -mx "' & GUICtrlRead($Out) & '" "' & GUICtrlRead($Inp) & '\*"') $InpConsole &= StdoutRead($cmd) EndFunc Link to comment Share on other sites More sharing options...
Nine Posted November 24, 2019 Share Posted November 24, 2019 ahh, I see. Try this (untested) : $InpConsole = GUICtrlCreateInput("", 8, 176, 545, 200) ; .... GUICtrlSetData ($InpConsole, _Seven_Zip ()) Func _Seven_Zip() If GuiCtrlRead($Inp) = "" or GuiCtrlRead($Out) = "" then Return MsgBox (64,"Controlla le caselle", "una o più caselle sono vuote") $cmd = Run($7zDir & ' a -mx "' & GUICtrlRead($Out) & '" "' & GUICtrlRead($Inp) & '\*"',"",@SW_HIDE,$STDERR_MERGED) ProcessWaitClose ($cmd) Return StdoutRead($cmd) EndFunc AlMax3000 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
TheDcoder Posted November 24, 2019 Share Posted November 24, 2019 14 hours ago, AlMax3000 said: I would like to redirect the cmd to the inputbox or listbox to delete the 7z.exe window... is it possible? You should check out my Process UDF which is exactly what it is supposed to do that and it even has an example of a GUI which shows you the output of a command: AlMax3000 1 EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time) DcodingTheWeb Forum - Follow for updates and Join for discussion 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