X11-Programme über Skript mit Daten-Typen verbinden

slackfr

Aktives Mitglied
Thread Starter
Dabei seit
20.02.2006
Beiträge
425
Reaktionspunkte
1
suche nach einer möglichkeit X11-Programme mit bestimmer Datei-Typen über skript zu Verbinden,
habe dazu dies hier gefunden, jedoch auch nach der umänderung auf mein Programm (GNUmeric) und den nötogen Datei-Typen wird das Programm nicht ausgeführt.

so sieht das skript bei mir aus, jedoch wird bei starten einer datei über das skript der Fehler angezeigt: "The variable currentProgram is not defined"

Code:
-- ProgramLauncher.applescript
-- ProgramLauncher

tell application "Finder"
	launch application "X11"
	activate
end tell

global currentProgram
global currentProgramFancy
set currentProgram to "gnumeric-1.6.3"
set currentProgramFancy to "gnumeric-1.6.3"

-- the list of file types which will be processed, then list of extensions if there is no type
property type_list : {"XLS", "DOC"}
property extension_list : {"xls", "doc"}


-- Variable used to see if we should just run the program (if no files are passed in.)
global prog_launched
set prog_launched to false

on open these_items
	set prog_launched to true
	
	if ((count of these_items) > 0) then
		repeat with i from 1 to the count of these_items
			set this_item to (item i of these_items)
			set the item_info to info for this_item
			
			if (folder of the item_info is false) and ¬
				(alias of the item_info is false) and ¬
				((the file type of the item_info is in the type_list) or ¬
					the name extension of the item_info is in the extension_list) then
				
				set results to do shell script "cd ~; DISPLAY=:0.0;
export DISPLAY; PATH=$PATH:/sw/bin; export PATH ;
/sw/bin/" & currentProgram & " " & quoted form of POSIX path of this_item & " > /dev/null 2>&1 &"
				delay 2
			else
				display dialog "Sorry " & currentProgramFancy & ", can't open this file type."
			end if
		end repeat
	end if
end open

-- So the user double-clicked on the icon. Better just launch!
-- Now, if this was really smart, it'd check the process list to
-- see if the program was already running and bring it to the front
-- instead. Me, I still find AppleScript annoying, so I'll do
-- without that for now. ;-)
if not (prog_launched) then
	set results to do shell script "cd ~; DISPLAY=:0.0;
export DISPLAY; PATH=$PATH:/sw/bin; export PATH ;
/sw/bin/" & currentProgram & " > /dev/null 2>&1 &"
end if
 
es war alles richtig, jedoch musste überall wo
Code:
/sw/bin/
stand, der ordner angegeben werden, wo auch das gewünschte programm (GNUmeric) sich befindet ;)

in diesem fall:
Code:
/opt/local/bin/
 
nun habe ich das gleich eProblem, wie der Erst-Verfasser dieses Skripts, ich kann nicht dem Finder es beibringen das alle Dateien von Diesem Typ nun mit diesem Skript geöffnet werden,
wie kriege ich dies hin???
 
kennt jemand was, würde echt gern GNUmeric standard mäßig für alle .xls datein & Co. verwenden
 
die umständliche arveit mit den Skripten kann man umgehen, dazu habe ich ein Tool gefunden, welches fast automatisch X11-Programme in den Finder einbindet:

XDroplets

hier sind auch schon einige vorgefertigte Wraper fertig,
jedoch ist das alte Problem, dass man diese Anwendungen nicht als Standard setzen kann, immer noch vorhanden,
bitte um Rat
 
habe jetzt festgestellt, dass wenn ich Date unbekannnten Typs (z.B. *.gnumeric) erstelle, so fragt ja OSX nach einem Standardprogramm welches ich nun festlegen soll:
Standardprog.png


nun wähle ich, dass durch XDroplets erstellt, Gnumeric.app

nach der auswahl bekomme ich diese Fehlermeldung:
"es ist ein unbekannnter Fehler aufgetreten (Fehler -10814)"
10814.png


weiß jemand Rat?
 
Zurück
Oben Unten