Run An Applescript

[Solved] Run An Applescript | Perl - Code Explorer | yomemimo.com
Question : run an applescript

Answered by : healthy-hornet-1xsfbc9bipfn

on run {input, parameters} tell application "Finder" --get the selected file set selectedItem to (item 1 of (get selection)) --get location info (folder:file format) set fileLocation to (selectedItem as alias) as string --replace : with / with subroutine set the semifinal to my replace_chars(fileLocation, ":", "/") --remove Macintosh HD with subroutine set the theFinal to my replace_chars(semifinal, "Macintosh HD", "") end tell do shell script "osascript " & "\"" & theFinal & "\"" return input
end run
on replace_chars(this_text, search_string, replacement_string) set AppleScript's text item delimiters to the search_string set the item_list to every text item of this_text set AppleScript's text item delimiters to the replacement_string set this_text to the item_list as string set AppleScript's text item delimiters to "" return this_text
end replace_chars

Source : https://superuser.com/questions/14762/execute-applescript-without-open-the-editor | Last Update : Fri, 29 Jan 21

Answers related to run an applescript

Code Explorer Popular Question For Perl