- Registriert
- 23.12.14
- Beiträge
- 3
Ich habe nach langer Suche endlich ein funktionierendes Script zum entpacken von RAR-Dateien gefunden und dieses soweit meinen Bedürfnissen angepasst. Leider fehlt noch etwas darin. Es soll sofern ein Passwort vorhanden ist, danach in einem Fenster mit Eingabemaske gefragt werden. Was fehlt dazu?
Gruß
Die letzte Zeile müsste wie folgt aussehen damit ein Passwort akzeptiert wird. Allerdings hat nun mal nicht jedes Archiv das selbe Passwort.
Gruß
Code:
on run {input, parameters}
set nbFiles to count input
if nbFiles = 0 then
display dialog "Aucun fichier sélectionné!" buttons {"OK"} default button 1
return
end if
if nbFiles > 1 then
display dialog "Ce script ne peut pas décompresser plusieurs fichiers à la fois" buttons {"OK"} default button 1
return
end if
tell application "Finder"
set archiveDir to (container of (item 1 of input) as string)
set archiveName to (name of (item 1 of input) as string)
set fileAlias to the selection as alias
set fileName to name of fileAlias
set fileExtension to name extension of fileAlias
if fileExtension = "rar" then
else
display dialog "Ce fichier ne semble pas être un fichier RAR !" buttons {"OK"} default button 1
return
end if
set myword to POSIX path of archiveDir&fileName
set myword to quoted form of myword
set archiveDir to quoted form of POSIX path of archiveDir
set archiveName to quoted form of (archiveName)
end tell
do shell script "cd " & archiveDir & ";/bin/unrar x -y " & myword
return input
end run
Die letzte Zeile müsste wie folgt aussehen damit ein Passwort akzeptiert wird. Allerdings hat nun mal nicht jedes Archiv das selbe Passwort.
Code:
do shell script "cd " & archiveDir & ";/bin/unrar x -y -pPASSWORT" & myword