Modify Tags

hello,
i want to make a shortcut that allows me to edit the tags of a selected file.
setting works already but the default text of the input box does not show the current tags.

@set tags={dlgstring|Edit Keywords|{keywords}} SetAttr META "tags:{$tags}"

any idea how i can fix that?

What info exactly were you hoping that your use of {keywords} was going to capture for you?

Ah, never mind... I forgot that Opus uses {keywords} in places it otherwise references as "tags". You don't get access to file info fields like that in command dialogs like {dlgstring}... You'll need to use the technique described in: "Abusing" Rename Scripts to do other things with file info

Here's an example of what I think you want to do:

[code]cd {s}
@firstfileonly
@nodeselect
Rename FILEINFO TYPE=files TO {keywords}
@script vbscript
Option Explicit

Function Rename_GetNewName(strFileName, strFilePath, fIsFolder, strOldName, ByRef strNewName)
Dim DEBUG, vbQuote, keywords, DOpusRTPath, commandLine, shell
' Change DEBUG flag to TRUE to debug without actually executing the commandLine
DEBUG = FALSE
vbQuote = Chr(34)

' Take the {keywords} tag data sent in by strNewName, and store in local var
keywords = strNewName

' Set strNewName to an empty string so that Opus does not rename the file
strNewName = ""

' Change the path below if you haven't installed Opus to the default location:
DOpusRTPath = "C:\Program Files\GPSoftware\Directory Opus\dopusrt.exe"

' Build command line:
commandLine = vbQuote & DOpusRTPath & vbQuote & " /cmd " &_
				  "SetAttr META " & vbQuote & "tags:{dlgstring|Edit Keywords|" & keywords & "}" & vbQuote

' Create the req'd shell object needed to 'Run' the commandLine
Set shell = CreateObject("WScript.Shell")

' If debugging, look for messages in Opus by turning on Logs->Other Logs under the Help button on the default Menu toolbar
if DEBUG then
	DOpus.OutputString "Command:" & vbCrLf & commandLine & vbCrLf
else
	shell.Run commandLine,1,1
end if

End Function[/code]
...just paste that code into a new toolbar button and try it out. There are comments in the script that tell you to set the DEBUG flag to TRUE if you want to debug the commandLine being built by the script for any syntax errors. If you do that, the script will just log the commandLine that it builds to the Opus "Script Output" Log - rather than actually running the command against the file.

thanks, it is working perfectly

just one little thing:
is there a way to stop the dialogbox from popping up for each file if you rename multiple files. it seems to modify all files on the first run already but still opens the dialog for the rest of the files.

Try adding this to the top of the command:

@firstfileonly
@nodeselect

If that doesn't work, there's another way to do it by modifying the script itself, but it's a bit more complex.

FWIW, I would use the Metadta Pane (F9) or Metadata Window (Ctrl+m) which have a field where you can edit the tags of all selected files, and will tell you if the files all have the same tags already or not.

My post edited to include Leo's suggested change - at the spot where it needs to be in order to work... (which it does).

thanks