Created
March 27, 2012 00:31
-
-
Save anonymous/2211017 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
on searchReplace(theText, SearchString, ReplaceString) | |
set OldDelims to AppleScript's text item delimiters | |
set AppleScript's text item delimiters to SearchString | |
set newText to text items of theText | |
set AppleScript's text item delimiters to ReplaceString | |
set newText to newText as text | |
set AppleScript's text item delimiters to OldDelims | |
return newText | |
end searchReplace | |
on run {input, parameters} | |
set myClip to the input | |
set mytext to searchReplace(myClip, "<", "") | |
set mytext to searchReplace(mytext, ">.", "") | |
set mytext to searchReplace(mytext, ">", "") | |
set findIt to "\\" | |
set replaceIt to "/" | |
set mylocation to searchReplace(mytext, findIt, replaceIt) | |
set mylocation to "smb:" & mylocation | |
tell application "Finder" | |
open location mylocation | |
end tell | |
return input | |
end run |
Not support if folder has special characters :
| & : ; ( ) < > ~ * @ ? ! $ # [ ] { } \ / ' " `
Any ideas?
I've tried this code and still get the Syntax Error "can't get every text item" like the folks above; Does anyone have an updated solve for this?
I've tried this code and still get the Syntax Error "can't get every text item" like the folks above; Does anyone have an updated solve for this?
So solve the error, don't run the script inside automator.
At the top (in automator) set it from "auto" (translated from german) to "Text" and test it with an actual path.
The script can't do anything inside automator because no text is selected to open.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
using this variant is working for me:
replace
tell application "Finder"
with
tell application "System Events"