Created
May 4, 2018 04:38
-
-
Save OKsign/a1f97ce991b2f08a04cac447af3f7478 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
-- user input | |
set textFile to "" -- ex. "/Volumes/Data/A/file.txt" | |
set des1 to "" -- ex. "/Volumes/Data/A/folder" | |
-- end of user input | |
set textFilep to POSIX file textFile | |
set textFileRead to paragraphs of (read of textFilep) | |
set des1p to POSIX file des1 | |
tell application "Finder" | |
open des1p | |
activate | |
delay 0.3 | |
end tell | |
tell application "Finder" | |
set FName to get name of front window | |
end tell | |
set AppleScript's text item delimiters to {"/"} | |
set TarWin to last text item of des1 | |
repeat 300 times | |
tell application "Finder" | |
activate | |
delay 0.2 | |
if FName is TarWin then | |
exit repeat | |
end if | |
end tell | |
end repeat | |
tell application "System Events" | |
keystroke "a" using command down | |
delay 0.2 | |
end tell | |
tell application "Finder" | |
set sel to get selection | |
try | |
repeat with i from 1 to count sel | |
reveal item i of sel | |
delay 0.02 | |
set the clipboard to item i of textFileRead | |
delay 0.2 | |
tell application "System Events" | |
key code 36 | |
delay 0.3 | |
keystroke "v" using command down | |
delay 0.3 | |
key code 36 | |
delay 1 | |
end tell | |
end repeat | |
end try | |
tell application "System Events" | |
display notification "Done!" with title "Script 5" | |
end tell | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment