You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
------------------------------------------------------------------------------# modAuth: suliveevil# originAuth: Christopher Stone# dCre: 2017/05/22 15:10# dMod: 2017/05/29 14:16# Appl: System Events# Task: Attempt to acquire the POSIX Path of the file associated with the front window of the front app.# Libs: None# Osax: None# Tags: @Applescript, @Script, @ASObjC, @System_Events, @Acquire, @POSIX_Path, @Path, @File, @Associated, @Front, @Window, @Front_App# Notes# fileName Regex: [^/]*$# folderPath = ------------------------------------------------------------------------------use framework "Foundation"use scripting additionstry tell application "System Events" set frontProcess to first process whose frontmost is true set procName to name of frontProcess tell frontProcess tell front window tell attribute "AXDocument" set fileUrlOfFrontWindow to its value end tell end tell end tell end tell on error set fileUrlOfFrontWindow to missing valueend tryif fileUrlOfFrontWindow ≠ missing value and fileUrlOfFrontWindow ≠ "file:///Irrelevent" then set posixPath to (current application's class "NSURL"'s URLWithString:fileUrlOfFrontWindow)'s |path|() as text return posixPathelse -- set posixPath to (current application's class "NSURL"'s URLWithString:fileUrlOfFrontWindow)'s |path|() as text -- return posixPath set theFile to POSIX path of (choose file)end if