Apple Script restart

Blinkwing

Mitglied
Thread Starter
Registriert
12.07.2009
Beiträge
80
Reaktionspunkte
2
OK, hier ist zuerst das Skript, unten erläutere ich mein problem:

Code:
display dialog "Huhu" buttons {"Go", "Settings", "Abbrechen"} default button 1

[COLOR="Red"]if button returned of result = "Settings" then
tell application "System Preferences"
        activate
end tell[/COLOR]

else if button returned of result = "Go" then
tell application "Terminal"
	quit
end tell

else
	
end if


So, den Fehler habe ich rot markiert. Generell ist es eigentlich kein Fehler, sondern eher ein Problem von mir. Drücke ich nun den Knopf "Settings", schließt sich das Script und startet die Systemeinstellungen, aber ich will, dass sich das Script dann wieder öffnet, sozusagen beim öffnen der Systemeinstellungen.
Loops usw. haben nicht gefunzt; der Mac erwartet dann entweder anstatt von "end repeat" ein "end tell" oder ein "else if" (wegen den Knöpfen)

Ich würde mich über Hilfe freuen

cheers

Blinkwing
 
Hi,

eventuell missverstehe ich Dich, aber sei es drum. Vielleicht hilft Dir der Code ja doch :D

Code:
on run
	my function()
end run

on function()
	tell me
		activate
		display dialog "Huhu" buttons {"Go", "Settings", "Abbrechen"} default button 1
		set dlgresult to result
	end tell
	
	if button returned of dlgresult = "Settings" then
		tell application "System Preferences"
			activate
		end tell
		my function()
		return
		
	else if button returned of result = "Go" then
		tell application "Terminal"
			quit
		end tell
	else
		beep
	end if
end function

Viele Grüße aus Berlin

Martin
 
Hi,

eventuell missverstehe ich Dich, aber sei es drum. Vielleicht hilft Dir der Code ja doch :D

Code:
on run
	my function()
end run

on function()
	tell me
		activate
		display dialog "Huhu" buttons {"Go", "Settings", "Abbrechen"} default button 1
		set dlgresult to result
	end tell
	
	if button returned of dlgresult = "Settings" then
		tell application "System Preferences"
			activate
		end tell
		my function()
		return
		
	else if button returned of result = "Go" then
		tell application "Terminal"
			quit
		end tell
	else
		beep
	end if
end function

Viele Grüße aus Berlin

Martin


Martin = AppleScript Gott!

Martin!
Vielen Dank, dass du mir dabei geholfen hast! Es funktioniert wie ein Traum.
Die Software hatte vorher lange Zeilen Text und Befehle drin, deshalb habe ich die etwas vereinfacht ;-)
Vielen Dank nochmal!

cheers

Blinkwing
 
Zurück
Oben Unten