Activate a specific OSX tag in finder.
By Lynn Graber @Lynn_Graber
Title
Activate a specific OSX tag in finder.
What do you expect to happen when you run the script/macro?
This script works as is, but i want to add an osx tag to the folder.
Are you seeing an error?
What happens when you run this script?
It works fine, but i want to add a green tag to the folder after renaming it.
How were you running this script?
Other
How important is this issue to you?
4
Details
{ "inputExpected": "This script works as is, but i want to add an osx tag to the folder. ", "inputIsError": false, "inputWhatHappens": "It works fine, but i want to add a green tag to the folder after renaming it. ", "inputHowRun": { "key": "-MpfwoFyZNOpBC3X5xGI", "title": "Other" }, "inputImportance": 4, "inputTitle": "Activate a specific OSX tag in finder." }
Source
// Get the session path from the SDK
const sessionPath = sf.app.proTools.getSessionPath().sessionPath.replace(/:/g, '/').split('/').slice(1,-1).join('/');
// Get Session Folder Name
const sessionName = sf.file.getFileInfo({path:`${sessionPath}`}).fileInfo.name
sf.system.exec({
commandLine: `
mv "${sessionPath}/Bounced Files" "${sessionPath}/${sessionName}"
`});
Links
User UID: zNchbgqMvBUNXIhmLZsA7wqfiDl1
Feedback Key: sffeedback:zNchbgqMvBUNXIhmLZsA7wqfiDl1:-NsTpVso96b5sqQdkqtc
Feedback ZIP: oxZf4DaEwIPuYpP+vhYGSjQjbSdD+4uhkz1fhCiZWQsGPUs2sHE1HHaGDWa3EjIsVHriiGDtnqmod1iq9q8W4qq2E40fCfFepV4b1cP33iYBRogJTB1GcEts11z6DpaSA1TZ2ij4rE17tSQn258TGFbpnp8E3mAvBSJWr1zKzpxLhotwD4BYJZ8pqX01dIlca+zef9UyyGNdyYiSEEOKfk0JApYMMVGa1HgvhRi85hI/W2rgojw8QC5W3IHsKOr9KAJ7tgvHaQoQG5JtFwlXrdkZ2E4rqL1rBaHEuNtI7IVyRy7lHrfJ0MjJFuPlV3RBNZj2Diosb+0Dr8W6XKMeyeOMXV2MI8ikGKfVihNRMQw=
- Chris Shaw @Chris_Shaw2024-03-08 17:49:56.395Z
This will set the color tag on a file.
const filePath = // YOUR FILE PATH const filePathForAppleScript = `POSIX file "${filePath}"`; //Select file in finder sf.system.execAppleScript({ script: ` tell application "Finder" to select {${filePathForAppleScript}} `}); sf.system.execAppleScript({ script: `tell application "Finder" set sel to selection if sel is not {} then set filepath to item 1 of sel --> 0-None | 1-Red | 2-Orange | 3-Yellow | 4-Green | 5-Blue |6-Purple --> Set number on next line with values above this line to set color set label index of filepath to 3 end if end tell` })