I need a script that looks at the current active finder window path and checks if the pahth contains a name. If a certain name is found, then another variable should be changed to something else.
tell application "Finder"
set currentDirectory to target of Finder window 1
set myVar to "something"
set myVar2 to "xxx"
if currentDirectory contains myVar then set myVar2 to "something else"
Please try this code and let me know if it works for you:
set myVar1 to "Users" set myVar2 to "2" set myVar3 to "3" tell application "Finder" set thePath to (POSIX path of (target of window 1 as alias)) if thePath contains myVar1 then set myVar2 to myVar3 end if end tell