Safari: neues Fenster öffnen durch Klick auf's Icon im Dock

iMäcker

Aktives Mitglied
Thread Starter
Dabei seit
25.01.2007
Beiträge
631
Reaktionspunkte
24
Hallihallo, ich möchte gerne, dass bei Safari jedes mal ein neues Fenster aufgeht, wenn ich auf das Safari Icon im Dock klicke! Wie kann ich das erreichen? Bin notfalls auch mit Änderungen im Paketinhalt zufrieden.
Ich nutze derzeit Safari 5.0

PS: Rechtsklick auf das Icon und --> neues Fenster kenn ich, ist mir aber auf Dauer zu mühsam!
 
Wow, danke! Den Thread hab ich nicht gefunden.
Also das Skript sieht so aus:


on run {input, parameters}

tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
click menu item "Neues Fenster" of menu "Ablage" of menu bar 1
end tell
end tell
return input
end run
 
Zuletzt bearbeitet:
bin zwar absolut kein Profi in Sachen programmieren und erstrecht nicht in apple script, könnte mir aber vorstellen, das dies durch eine Art if-Funktion (falls es so was überhaupt gibt) gelöst werden könnte.
Also - in Prosa - wenn safari bereits gestartet gehe in Menü "Ablage" und klicke auf "Neues Fenster", andernfalls starte Safari und mache dann das gleiche. ;)
 
cool
ich habe bisher immer Cmd+T gedrückt. :D
 
und wenn safari mit mehreren Fenstern minimiert war/ist? :D
 
hab's ein bisschen aufgebohrt, erster teil schaut nun ob Safari schon offen ist, zweiter Teil entscheidet nun ob Safari gestartet werden soll oder ein neues Fenster geöffnet werden muss.
Script einfach in Applescript Editor kopieren und als Application speichern.

on ApplicationIsRunning(appName)
tell application "System Events" to set appNameIsRunning to exists (processes where name is appName)
return appNameIsRunning
end ApplicationIsRunning

on run
if ApplicationIsRunning("Safari") then
tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
keystroke "n" using command down
end tell
end tell
else
tell application "Safari" to activate
end if
end run

MFG
BONSAI
 
  • Gefällt mir
Reaktionen: sonnenmilch und iMäcker
Sorry, dass ich frage, aber warum überprüfst du erst, ob Safari läuft und startest es dann doch?

on run
if ApplicationIsRunning("Safari") then
tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
keystroke "n" using command down
end tell
end tell
else
tell application "Safari" to activate
end if
end run
 
tell application "Safari" to activate
Mit dieser Zeile kann man entweder einen Task starten oder ihn auch in den Vordergrund holen
keystroke "n" using command down
da ich um ein neues Fenster zu öffnen Apfel + N verwende, muss ich sicherstellen das Safari auch im Vordergrund ist (also aktiv), damit ich den Shortcut im richtigen Fenster ausführen kann.

also Starte ich einmal Safari und im anderen mal hole ich Safari lediglich in den Vordergrund (activate)

MFG
BONSAI
 
  • Gefällt mir
Reaktionen: Till00
Vielen Dank, BONSAI!! Dein verbessertes Skript ist nun perfekt! Man sollte wohl noch erwähnen, dass das mit dem AppleSkript-Editor erstellte Programm nicht "Safari" heißen darf, sonst tut sich einfach gar nichts...:confused:

hab ziemlich lange gebraucht um es mal mit einem anderen Namen auszuprobieren :D
 
Zurück
Oben Unten