GajjarTejas Posted July 28, 2012 Share Posted July 28, 2012 (edited) I'm creating script that extract the .7z file to destination folder.Below Is my script expandcollapse popup#region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <GUIConstantsEx.au3> #include <GuiButton.au3> #region ### START Koda GUI section ### Form=C:UsersTejasDesktopForm1.kxf $Form1 = GUICreate("Form1", 600, 150, 100, 100) $input = GUICtrlCreateInput("", 25, 25, 241, 21) $output = GUICtrlCreateInput("", 25, 65, 241, 21) $inbt = GUICtrlCreateButton("....", 265, 25, 75, 25) $outbt = GUICtrlCreateButton("....", 265, 60, 75, 25) $extract = GUICtrlCreateButton("Extract...", 360, 30, 200, 45) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $inbt $file1 = FileOpenDialog("Input File", "", "All files (*.*;)") If $file1 <> "" Then GUICtrlSetData($input, $file1) Case $outbt $file2 = FileSelectFolder("Choose a folder.", "") If $file2 <> "" Then GUICtrlSetData($output, $file2) Case $extract _7Zip_Extract($file1, $file2,"") EndSwitch WEnd Func _7Zip_Extract($sZipFile, $sDestinationFolder, $sPassword = "") If FileExists($sZipFile) = 0 Then Return SetError(1, 0, 0) EndIf If StringRight($sDestinationFolder, 1) <> "" Then $sDestinationFolder &= "" EndIf If FileExists($sDestinationFolder) = 0 Then DirCreate($sDestinationFolder) EndIf If $sPassword <> "" Then $sPassword = "-p" & '"' & $sPassword & '" ' EndIf Return RunWait('7z.exe' & ' x "' & $sZipFile & '" ' & $sPassword & "-y -o" & '"' & $sDestinationFolder & '"') EndFunc ;==>_7Zip_Extract when i press extract button 7z.exe can not run but when i use @ScriptDir & '7z.exe' its run correctly.in other function look like _7Zip_Add run correctly without adding @ScriptDir & '' what is problem in _7Zip_Extract function? Edited July 28, 2012 by GajjarTejas Link to comment Share on other sites More sharing options...
guinness Posted July 28, 2012 Share Posted July 28, 2012 That function looks like something I created. Anyway, where is 7z.exe located? I would change the 7z.exe to @ScriptDir & '7z.exe' if located in the same directory as your application. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
GajjarTejas Posted July 29, 2012 Author Share Posted July 29, 2012 That function looks like something I created. Anyway, where is 7z.exe located? I would change the 7z.exe to @ScriptDir & '7z.exe' if located in the same directory as your application. 7z.exe is located in script dir but only "7z.exe" not working but when i put "7z.exe" & @ScriptDir & '' Have you tested on your system? is it working without adding @ScriptDir & '' .....? Here is _7Zip_Add function which is working without adding @ScriptDir & '' expandcollapse popupFunc _7Zip_Add($s7z_File_Save_Name, $sDestinationFolder, $sCompression, $sPassword) If FileExists($sDestinationFolder) = 0 Then Return SetError(1, 0, 0) EndIf If StringRight($sDestinationFolder, 1) <> "" Then $sDestinationFolder &= "" EndIf If $sPassword <> "" Then $sPassword = "-p" & '"' & $sPassword & '" ' EndIf If $sCompression <> "" Then Switch $sCompression Case "1-No Compression" $sCompression = " -mx0" Case "2-Fastest Compression" $sCompression = " -mx1" Case "3-Fast Compression" $sCompression = " -mx3" Case "4-Normal Compression" $sCompression = " -mx5" Case "5-Maximum Compression" $sCompression = " -mx7" Case "6-Ultra Compression" $sCompression = " -mx9" EndSwitch EndIf Return RunWait("7z.exe" & " " & "a" & " " & '"' & $s7z_File_Save_Name & '"' & $sCompression & " " & $sPassword & '"' & $sDestinationFolder & "*" & '"', "") ;, @SW_HIDE EndFunc ;==>_7Zip_Add Func _7Zip_Update($name_of_archive, $name_file_to_update) If FileExists($name_of_archive) = 0 Then Return SetError(1, 0, 0) EndIf If FileExists($name_file_to_update) = 0 Then Return SetError(1, 0, 0) EndIf Return RunWait("7z.exe" & " " & "u" & " " & '"' & $name_of_archive & '"' & " " & '"' & $name_file_to_update & '"', "") ;, @SW_HIDE EndFunc ;==>_7Zip_Update 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