been struggling to get this to work, I think the syntax is off a bit? maybe maybe needs some “”? or ()'s
if not exists file "/Users/{name of logged on user}/Library/Application Support/Microsoft/Teams/Background/Uploads/AdobeStockxxx.jpg"
copy “__Download/AdobeStockxxx.jpg” "/Users/{name of logged on user}/Library/Application Support/Microsoft/Teams/Background/Uploads/AdobeStockxxx.jpg"
endif
thank you
You need to treat the strings as separate items and join with &
"/Users/" & {name of logged on user} & "/Library/Application Support/Microsoft/Teams/Background/Uploads/AdobeStockxxx.jpg"
1 Like
To add a bit, your ‘if’ statement needs a relevance substitution so that it would return a true/false answer. Combine that with the @amelgares advice on building the string concatenation
if {not exists file "/Users/" & name of logged on user & "/Library/Application Support/Microsoft/Teams/Background/Uploads/AdobeStockxxx.jpg"}
copy "__Download/AdobeStockxxx.jpg" "/Users/{name of logged on user}/Library/Application Support/Microsoft/Teams/Background/Uploads/AdobeStockxxx.jpg"
endif
1 Like
thank you for the suggestions, but unfortunately they did not work.
it seems like it must be something simple?
here is a slightly different example trying to create folders, same issue.
tried this
if {not exists folder “/Users/ & {name of logged on user} & /Library/Application Support/Microsoft/Teams”}
folder create “/Users/ & {name of logged on user} & /Library/Application Support/Microsoft/Teams”
folder create “/Users/ & {name of logged on user} & /Library/Application Support/Microsoft/Teams/Background”
folder create “/Users/ & {name of logged on user} & /Library/Application Support/Microsoft/Teams/Background/Uploads”
endif
and this
if {not exists folder “/Users/{name of logged on user}/Library/Application Support/Microsoft/Teams”}
folder create “/Users/{name of logged on user}/Library/Application Support/Microsoft/Teams”
folder create “/Users/{name of logged on user}/Library/Application Support/Microsoft/Teams/Background”
folder create “/Users/{name of logged on user}/Library/Application Support/Microsoft/Teams/Background/Uploads”
endif
also I I noticed in edit mode, that this text in the if statement, is black, I think it should be orange?
/Library/Application Support/Microsoft/Teams
also this part of the if statement text, is in pink, I think it should be orange?
/Users
The script looks ok to me, but it would have the limitation that there must be one (and only one) logged on user when it executes. Is that the case?