mdwerne Posted March 11, 2009 Share Posted March 11, 2009 Morning, So here is the code I have so far. What it essentially does is allow me to drop an SFX Archive on top of the icon and extract out (and read/display) one of the ini files. My problems are two fold. 1) If there is a space in the path name to the $SEPArchive (eg...C:\Documents and settings) then I break and cannot find/read the ini file. How do I enclose line 4 in quotes or something to preserve the word spaces? 2) How can I change line 3 (currently commented out) so that I have the option to either drag and drop the SFX archive or just manually launch the app and browse to the archive? I think I need to add something that tests if $CmdLine[1] contains anything...and if not, then FileOpenDialog. Just now sure how. Thanks for any suggestions! -Mike $SEPArchive = $CmdLine[1] FileInstall("7za.exe", @TempDir & "\7za.exe") ;$SEPArchive = FileOpenDialog("Select the SEP installer", @ScriptDir, "SEP Installer (*.exe)") RunWait(@TempDir & "7za.exe x " & $SEPArchive & " " & "setAid.ini", @TempDir, @SW_SHOW) $PlatformType = IniRead(@TempDir & "\setAid.ini", "PREDEFINED_SMC_CONFIG", "PlatformType", "NotFound") $DisplayName = IniRead(@TempDir & "\setAid.ini", "LU_CONFIG", "DisplayName", "NotFound") $CONNECT_LU_SERVER = IniRead(@TempDir & "\setAid.ini", "LU_CONFIG", "CONNECT_LU_SERVER", "NotFound") $SAVMain = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "SAVMain", "NotFound") $EMailTools = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "EMailTools", "NotFound") $OutlookSnapin = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "OutlookSnapin", "NotFound") $NotesSnapin = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "NotesSnapin", "NotFound") $Pop3Smtp = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "Pop3Smtp", "NotFound") $ITPMain = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "ITPMain", "NotFound") $Firewall = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "Firewall", "NotFound") $PTPMain = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "PTPMain", "NotFound") $COHMain = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "COHMain", "NotFound") $DCMain = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "DCMain", "NotFound") MsgBox(4096, "Result", $DisplayName & @CRLF & @CRLF & _ "PlatformType: " & $PlatformType & @CRLF & _ "CONNECT_LU_SERVER: " & $CONNECT_LU_SERVER & @CRLF & _ "SAVMain: " & $SAVMain & @CRLF & _ "EMailTools: " & $EMailTools & @CRLF & _ "OutlookSnapin: " & $OutlookSnapin & @CRLF & _ "NotesSnapin: " & $NotesSnapin & @CRLF & _ "Pop3Smtp: " & $Pop3Smtp & @CRLF & _ "ITPMain: " & $ITPMain & @CRLF & _ "Firewall: " & $Firewall & @CRLF & _ "PTPMain: " & $PTPMain & @CRLF & _ "COHMain: " & $COHMain & @CRLF & _ "DCMain: " & $DCMain & @CRLF & @CRLF & _ "Archive tested: " & $SEPArchive & @CRLF) FileDelete(@TempDir & "\7za.exe") FileDelete(@TempDir & "\setAid.ini") Exit Link to comment Share on other sites More sharing options...
ProgAndy Posted March 11, 2009 Share Posted March 11, 2009 (edited) 1) There are single and double quotes: AutoIt parses both, Run just double quotes. So use single quotes to enclose double quotes for Run & '7za.exe x "' & $SEPArchive & '" ' & 2) Check $CMDLINE[0] - this contains the number of cmdline-args If $CMDLINE[0] > 0 Then $file = ... Else $file = ... EndIf Edited March 11, 2009 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
Zedna Posted March 11, 2009 Share Posted March 11, 2009 (edited) 1) RunWait(@TempDir & "\7za.exe x " & FileGetShortName($SEPArchive) & " " & "setAid.ini", @TempDir, @SW_SHOW) Edited March 11, 2009 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 11, 2009 Share Posted March 11, 2009 Morning, So here is the code I have so far. What it essentially does is allow me to drop an SFX Archive on top of the icon and extract out (and read/display) one of the ini files. My problems are two fold. 1) If there is a space in the path name to the $SEPArchive (eg...C:\Documents and settings) then I break and cannot find/read the ini file. How do I enclose line 4 in quotes or something to preserve the word spaces? 2) How can I change line 3 (currently commented out) so that I have the option to either drag and drop the SFX archive or just manually launch the app and browse to the archive? I think I need to add something that tests if $CmdLine[1] contains anything...and if not, then FileOpenDialog. Just now sure how. Thanks for any suggestions! -Mike $SEPArchive = $CmdLine[1] FileInstall("7za.exe", @TempDir & "\7za.exe") ;$SEPArchive = FileOpenDialog("Select the SEP installer", @ScriptDir, "SEP Installer (*.exe)") RunWait(@TempDir & "7za.exe x " & $SEPArchive & " " & "setAid.ini", @TempDir, @SW_SHOW) $PlatformType = IniRead(@TempDir & "\setAid.ini", "PREDEFINED_SMC_CONFIG", "PlatformType", "NotFound") $DisplayName = IniRead(@TempDir & "\setAid.ini", "LU_CONFIG", "DisplayName", "NotFound") $CONNECT_LU_SERVER = IniRead(@TempDir & "\setAid.ini", "LU_CONFIG", "CONNECT_LU_SERVER", "NotFound") $SAVMain = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "SAVMain", "NotFound") $EMailTools = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "EMailTools", "NotFound") $OutlookSnapin = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "OutlookSnapin", "NotFound") $NotesSnapin = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "NotesSnapin", "NotFound") $Pop3Smtp = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "Pop3Smtp", "NotFound") $ITPMain = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "ITPMain", "NotFound") $Firewall = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "Firewall", "NotFound") $PTPMain = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "PTPMain", "NotFound") $COHMain = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "COHMain", "NotFound") $DCMain = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "DCMain", "NotFound") MsgBox(4096, "Result", $DisplayName & @CRLF & @CRLF & _ "PlatformType: " & $PlatformType & @CRLF & _ "CONNECT_LU_SERVER: " & $CONNECT_LU_SERVER & @CRLF & _ "SAVMain: " & $SAVMain & @CRLF & _ "EMailTools: " & $EMailTools & @CRLF & _ "OutlookSnapin: " & $OutlookSnapin & @CRLF & _ "NotesSnapin: " & $NotesSnapin & @CRLF & _ "Pop3Smtp: " & $Pop3Smtp & @CRLF & _ "ITPMain: " & $ITPMain & @CRLF & _ "Firewall: " & $Firewall & @CRLF & _ "PTPMain: " & $PTPMain & @CRLF & _ "COHMain: " & $COHMain & @CRLF & _ "DCMain: " & $DCMain & @CRLF & @CRLF & _ "Archive tested: " & $SEPArchive & @CRLF) FileDelete(@TempDir & "\7za.exe") FileDelete(@TempDir & "\setAid.ini") Exit For example: RunWait(@TempDir & '7za.exe x "' & $SEPArchive & '" setAid.ini', @TempDir, @SW_SHOW) Note single quotes are enclosing literal double qoutes. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
mdwerne Posted March 11, 2009 Author Share Posted March 11, 2009 YOU GUYS ROCK!!! Exactly what I needed. Thanks! -Mike expandcollapse popupGlobal $SEPArchive If $CMDLINE[0] > 0 Then $SEPArchive = $CMDLINE[1] ckArchive() Else $SEPArchive = FileOpenDialog("Select the SEP installer", @ScriptDir, "SEP Installer (*.exe)") ckArchive() EndIf Func ckArchive() FileInstall("7za.exe", @TempDir & "\7za.exe") RunWait(@TempDir & "\7za.exe x " & FileGetShortName($SEPArchive) & " " & "setAid.ini", @TempDir, @SW_SHOW) $PlatformType = IniRead(@TempDir & "\setAid.ini", "PREDEFINED_SMC_CONFIG", "PlatformType", "NotFound") $DisplayName = IniRead(@TempDir & "\setAid.ini", "LU_CONFIG", "DisplayName", "NotFound") $CONNECT_LU_SERVER = IniRead(@TempDir & "\setAid.ini", "LU_CONFIG", "CONNECT_LU_SERVER", "NotFound") $SAVMain = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "SAVMain", "NotFound") $EMailTools = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "EMailTools", "NotFound") $OutlookSnapin = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "OutlookSnapin", "NotFound") $NotesSnapin = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "NotesSnapin", "NotFound") $Pop3Smtp = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "Pop3Smtp", "NotFound") $ITPMain = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "ITPMain", "NotFound") $Firewall = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "Firewall", "NotFound") $PTPMain = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "PTPMain", "NotFound") $COHMain = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "COHMain", "NotFound") $DCMain = IniRead(@TempDir & "\setAid.ini", "FEATURE_SELECTION", "DCMain", "NotFound") MsgBox(4096, "Result", $DisplayName & @CRLF & @CRLF & _ "PlatformType: " & $PlatformType & @CRLF & _ "CONNECT_LU_SERVER: " & $CONNECT_LU_SERVER & @CRLF & _ "SAVMain: " & $SAVMain & @CRLF & _ "EMailTools: " & $EMailTools & @CRLF & _ "OutlookSnapin: " & $OutlookSnapin & @CRLF & _ "NotesSnapin: " & $NotesSnapin & @CRLF & _ "Pop3Smtp: " & $Pop3Smtp & @CRLF & _ "ITPMain: " & $ITPMain & @CRLF & _ "Firewall: " & $Firewall & @CRLF & _ "PTPMain: " & $PTPMain & @CRLF & _ "COHMain: " & $COHMain & @CRLF & _ "DCMain: " & $DCMain & @CRLF & @CRLF & _ "Archive tested: " & $SEPArchive & @CRLF) FileDelete(@TempDir & "\7za.exe") FileDelete(@TempDir & "\setAid.ini") Exit EndFunc ;==>ckArchive Link to comment Share on other sites More sharing options...
Ascend4nt Posted March 11, 2009 Share Posted March 11, 2009 To be absolutely certain of compatibility, I wouldn't use FileGetShortName(), because it is possible to turn off Short Names support. (If you'd like to know how - Maximum PC magazine did an article which covers how to disable it.) My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) 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