Last active
January 20, 2022 11:45
-
-
Save OKsign/c8094e66326752b69e7fc419ac5ba083 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- tested version: Finder 10.10.4 | |
set Replace_Me to "abc" | |
-- user input (up to 20) | |
set input1 to Replace_Me | |
set input2 to Replace_Me | |
set input3 to Replace_Me | |
set input4 to Replace_Me | |
set input5 to Replace_Me | |
set input6 to Replace_Me | |
set input7 to Replace_Me | |
set input8 to Replace_Me | |
set input9 to Replace_Me | |
set input10 to Replace_Me | |
set input11 to Replace_Me | |
set input12 to Replace_Me | |
set input13 to Replace_Me | |
set input14 to Replace_Me | |
set input15 to Replace_Me | |
set input16 to Replace_Me | |
set input17 to Replace_Me | |
set input18 to Replace_Me | |
set input19 to Replace_Me | |
set input20 to Replace_Me | |
-- end of user input | |
set nameList to {input1, input2, input3, input4, input5, input6, input7, input8, input9, input10, input11, input12, input13, input14, input15, input16, input17, input18, input19, input20} | |
-- 1. get name of finder window, set DoIt | |
tell application "System Events" | |
tell process "Finder" | |
set frontmost to true | |
delay 0.2 | |
set FinderName to get title of front window | |
delay 0.1 | |
repeat with i from 1 to 20 | |
if (item i of nameList) is not Replace_Me then | |
if item 5 of (item i of nameList) is FinderName then | |
set DoIt to 1 | |
set TargetInput to (item i of nameList) | |
exit repeat | |
else | |
set DoIt to 0 | |
end if | |
end if | |
end repeat | |
if DoIt is 1 then | |
tell application "System Events" | |
key code 48 using control down | |
end tell | |
set FinderName2 to get title of front window | |
if FinderName is not FinderName2 then | |
set ohTab to 1 | |
else | |
set ohTab to 0 | |
end if | |
end if -- DoIt is 1 | |
end tell | |
end tell | |
if DoIt is 1 then | |
if ohTab is 1 then | |
tell application "System Events" | |
key code 48 using {control down, shift down} | |
end tell | |
-- desired view for tab window or one window | |
if (item 7 of TargetInput) contains "Show Toolbar" or (item 7 of TargetInput) contains "Hide Toolbar" then | |
delay 0.02 | |
set ohTab to 0 | |
tell application "System Events" | |
tell process "Finder" | |
click (menu item "Move Tab to New Window" of menu 1 of menu bar item "Window" of menu bar 1) | |
delay 0.04 | |
end tell | |
end tell | |
end if | |
end if | |
if ohTab is 0 then | |
-- 2.change view | |
set fView to {"as Icons", "as List", "as Columns", "as Cover Flow"} | |
if item 6 of (TargetInput) is (item 1 of fView) then | |
set GoOn to 0 | |
tell application "System Events" | |
keystroke "1" using command down | |
delay 0.02 | |
end tell | |
else | |
set GoOn to 1 | |
end if -- item 6 of (item i of nameList)... | |
if GoOn is 1 then | |
if item 6 of (TargetInput) is (item 2 of fView) then | |
set GoOn to 0 | |
tell application "System Events" | |
keystroke "2" using command down | |
delay 0.02 | |
end tell | |
else | |
set GoOn to 1 | |
end if -- item 6 of (item i of nameList)... | |
end if | |
if GoOn is 1 then | |
if item 6 of (TargetInput) is (item 3 of fView) then | |
set GoOn to 0 | |
tell application "System Events" | |
keystroke "3" using command down | |
delay 0.02 | |
end tell | |
else | |
set GoOn to 1 | |
end if -- item 6 of (item i of nameList)... | |
end if | |
if GoOn is 1 then | |
if item 6 of (TargetInput) is (item of fView) then | |
tell application "System Events" | |
keystroke "4" using command down | |
delay 0.02 | |
exit repeat | |
end tell | |
end if -- item 6 of (item i of nameList)... | |
end if | |
-- 3.get HideShowList based on 'show toolbar' | |
tell application "System Events" | |
tell process "Finder" | |
set ViewMenuList to name of every menu item of menu 1 of menu bar item "View" of menu bar 1 | |
end tell | |
end tell | |
if ViewMenuList contains "Show Toolbar" then | |
set currentToolbar to 0 | |
set HideShowList to {} | |
repeat with i from 1 to count ViewMenuList | |
if (item i of ViewMenuList) does not end with "Tab Bar" then | |
if (item i of ViewMenuList) does not end with "Side Bar" then | |
if (item i of ViewMenuList) does not end with "View Options" then | |
if (item i of ViewMenuList) starts with "Hide" or (item i of ViewMenuList) starts with "Show" then | |
copy (item i of ViewMenuList) to the end of HideShowList | |
end if | |
end if | |
end if | |
end if | |
end repeat | |
else | |
set currentToolbar to 1 | |
set HideShowList to {} | |
repeat with i from 1 to count ViewMenuList | |
if (item i of ViewMenuList) does not end with "View Options" then | |
if (item i of ViewMenuList) starts with "Hide" or (item i of ViewMenuList) starts with "Show" then | |
copy (item i of ViewMenuList) to the end of HideShowList | |
end if | |
end if | |
end repeat | |
end if | |
-- 4.do show/hide toolbar | |
if (item 7 of TargetInput) contains "Show Toolbar" then | |
set desToolbar to 0 | |
else | |
set desToolbar to 1 | |
end if | |
if desToolbar is not equal to currentToolbar then | |
tell application "System Events" | |
keystroke "t" using {command down, option down} | |
end tell | |
end if | |
delay 0.9 | |
-- 5.from show to hide toolbar in menu > get HideShowList2 | |
if desToolbar is 1 then | |
tell application "System Events" | |
tell process "Finder" | |
set ViewMenuList to name of every menu item of menu 1 of menu bar item "View" of menu bar 1 | |
end tell | |
end tell | |
set HideShowList to {} | |
repeat with i from 1 to count ViewMenuList | |
if (item i of ViewMenuList) does not end with "View Options" then | |
if (item i of ViewMenuList) starts with "Hide" or (item i of ViewMenuList) starts with "Show" then | |
copy (item i of ViewMenuList) to the end of HideShowList | |
end if | |
end if | |
end repeat | |
end if -- desToolbar is 1 | |
-- end for toolbar | |
-- 6.do show/hide other items | |
delay 0.03 | |
if desToolbar is 1 then | |
set viewShowList to {"Show Tab Bar", "Show Path Bar", "Show Status Bar", "Show Sidebar", "Show Preview"} | |
repeat with i from 1 to count viewShowList | |
if (item 7 of TargetInput) contains (item i of viewShowList) then -- desired view = hide | |
set desShow to 0 | |
else | |
set desShow to 1 | |
end if | |
if HideShowList contains (item i of viewShowList) then | |
set curShow to 0 | |
else | |
set curShow to 1 | |
end if | |
if desShow is not equal to curShow then | |
if (item i of viewShowList) is "Show Tab Bar" then | |
tell application "System Events" | |
keystroke "t" using {command down, shift down} | |
end tell | |
end if | |
if (item i of viewShowList) is "Show Path Bar" then | |
tell application "System Events" | |
keystroke "p" using {command down, option down} | |
end tell | |
end if | |
delay 0.02 | |
if (item i of viewShowList) is "Show Status Bar" then | |
tell application "System Events" | |
key code 44 using {command down} | |
end tell | |
end if | |
if (item i of viewShowList) is "Show Sidebar" then | |
tell application "System Events" | |
keystroke "s" using {command down, option down} | |
end tell | |
end if | |
delay 0.02 | |
if (item i of viewShowList) is "Show Preview" then | |
tell application "System Events" | |
keystroke "p" using {command down, shift down} | |
end tell | |
end if | |
end if -- desShow is not equal to curShow | |
end repeat | |
else -- desToolbar is 0 | |
set viewShowList to {"Show Path Bar", "Show Status Bar", "Show Preview"} | |
repeat with i from 1 to count viewShowList | |
if (item 7 of TargetInput) contains (item i of viewShowList) then -- desired view = hide | |
set desShow to 0 | |
else | |
set desShow to 1 | |
end if | |
if HideShowList contains (item i of viewShowList) then | |
set curShow to 0 | |
else | |
set curShow to 1 | |
end if | |
if desShow is not equal to curShow then | |
if (item i of viewShowList) is "Show Path Bar" then | |
tell application "System Events" | |
keystroke "p" using {command down, option down} | |
end tell | |
end if | |
delay 0.02 | |
if (item i of viewShowList) is "Show Status Bar" then | |
tell application "System Events" | |
key code 44 using {command down} | |
end tell | |
end if | |
delay 0.02 | |
if (item i of viewShowList) is "Show Preview" then | |
tell application "System Events" | |
keystroke "p" using {command down, shift down} | |
end tell | |
end if | |
end if -- desShow is not equal to curShow | |
end repeat | |
end if -- desToolbar is 1 | |
delay 0.2 | |
-- 7.do size and position | |
tell application "System Events" | |
set position of window 1 of process "Finder" to {item 1 of (TargetInput), item 2 of (TargetInput)} | |
delay 1 | |
set size of window 1 of process "Finder" to {item 3 of (TargetInput), item 4 of (TargetInput)} | |
end tell | |
end if -- ohTab is 0 | |
if ohTab is 1 then | |
-- 2.change view | |
set fView to {"as Icons", "as List", "as Columns", "as Cover Flow"} | |
if item 6 of (TargetInput) is (item 1 of fView) then | |
set GoOn to 0 | |
tell application "System Events" | |
keystroke "1" using command down | |
delay 0.02 | |
end tell | |
else | |
set GoOn to 1 | |
end if -- item 6 of (item i of nameList)... | |
if GoOn is 1 then | |
if item 6 of (TargetInput) is (item 2 of fView) then | |
set GoOn to 0 | |
tell application "System Events" | |
keystroke "2" using command down | |
delay 0.02 | |
end tell | |
else | |
set GoOn to 1 | |
end if -- item 6 of (item i of nameList)... | |
end if | |
if GoOn is 1 then | |
if item 6 of (TargetInput) is (item 3 of fView) then | |
set GoOn to 0 | |
tell application "System Events" | |
keystroke "3" using command down | |
delay 0.02 | |
end tell | |
else | |
set GoOn to 1 | |
end if -- item 6 of (item i of nameList)... | |
end if | |
if GoOn is 1 then | |
if item 6 of (TargetInput) is (item 4 of fView) then | |
tell application "System Events" | |
keystroke "4" using command down | |
delay 0.02 | |
end tell | |
end if -- item 6 of (item i of nameList)... | |
end if | |
-- 3.get HideShowList | |
tell application "System Events" | |
tell process "Finder" | |
set ViewMenuList to name of every menu item of menu 1 of menu bar item "View" of menu bar 1 | |
end tell | |
end tell | |
set HideShowList to {} | |
repeat with i from 1 to count ViewMenuList | |
if (item i of ViewMenuList) does not end with "Tab Bar" then | |
if (item i of ViewMenuList) does not end with "Toolbar" then | |
if (item i of ViewMenuList) does not end with "View Options" then | |
if (item i of ViewMenuList) starts with "Hide" or (item i of ViewMenuList) starts with "Show" then | |
copy (item i of ViewMenuList) to the end of HideShowList | |
end if | |
end if | |
end if | |
end if | |
end repeat | |
-- 4. do show/hide items | |
delay 0.03 | |
set viewShowList to {"Show Path Bar", "Show Status Bar", "Show Sidebar", "Show Preview"} | |
repeat with i from 1 to count viewShowList | |
if (item 7 of TargetInput) contains (item i of viewShowList) then -- desired view = hide | |
set desShow to 0 | |
else | |
set desShow to 1 | |
end if | |
if HideShowList contains (item i of viewShowList) then | |
set curShow to 0 | |
else | |
set curShow to 1 | |
end if | |
if desShow is not equal to curShow then | |
if (item i of viewShowList) is "Show Path Bar" then | |
tell application "System Events" | |
keystroke "p" using {command down, option down} | |
end tell | |
end if | |
delay 0.02 | |
if (item i of viewShowList) is "Show Status Bar" then | |
tell application "System Events" | |
key code 44 using {command down} | |
end tell | |
end if | |
if (item i of viewShowList) is "Show Sidebar" then | |
tell application "System Events" | |
keystroke "s" using {command down, option down} | |
end tell | |
end if | |
delay 0.02 | |
if (item i of viewShowList) is "Show Preview" then | |
tell application "System Events" | |
keystroke "p" using {command down, shift down} | |
end tell | |
end if | |
end if -- desShow is not equal to curShow | |
end repeat | |
delay 0.2 | |
-- 5.do size and position | |
tell application "System Events" | |
set position of window 1 of process "Finder" to {item 1 of (TargetInput), item 2 of (TargetInput)} | |
delay 1 | |
set size of window 1 of process "Finder" to {item 3 of (TargetInput), item 4 of (TargetInput)} | |
end tell | |
end if -- ohTab is 1 | |
end if -- DoIt is 1 | |
if DoIt is 0 then -- choose from list (move tab to new window) | |
set Replace_Me to "abc" | |
-- user input (up to 10 names) - list | |
set nameList to {"", "", "", "", "", "", "", "", "", ""} | |
-- user input (up to 10) - list | |
set ViewSizPos1 to Replace_Me | |
set ViewSizPos2 to Replace_Me | |
set ViewSizPos3 to Replace_Me | |
set ViewSizPos4 to Replace_Me | |
set ViewSizPos5 to Replace_Me | |
set ViewSizPos6 to Replace_Me | |
set ViewSizPos7 to Replace_Me | |
set ViewSizPos8 to Replace_Me | |
set ViewSizPos9 to Replace_Me | |
set ViewSizPos10 to Replace_Me | |
-- end of user input | |
set inputList to {ViewSizPos1, ViewSizPos2, ViewSizPos3, ViewSizPos4, ViewSizPos5, ViewSizPos6, ViewSizPos7, ViewSizPos8, ViewSizPos9, ViewSizPos10} | |
set nameList2 to {} | |
repeat with i from 1 to count nameList | |
if {nameList's item i} does not contain "" then | |
set nameList2's end to nameList's item i | |
end if | |
end repeat | |
delay 0.7 | |
set PickName to (choose from list nameList2 with prompt "Set View,Size and Position to..." with title "Script 16.1") | |
if PickName is not false then | |
delay 0.02 | |
repeat with i from 1 to count nameList | |
if (item 1 of PickName) is (item i of nameList) then | |
set DoItList to 1 | |
set TargetInput to (item i of inputList) | |
exit repeat | |
else | |
set DoItList to 0 | |
end if | |
end repeat | |
else | |
return | |
end if -- PickName is not false | |
if DoItList is 1 then | |
tell application "System Events" | |
tell process "Finder" | |
set frontmost to true | |
delay 0.2 | |
click (menu item "Move Tab to New Window" of menu 1 of menu bar item "Window" of menu bar 1) | |
delay 0.04 | |
end tell | |
end tell | |
-- change view | |
set fView to {"as Icons", "as List", "as Columns", "as Cover Flow"} | |
if item 6 of (TargetInput) is (item 1 of fView) then | |
set GoOn to 0 | |
tell application "System Events" | |
keystroke "1" using command down | |
delay 0.02 | |
end tell | |
else | |
set GoOn to 1 | |
end if | |
if GoOn is 1 then | |
if item 6 of (TargetInput) is (item 2 of fView) then | |
tell application "System Events" | |
keystroke "2" using command down | |
delay 0.02 | |
end tell | |
else | |
set GoOn to 1 | |
end if | |
end if | |
if GoOn is 1 then | |
if item 6 of (TargetInput) is (item 3 of fView) then | |
tell application "System Events" | |
keystroke "3" using command down | |
delay 0.02 | |
end tell | |
else | |
set GoOn to 1 | |
end if | |
end if | |
if GoOn is 1 then | |
if item 6 of (TargetInput) is (item 4 of fView) then | |
tell application "System Events" | |
keystroke "4" using command down | |
delay 0.02 | |
end tell | |
end if | |
end if | |
tell application "System Events" | |
tell process "Finder" | |
set ViewMenuList to name of every menu item of menu 1 of menu bar item "View" of menu bar 1 | |
end tell | |
end tell | |
if ViewMenuList contains "Show Toolbar" then | |
set currentToolbar to 0 | |
set HideShowList to {} | |
repeat with i from 1 to count ViewMenuList | |
if (item i of ViewMenuList) does not end with "Tab Bar" then | |
if (item i of ViewMenuList) does not end with "Side Bar" then | |
if (item i of ViewMenuList) does not end with "View Options" then | |
if (item i of ViewMenuList) starts with "Hide" or (item i of ViewMenuList) starts with "Show" then | |
copy (item i of ViewMenuList) to the end of HideShowList | |
end if | |
end if | |
end if | |
end if | |
end repeat | |
else | |
set currentToolbar to 1 | |
set HideShowList to {} | |
repeat with i from 1 to count ViewMenuList | |
if (item i of ViewMenuList) does not end with "View Options" then | |
if (item i of ViewMenuList) starts with "Hide" or (item i of ViewMenuList) starts with "Show" then | |
copy (item i of ViewMenuList) to the end of HideShowList | |
end if | |
end if | |
end repeat | |
end if | |
-- 4.do show/hide toolbar | |
if (item 7 of TargetInput) contains "Show Toolbar" then | |
set desToolbar to 0 | |
else | |
set desToolbar to 1 | |
end if | |
if desToolbar is not equal to currentToolbar then | |
tell application "System Events" | |
keystroke "t" using {command down, option down} | |
end tell | |
end if | |
delay 0.9 | |
-- 5.from show to hide toolbar in menu > get HideShowList2 | |
if desToolbar is 1 then | |
tell application "System Events" | |
tell process "Finder" | |
set ViewMenuList to name of every menu item of menu 1 of menu bar item "View" of menu bar 1 | |
end tell | |
end tell | |
set HideShowList to {} | |
repeat with i from 1 to count ViewMenuList | |
if (item i of ViewMenuList) does not end with "View Options" then | |
if (item i of ViewMenuList) starts with "Hide" or (item i of ViewMenuList) starts with "Show" then | |
copy (item i of ViewMenuList) to the end of HideShowList | |
end if | |
end if | |
end repeat | |
end if -- desToolbar is 1 | |
-- end for toolbar | |
-- 6.do show/hide other items | |
delay 0.03 | |
if desToolbar is 1 then | |
set viewShowList to {"Show Tab Bar", "Show Path Bar", "Show Status Bar", "Show Sidebar", "Show Preview"} | |
repeat with i from 1 to count viewShowList | |
if (item 7 of TargetInput) contains (item i of viewShowList) then -- desired view = hide | |
set desShow to 0 | |
else | |
set desShow to 1 | |
end if | |
if HideShowList contains (item i of viewShowList) then | |
set curShow to 0 | |
else | |
set curShow to 1 | |
end if | |
if desShow is not equal to curShow then | |
if (item i of viewShowList) is "Show Tab Bar" then | |
tell application "System Events" | |
keystroke "t" using {command down, shift down} | |
end tell | |
end if | |
if (item i of viewShowList) is "Show Path Bar" then | |
tell application "System Events" | |
keystroke "p" using {command down, option down} | |
end tell | |
end if | |
delay 0.02 | |
if (item i of viewShowList) is "Show Status Bar" then | |
tell application "System Events" | |
key code 44 using {command down} | |
end tell | |
end if | |
if (item i of viewShowList) is "Show Sidebar" then | |
tell application "System Events" | |
keystroke "s" using {command down, option down} | |
end tell | |
end if | |
delay 0.02 | |
if (item i of viewShowList) is "Show Preview" then | |
tell application "System Events" | |
keystroke "p" using {command down, shift down} | |
end tell | |
end if | |
end if -- desShow is not equal to curShow | |
end repeat | |
else -- desToolbar is 0 | |
set viewShowList to {"Show Path Bar", "Show Status Bar", "Show Preview"} | |
repeat with i from 1 to count viewShowList | |
if (item 7 of TargetInput) contains (item i of viewShowList) then -- desired view = hide | |
set desShow to 0 | |
else | |
set desShow to 1 | |
end if | |
if HideShowList contains (item i of viewShowList) then | |
set curShow to 0 | |
else | |
set curShow to 1 | |
end if | |
if desShow is not equal to curShow then | |
if (item i of viewShowList) is "Show Path Bar" then | |
tell application "System Events" | |
keystroke "p" using {command down, option down} | |
end tell | |
end if | |
delay 0.02 | |
if (item i of viewShowList) is "Show Status Bar" then | |
tell application "System Events" | |
key code 44 using {command down} | |
end tell | |
end if | |
delay 0.02 | |
if (item i of viewShowList) is "Show Preview" then | |
tell application "System Events" | |
keystroke "p" using {command down, shift down} | |
end tell | |
end if | |
end if -- desShow is not equal to curShow | |
end repeat | |
end if -- desToolbar is 1 | |
delay 0.2 | |
-- 7.do size and position | |
tell application "System Events" | |
set position of window 1 of process "Finder" to {item 1 of (TargetInput), item 2 of (TargetInput)} | |
delay 1 | |
set size of window 1 of process "Finder" to {item 3 of (TargetInput), item 4 of (TargetInput)} | |
end tell | |
end if -- DoItList is 1 | |
end if -- DoIt is 0 | |
set switch to 0 | |
if switch is 1 then | |
-- script: Get Name,View,Size,Position of Finder Window | |
tell application "System Events" | |
set activeApp to (get name of first process where it is frontmost) | |
end tell | |
if activeApp is "Finder" then | |
tell application "System Events" | |
tell process "Finder" | |
set frontmost to true | |
delay 0.2 | |
set FinderName to get title of front window | |
delay 0.1 | |
tell application "System Events" | |
key code 48 using control down | |
end tell | |
set FinderName2 to get title of front window | |
if FinderName is not FinderName2 then | |
set ohTab to 1 | |
else | |
set ohTab to 0 | |
end if | |
end tell | |
end tell | |
if ohTab is 1 then | |
tell application "System Events" | |
key code 48 using {control down, shift down} | |
end tell | |
end if | |
end if -- activeApp is "Finder" | |
if ohTab is 0 then | |
set fView to {"as Icons", "as List", "as Columns", "as Cover Flow"} | |
tell application "System Events" | |
tell process "Finder" | |
set frontmost to true | |
set FinderName to get title of front window | |
delay 0.02 | |
repeat with i from 1 to count fView | |
if (value of attribute "AXMenuItemMarkChar" of menu item (item i of fView) of menu 1 of menu bar item "View" of menu bar 1 as string) is "✓" then | |
delay 0.1 | |
set cView to item i of fView | |
exit repeat | |
end if | |
end repeat | |
end tell | |
end tell | |
tell application "System Events" | |
tell process "Finder" | |
set ViewMenuList to name of every menu item of menu 1 of menu bar item "View" of menu bar 1 | |
end tell | |
end tell | |
if ViewMenuList contains "Show Toolbar" then | |
set HideShowList to {} | |
repeat with i from 1 to count ViewMenuList | |
if (item i of ViewMenuList) does not end with "Tab Bar" then | |
if (item i of ViewMenuList) does not end with "SideBar" then | |
if (item i of ViewMenuList) does not end with "View Options" then | |
if (item i of ViewMenuList) starts with "Hide" or (item i of ViewMenuList) starts with "Show" then | |
copy (item i of ViewMenuList) to the end of HideShowList | |
end if | |
end if | |
end if | |
end if | |
end repeat | |
else | |
set HideShowList to {} | |
repeat with i from 1 to count ViewMenuList | |
if (item i of ViewMenuList) does not end with "View Options" then | |
if (item i of ViewMenuList) starts with "Hide" or (item i of ViewMenuList) starts with "Show" then | |
copy (item i of ViewMenuList) to the end of HideShowList | |
end if | |
end if | |
end repeat | |
end if | |
tell application "System Events" | |
set ppp to get position of window 1 of process "Finder" | |
delay 0.03 | |
set sss to get size of window 1 of process "Finder" | |
delay 0.02 | |
set pos1 to (item 1 of ppp) | |
set pos2 to (item 2 of ppp) | |
set siz1 to (item 1 of sss) | |
set siz2 to (item 2 of sss) | |
set FinderNVPS to "{" & pos1 & ", " & pos2 & ", " & siz1 & ", " & siz2 & ", " & "\"" & FinderName & "\"" & "," & "\"" & cView & "\"" & "}" | |
delay 0.5 | |
set FinderNVPS2 to "{" & pos1 & ", " & pos2 & ", " & siz1 & ", " & siz2 & ", " & "\"" & FinderName & "\"" & "," & "\"" & cView & "\"" & "," & "\"" & HideShowList & "\"" & "}" | |
set the clipboard to FinderNVPS2 | |
delay 0.5 | |
display dialog "Done!" with title "Get Name,View,Size,Position of Finder Window" | |
end tell | |
end if -- ohTab is 0 | |
if ohTab is 1 then | |
set fView to {"as Icons", "as List", "as Columns", "as Cover Flow"} | |
tell application "System Events" | |
tell process "Finder" | |
set frontmost to true | |
set FinderName to get title of front window | |
delay 0.02 | |
repeat with i from 1 to count fView | |
if (value of attribute "AXMenuItemMarkChar" of menu item (item i of fView) of menu 1 of menu bar item "View" of menu bar 1 as string) is "✓" then | |
delay 0.1 | |
set cView to item i of fView | |
exit repeat | |
end if | |
end repeat | |
end tell | |
end tell | |
tell application "System Events" | |
tell process "Finder" | |
set ViewMenuList to name of every menu item of menu 1 of menu bar item "View" of menu bar 1 | |
end tell | |
end tell | |
set HideShowList to {} | |
repeat with i from 1 to count ViewMenuList | |
if (item i of ViewMenuList) does not end with "Tab Bar" then | |
if (item i of ViewMenuList) does not end with "Toolbar" then | |
if (item i of ViewMenuList) does not end with "View Options" then | |
if (item i of ViewMenuList) starts with "Hide" or (item i of ViewMenuList) starts with "Show" then | |
copy (item i of ViewMenuList) to the end of HideShowList | |
end if | |
end if | |
end if | |
end if | |
end repeat | |
tell application "System Events" | |
set ppp to get position of window 1 of process "Finder" | |
delay 0.03 | |
set sss to get size of window 1 of process "Finder" | |
delay 0.02 | |
set pos1 to (item 1 of ppp) | |
set pos2 to (item 2 of ppp) | |
set siz1 to (item 1 of sss) | |
set siz2 to (item 2 of sss) | |
set FinderNVPS to "{" & pos1 & ", " & pos2 & ", " & siz1 & ", " & siz2 & ", " & "\"" & FinderName & "\"" & "," & "\"" & cView & "\"" & "}" | |
delay 0.5 | |
set FinderNVPS2 to "{" & pos1 & ", " & pos2 & ", " & siz1 & ", " & siz2 & ", " & "\"" & FinderName & "\"" & "," & "\"" & cView & "\"" & "," & "\"" & HideShowList & "\"" & "}" | |
set the clipboard to FinderNVPS2 | |
delay 0.5 | |
display dialog "Done!" with title "Get Name,View,Size,Position of Finder Window" | |
end tell | |
end if -- ohTab is 1 | |
-- end of script: Get Name,View,Size,Position of Finder Window | |
end if -- switch is 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment