Installer Droplet

Dante101

Ralls Genet
Registriert
11.10.05
Beiträge
5.048
Liebe Pros!

Ich brauche dringend Eure Hilfe.

Ich würde gerne einen kleinen Installer erstellen. Ein .dmg hab ich schon erstellt. Das Problem:

Ich habe 2 Dateien in einem Ordner auf der .dmg.
File A und File B.

Bei Drag&Drop dieses Ordners auf das Script(Droplet) soll File A in den Ordner User/Applications und File B in den Ordner User/Library/Application Support/ApplicationXY kopiert werden.

Wie könnte dieses Script aussehen?

Ihr würdet mir einen riesen Gefallen tun.

Liebe Grüße
Daniel
 

Skeeve

Pomme d'or
Registriert
26.10.05
Beiträge
3.120
Müßte ungefähr so aussehen, wobei ich mir mit dem ... Teil noch nicht so klar bin (und jetzt das Essen auf dem Tisch steht) ;)
Code:
on open some_list
	repeat with something in some_list
		set information to info for something
		if folder of information is true then
			tell application "Finder" 
				copy file "A" of something to ...
				copy file "B" of something to ...
			end tell
		end if
	end repeat
end open
 

schnydi

James Grieve
Registriert
08.01.06
Beiträge
137
Mit dem folgenden Scipt werden Dateien mit der Endung .app in den Programm Ordner verschoben, alle anderen Dateien werden in den Ordner XY im Application Support Ordner geschoben.

Code:
property applicationsFolder : "app"
property applicationsSupportFolderName : "XY"

on run
	
end run

on open (draggeditems)
	set draggeditems to draggeditems as list
	tell application "Finder"
		repeat with i from 1 to (count of items in draggeditems)
			set theFile to item i of draggeditems
			set copyFileName to name of theFile
			set nameExtension to (name extension of theFile)
			if nameExtension is in applicationsFolder then
				set theFile to item i in draggeditems
				set copyFile to (duplicate theFile as alias)
				set newFile to (move copyFile to folder "Applications" of startup disk with replacing and routing suppressed)
				set name of newFile to copyFileName
			else
				set theFile to item i in draggeditems
				set copyFile to (duplicate theFile as alias)
				set newFile to (move copyFile to folder applicationsSupportFolderName of folder "Application Support" of folder "Library" of startup disk with replacing and routing suppressed)
				set name of newFile to copyFileName
			end if
		end repeat
	end tell
end open

Nachteil: Jeweils eine Kopie der zuverschiebenden Datei landet noch im Papierkorb. Zur löschung der Datei währe wohl ein "do shell script" angebracht.

Die Developer Tools von Apple liefern einen Installer mit. Wenn du die Developer Tools Installiert hast, findest du ihn unter: Developer/Applications/Utilities/PackageMaker
 

space

Neuer Berner Rosenapfel
Registriert
02.12.05
Beiträge
1.949
Lustig… mein Script wäre wieder anders:

Code:
on open
	set AppPAth to path to applications folder
	set AppSupPath to path to application support
	
	tell application "Finder"
		
		move file "Pfad:zum:Ordner:FileA" to AppPAth with replacing
		move file "Pfad:zum:Ordner:FileB" to folder "XY" of folder AppSupPath with replacing
	end tell
end open

Upps sehe gerade, Du wolltest FileB in User/Library/Application Support/XY haben…
Dieses Skript kopiert aber FileB nach /Library/Application Support/XY …


Gruss
 

Dante101

Ralls Genet
Registriert
11.10.05
Beiträge
5.048
Lustig... mein Script wäre wieder anders:

Code:
on open
    set AppPAth to path to applications folder
    set AppSupPath to path to application support
    
    tell application "Finder"
        
        move file "Pfad:zum:Ordner:FileA" to AppPAth with replacing
        move file "Pfad:zum:Ordner:FileB" to folder "XY" of folder AppSupPath with replacing
    end tell
end open
Upps sehe gerade, Du wolltest FileB in User/Library/Application Support/XY haben...
Dieses Skript kopiert aber FileB nach /Library/Application Support/XY ...


Gruss
Tja welches nehm ich nun? :p

Verstehe ich das richtig, dass /Library/Application Support/XY dann für alle User gilt?
 

Dante101

Ralls Genet
Registriert
11.10.05
Beiträge
5.048
Und noch eine Frage: Wie definiere ich jetzt genau den Pfad zu den Files in meinem .dmg?

Code:
 move file "Volumes/Volumename/Foldername/Filename" to AppPAth with replacing

Stimmt ja anscheinend nicht. Oder sollte es doch?
 

Dante101

Ralls Genet
Registriert
11.10.05
Beiträge
5.048
Hab jetzt folgendes:

Code:
on open
    set AppPAth to path to applications folder
    set AppSupPath to path to application support
    
    tell application "Finder"
        move file "FileA.app" of "/Volumes/VolumeA" to AppPAth with replacing
        move file "FileB" of "/Volumes/VolumeA" to folder "XY" of folder AppSupPath with replacing
    end tell
end open
Fehlermeldung:
screenshot01ei6.jpg


*schwitz* was ist ein "integer"?
 

space

Neuer Berner Rosenapfel
Registriert
02.12.05
Beiträge
1.949
Hi!
Der Pfad muss mit : statt / getrennt werden und fängt beim Volumenname an:


Code:
on open
    set AppPAth to path to applications folder
    set AppSupPath to path to application support
    
    tell application "Finder"
        
        move file "VolumeA:Foldername:FileA.app" to AppPAth with replacing
        move file "VolumeA:Foldername:FileB" to folder "XY" of folder AppSupPath with replacing
    end tell
end open


Dante101 schrieb:
Verstehe ich das richtig, dass /Library/Application Support/XY dann für alle User gilt?
Ja... aber das ist relativ egal, oder? Schau mal in beide Application Support Ordner und Du wirst sehen, das sich in Beiden von dir installierte Programme tümmeln
 

Dante101

Ralls Genet
Registriert
11.10.05
Beiträge
5.048
Stimmt. Das wäre nicht das Problem. Ich habe mir jetzt mal die Developer Tools installiert. Also Ihr habt recht, ein Package wäre auch eine schöne Lösung (wenn nicht sogar schöner)

Kennt sich damit jemand aus? Ich weiss, mit AppleScript hat das nichts mehr zu tun, aber ich will deshalb nicht wieder einen neuen Thread anfangen. Reicht ja, wenn der Saustall hier weitergeht ;)

Ich habe damit nun folgendes Problem:

Ich erstelle zuerst für jedes der beiden files ein Package, das die Dateien dort installiert, wo sie hingehören. (Ich würde sie danach in einem Meta Package zusammenfügen)

Mit der Application ist das auch kein Problem, aber mit der Erweiterung. Er will mir diese einfach nicht in den Application Support Folder kopieren. Er installiert nur auf Macintosh HD. Was könnte ich da falsch gemacht haben?

Übrigens: Vielen Dank für die bisherige Beteiligung. Ihr helft mir sehr.

LG
Daniel
 

space

Neuer Berner Rosenapfel
Registriert
02.12.05
Beiträge
1.949
Hi Dante101
Nochwas:

Der Ordner XY muss bestimmt erst erstellt werden oder?

Dann lautet das Skript folgendermaßen:


Code:
property XY_foldername : "XY"

on open
	set AppPAth to path to applications folder
	set AppSuppPath to path to application support
	
	tell application "Finder"
		
		
		if not (exists folder "XY" of folder AppSuppPath) then
			make new folder at AppSuppPath with properties {name:XY_foldername}
		end if
		
		
		move file "VolumeA:Foldername:FileA.app" to AppPAth with replacing
		move file "VolumeA:Foldername:FileB" to folder "XY" of folder AppSuppPath with replacing
	end tell
end open
 
Zuletzt bearbeitet:

Soul Monkey

Gast
Sag mal space, hat es einen Grund das du am Anfang und Ende des Skripts "AppSupPath" verwendest und im Mittelteil "AppSuppPath"?
 

space

Neuer Berner Rosenapfel
Registriert
02.12.05
Beiträge
1.949
Auweia … wird gleich verbessert :eek:
Hätte mir was einfacheres Ausdenken sollen, statt so ein Unwort

Gruss
 

quarx

Brauner Matapfel
Registriert
17.04.05
Beiträge
8.444
Das große A in AppPAth fällt dann auch unter "künstlerische Freiheit"... :p
 

Dante101

Ralls Genet
Registriert
11.10.05
Beiträge
5.048
Wie kann ich beim PackageMaker das Ziel auf einen Homeordner legen? Also zB FileA in "/User/Library/Application Support" (er erlaubt mit nur "/Library/Application Support" und dann ist er aber im allgemeinen, das Programm greift aber dafür auf die Daten im User-Folder zu)
 

MacMark

Jakob Lebel
Registriert
01.01.05
Beiträge
4.874
"Relocateable" einstellen für das Paket. Dann kann er den Ort bestimmen.
 

Dante101

Ralls Genet
Registriert
11.10.05
Beiträge
5.048
Der User soll aber nicht den Ort bestimmen können. Es sollte automatisch in dem jeweiligen User-Ordner installiert werden.