Jump to content

Recommended Posts

Posted

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
Posted (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 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

Posted

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.

:P

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
Posted

YOU GUYS ROCK!!!

Exactly what I needed.

Thanks!

-Mike

Global $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
Posted

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.)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...