/* AliasResolver2 for OS X 10.4 or higher Resolves aliases via Applescript on the startup volume. (Perhaps some AppleScript expert can tell me how to resolve aliases across different volumes) Norbert Vischer, 30.6.2008, vischer at science.uva.nl */ macro "Resolve Directory [F1]"{ //resolves an entire directory dir = getDirectory(""); list = getFileList(dir); str = listToBuffer(dir, list); sss = resolveList(str); aaa = split(sss, "\t"); for (jj =0; jj= 0) pth= substring(pth, idx, lengthOf(pth));//remove first element aaa[jj] = pth; } print("\\Clear"); print("resolved paths in folder: ", dir); print("-------------------------"); for (jj =0; jj= 0) pth= substring(pth, idx, lengthOf(pth));//remove first element aaa[jj] = pth; } print("\\Clear"); print(aaa[0]); selectWindow("Log"); } function listToBuffer(dir, list){ String.resetBuffer; String.append("{"); for (jj=0; jj0) String.append(","); String.append("\""); String.append(aliasPathA); String.append("\""); } String.append("}"); return String.buffer; } //Expects theList, i.e a list of paths some of which may be aliases //Returns a list of paths (same length), where aliases are resolved. function resolveList(theList){ s= "tell application \"Finder\"\n"; s=s+" set theList to " + theList + "\n"; s=s+" set resultat to \"\"\n"; s=s+" repeat with myItem in theList\n"; s=s+" set mypath to myItem\n"; s=s+" set mypath to (startup disk as text) & mypath\n"; s=s+" set orig to mypath\n"; s=s+" if kind of (mypath as alias) equals \"Alias\" then \n"; s=s+" set myAlias to file (mypath)\n"; s=s+" set orig to (original item of myAlias as string)\n"; s=s+" end if\n"; s=s+" set resultat to resultat & orig & \"\t\"\n"; s=s+" end repeat\n"; s=s+" return resultat\n"; s=s+"end tell\n"; result = exec("osascript", "-e", s); //print(result); exit; if (lengthOf(result)==0) exit("no Result"); result = substring(result, 0, lengthOf(result)-1); result = replace(result, ":", "/"); return result; }