Automator Finder 2x öffnen und "andocken"

G

geniuss

Aktives Mitglied
Thread Starter
Dabei seit
11.06.2011
Beiträge
106
Reaktionspunkte
4
Hallo,
ich versuche mich gerade in Automator.
Leider kann ich unter den Programm öffnen Asuwahlliste leider den Finder nicht finden ?

Mein Ziel ist den Finder zwei Fenster zu öffnen und mit Rectangle oder Magnet automatisch in Position zu bringen.
Ob ich hier zu einer schönen Lösung komme wird sich zeigen.
Möchte keinen Finder Fork benutzen, da mir bei den von mir getesteten die Integration von Dropbox oder Boxcrypter nicht gefällt.
Also muss eine Bordmittellösung her.

Danke für Eure Unterstützung schönen Abend
 
Hi,
hatte versucht das vorhin zu installieren, hatte mir aber direkt angezeigt , das mit dem M1..... einiges nicht funktioniert.
Dann hatte ich es abgebrochen
 
Mach es mit Apple Script und schicke die notwendigen Keystrokes über die Systemevents.
 
Hallo @mausfang

danke,
habe mich eben mit dem AppleSkript beschäftigt.
Zu Beginn habe ich einfach ein Script aufgezeichnet und 2x den Finder geöffnet und enstprechend positioniert ;)
Nachteil ist , das mein Macbook ohne externen Monitor das dann nicht richtig läuft, bzgl. der Position.
Dann wäre das mit den Keystrokes denke ich besser noch den Befehl für Rectangle mit zu geben.

Habe nun länger daran gesessen dem Skript ein Shortcut zu zuweisen , ohne Erfolg.
Jetzt führe ich das Skript über den Automator aus mit einem Icon , das soll doch auch anders funktionieren.

Mit Sysetmshortcuts die man einem Skript zuweisen kann ?
 
Mein Weihnachtsgeschenk an die Macuser Community:
Das Script definiert zwei Finderfenster, deren Inhalt und Position.

Code:
(*
Copyright Atalantia©2015
                                                    *)
property dir1 : ""
property dir2 : ""
property dir3 : ""
property dir4 : ""
property ID1 : ""
property ID2 : ""
property mode : "Single"
property resMode : ""
property svc : false
on open var
    setDir(item 1 of var)
end open

if dir1 = "" then setDir(path to desktop)
if resMode = "Big" and svc = true then
    set {dif1, dif2, dif3, dif4} to {22, 0, 22, 0}
else if resMode = "Big" and svc = false then
    set {dif1, dif2, dif3, dif4} to {44, 0, 66, 0}
else if resMode ≠ "Big" and svc = true then
    set {dif1, dif2, dif3, dif4} to {46, -14, 36, -34}
else
    set {dif1, dif2, dif3, dif4} to {76, -32, 76, -54}
end if
tell application "Finder"
    activate
    set {idList, wbo, noC} to {id of windows, bounds of window of desktop, {}}
    repeat with x in idList
        try
            if x as number is not in {ID1, ID2} then close window id x
        on error
            set end of noC to x
        end try
    end repeat
    set wiCount to (count Finder windows)
    if wiCount ≠ 2 then
        if wiCount = 1 then
            set iFw1 to id of Finder window 1
            if iFw1 = ID1 then
                set ID2 to id of (make new Finder window to dir3)
                set properties of window id ID2 to {current view:list view}
                if mode = "Double" then
                    activate
                    my newTab()
                    set target of window id ID2 to dir4
                    set properties of window id ID2 to {current view:list view}
                end if
            else if iFw1 = ID2 then
                set ID1 to id of (make new Finder window to dir1)
                set properties of window id ID1 to {current view:list view}
                if mode = "Double" then
                    activate
                    my newTab()
                    set target of window id ID1 to dir2
                    set properties of window id ID1 to {current view:list view}
                end if
            end if
        else
            try
                set ID1 to id of (make new Finder window to dir1)
                set properties of window id ID1 to {current view:list view}
                if mode = "Double" then
                    activate
                    my newTab()
                    set target of window id ID1 to dir2
                    set properties of window id ID1 to {current view:list view}
                end if
                set ID2 to id of (make new Finder window to dir3)
                set properties of window id ID2 to {current view:list view}
                if mode = "Double" then
                    activate
                    my newTab()
                    set target of window id ID2 to dir4
                    set properties of window id ID2 to {current view:list view}
                end if
            on error
                my setDir(path to desktop)
            end try
        end if
    end if
    set {m1, m3} to {(item 3 of wbo) * 0.125 as integer, (item 3 of wbo) * 0.875 as integer}
    try
        set {properties of window id ID1, properties of window id ID2} to {{bounds:m1 & ((item 2 of wbo) + dif1) & m3 & ((((item 4 of wbo) + 22) / 2) + dif2 as integer), toolbar visible:true, sidebar width:145}, {bounds:m1 & (((item 4 of wbo) + dif3) / 2 as integer) & m3 & (item 4 of wbo) + dif4, toolbar visible:true, sidebar width:145}}
    end try
    activate
    if noC ≠ {} then
        repeat with x in noC
            open window id x
        end repeat
    end if
end tell
on newTab()
    tell application "System Events" to keystroke "t" using command down
end newTab

on setDir(pathInfo)
    set {dVar, svc, sv} to {" To reset the directories or mode, use the droplet function of this application.", false, system version of (system info)}
    considering numeric strings
        if sv > "10.9.5" then set svc to true
        if sv ≥ "10.9.0" then set mode to button returned of (display alert "SingleTab or DoubleTab mode?" message "DoubleTab opens two tabs per window." & dVar buttons {"Cancel", "Single", "Double"} cancel button 1 default button 3)
    end considering
    set resMode to button returned of (display alert "Big or small Finder windows?" message "Big Finder Windows will cover the whole hight on the screen but not the entire width. Small Finder Windows will neither cover the whole hight nor the whole width on the screen." & dVar buttons {"Cancel", "Big", "Small"} cancel button 1 default button 3)
    if mode = "Double" then
        try
            set {dir1, dir2, dir3, dir4} to {choose folder with prompt "Set directory 1." & dVar invisibles yes default location pathInfo, choose folder with prompt "Set directory 2." & dVar invisibles yes default location path to documents folder, choose folder with prompt "Set directory 3." & dVar invisibles yes, choose folder with prompt "Set directory 4." & dVar invisibles yes}
        on error
            set mode to ""
            error number -128
        end try
    else
        set {dir1, dir3} to {choose folder with prompt "Set directory 1." & dVar invisibles yes default location pathInfo, choose folder with prompt "Set directory 2." & dVar invisibles yes default location path to documents folder}
    end if
    run
end setDir

PS: Bis 10.13 funktioniert das Script perfekt. Mit dem Privileges Murks den Apple bei 10.14 eingebaut hat, funktionierte bei mir das Script nur noch halb, soso lala. Höher als 10.14 weiss ich nicht.
 
Zuletzt bearbeitet:
  • Gefällt mir
Reaktionen: mausfang
@geniuss

Vorausgesetzt Du hast Magnet installiert, und nichts an den Tastatur-Belegungen für "Links" und "Rechts" geändert:

AppleScript:
set folderOne to POSIX file "/Users"
set folderTwo to POSIX file "/Library"

tell application "Finder"
    activate
    open folderOne
    delay 1
    tell application "System Events" to key code 123 using {control down, option down}
    delay 1
    open folderTwo
    tell application "System Events" to key code 124 using {control down, option down}
end tell
 
Hallo,
probier diese Version(funktioniert mit Ventura)
LG

PS: ist nicht von mir geschrieben, habe es aber selber in Verwendung als App und im Finder als Button

Code:
tell application "Finder"
   
    -- get number of open finders
    set NumberofFinders to count every Finder window
   
    -- close all finders except the frontmost one
    if NumberofFinders is greater than 1 then
        repeat NumberofFinders - 1 times
            close last Finder window
        end repeat
    end if
   
    -- get screen info
    set screenBounds to bounds of window of desktop
    set screenWidth to item 3 of screenBounds
    set screenHeight to item 4 of screenBounds
    --set centerX to screenWidth / 2
    --set centerY to screenHeight / 2
   
    -- move finder and set the size
   
    set the bounds of the front Finder window to {0, 0, screenWidth * 0.5, screenHeight * 0.7}
   
    -- make second finder
    make Finder window
    set the target of Finder window 1 to home
    set the position of the front Finder window to {screenWidth * 0.5, 0}
    set the bounds of the front Finder window to {screenWidth * 0.5, 0, screenWidth, screenHeight * 0.7}
   
    -- bring the finders to the front
    activate
   
end tell
 
  • Gefällt mir
Reaktionen: mausfang
Zurück
Oben Unten