15 julio 2015

Uso de la utilidad del sistema "ditto" de Mac OS, desde Omnis

Crear un Zip, basePath y destName son las respectivas rutas de origen y destino del archivo.


Begin text block
    Text: set dir to "[basePath]" as string (Carriage return)
    Text: set dest to "[destName]" as string (Carriage return)
    Text: set scriptText to "ditto -rsrc -c -k --sequesterRsrc --keepParent " & quoted form of the POSIX path of dir & " " & quoted form of the POSIX path of dest (Carriage return)
    Text: do shell script scriptText
End text block
Get text block script
Do $runapplescript(script,result) Returns error


Descomprimir un Zip, basePath y destName son las respectivas rutas de origen y destino del archivo.


Begin text block
    Text: set dir to "[basePath]" as string (Carriage return)
    Text: set dest to "[destName]" as string (Carriage return)
    Text: set scriptText to "ditto -rsrc -x -k " & quoted form of the POSIX path of dir & " " & quoted form of the POSIX path of dest (Carriage return)
    Text: do shell script scriptText
End text block
Get text block script
Do $runapplescript(script,result) Returns error


Esto eliminaría el archivo temporal después de la copia/descompresión.


Begin text block
    Text: set source to "[pFrom]" as string (Carriage return)
    Text: set targetdir to "[pTo]" as string (Carriage return)
    Text: tell application "Finder" (Carriage return)
    Text: duplicate source to targetdir (Carriage return)
    Text: end tell
End text block
Get text block lScript
Do $runapplescript(lScript,lResult) Returns lnError

No hay comentarios: