SetAttr META tags: pasted tags cut off

[quote]It may also make sense to check for the dialog being cancelled, and/or an empty string.[/quote]Ah yes, Without checking for an empty string clicking OK or Cancel will clear the comment field if the string is empty instead of doing nothing. This one prevents this:

Function OnClick(ByRef ClickData) Meta = ClickData.Func.Dlg.GetString("Type your long string:",,512,"OK,|Cancel","Edit Comment") If Not Meta = "" Then ClickData.Func.Command.RunCommand("SetAttr META ""comment:" & Meta & """") End If End Function

Thanks, Leo. It's not really an issue, since i rarely copy such many tags. I wanted to report it anyway.

@Kundal:

I get an error message, "function can't be found". I suppose, this is not a code to use in a normal button?

You have to choose the appropriate function: "script function" in the button editor to get it working.

Here's an example of a more advanced button for editing tags and/or comment. The dialog box let you choose whether to edit tags and/or comment. The checkbox for editing tags is enabled by default and a +-sign is set to the text field for adding tags to the existing ones. With an additional button you can also clear the chosen metadata fields.


[code]Function OnClick(ByRef ClickData)
Set dlg = ClickData.Func.Dlg
dlg.message = "Choose to edit tags and/or comment and insert your new content:"
dlg.title = "Edit Metadata"
dlg.buttons = "OK|Clear|Cancel"
dlg.options(0).label = "Edit Tags"
dlg.options(1).label = "Edit Comment"
dlg.max = 512
dlg.options(0).state = True
dlg.options(1).state = False
dlg.default = "+"
i = dlg.show

If dlg.options(0).state = True Then
	If i = 1 Then
		If Not (dlg.input  = "" Or dlg.input = "+") Then
			ClickData.Func.Command.RunCommand("SetAttr META ""tags:" & dlg.Input & """")
		End If
	End If
	If i = 2 Then
		ClickData.Func.Command.RunCommand("SetAttr META ""tags:")
	End If
End If
If dlg.options(1).state = True Then
	If i = 1 Then
		If Not (dlg.input  = "" Or dlg.input = "+") Then
			ClickData.Func.Command.RunCommand("SetAttr META ""comment:" & dlg.Input & """")
		End If
	End If
	If i = 2 Then
		ClickData.Func.Command.RunCommand("SetAttr META ""comment:")
	End If
End If

End Function
[/code]

Ah, yes, there it was. Didn't use this type until now. Thanks for the new script, i replaced my old function now. It's also a good idea, to use the "+" default.
By the way, would it be possible to make those boxes appear in a different position? Preferably i would place it right under the lister, so i can still look at the images
while typing in the tags.

Hi abr,
I saw your question about combining scripts with raw commands in this thread. I think what you want to do is editing one item after the other with the script command I provided. Here's a version that will do that in an endless loop until you click the additional Stop button. Hope you enjoy it:

Edit: Don't use this code. It's not working correctly. Get the working version here: Tagger.

[code]Function OnClick(ClickData)
Call Edit(ClickData)
End Function

Sub Edit(ClickData)
Set dlg = ClickData.Func.Dlg
dlg.message = "Choose to edit tags and/or comment and insert your new content:"
dlg.title = "Edit Metadata"
dlg.buttons = "OK|Clear|Stop|Cancel"
dlg.options(0).label = "Edit Tags"
dlg.options(1).label = "Edit Comment"
dlg.max = 512
dlg.options(0).state = True
dlg.options(1).state = False
dlg.default = "+"
i = dlg.show

If dlg.options(0).state = True Then
	If i = 1 Then
		If Not (dlg.input  = "" Or dlg.input = "+") Then
			ClickData.Func.Command.RunCommand("SetAttr META ""tags:" & dlg.Input & """")
		End If
	End If
	If i = 2 Then
		ClickData.Func.Command.RunCommand("SetAttr META ""tags:")
	End If
End If
If dlg.options(1).state = True Then
	If i = 1 Then
		If Not (dlg.input  = "" Or dlg.input = "+") Then
			ClickData.Func.Command.RunCommand("SetAttr META ""comment:" & dlg.Input & """")
		End If
	End If
	If i = 2 Then
		ClickData.Func.Command.RunCommand("SetAttr META ""comment:")
	End If
End If
If Not i = 3 Then
	ClickData.Func.Command.RunCommand("Select Next")
	Call EditNext(ClickData)
End If
 End Sub

Sub EditNext(ClickData)
Call Edit(ClickData)
End Sub
[/code]

Thanks, kundal. Unfortunately that's not working for me, because this window appears right in the middle of the lister, obscuring parts of the preview. I'm using Hot Keyboard Pro, to press the shortcut for me, which opens the dialog box, & to move that small window under the lister, so i can still see the various items in my photos (i use a special style for that). It does so very quickly (with a x100 factor), so the code change you've provided leaves no gap for the macro to work properly, i'm afraid. So i would strongly vote for a "dlg.position" option or something, so the dialog box could be placed under a lister.

DOpus scripting allows to insert a delay before the next box is popping up. This could give your macro time enough to move the dialog box. Just insert the line DOpus.Delay 500 at line 44 (between Sub EditNext(ClickData) and Call Edit(ClickData)) and experiment with the delay value (milliseconds).

Yeah, +1 for that.
In another scripting project I created a dialog box with several clickboxes and I wish I could avoid scrolling to see all of them by adjusting the size of the dialog box. It could be equivalent to adjusting the size of a lister: dlg.pos = "[width],[heigth],[pos_x],[pos_y]"

That doesn't work, because every time the window would pop up in the wrong (= uncorrected) position.

Thanks, kundal. I reverted to my old code for now, because the macro i'm using has some strange side effects with the new codes anyway (despites of a *100 factor, the macros are very slow). But it's still very promising, that new scripting function, because it might allow skilled users to add some minor changes to Opus' gigantic functionality, which IS already very tough for many users to keep an overview.

The last script code I provided didn't really work.
You can get a working version of the Tagger Script (including an Autohotkey hack to move the dialog box) here: Tagger

Awesome. I got it to work, with the window popping up at the exact position (800/860). However, the auto-step function has a drawback compared to my old workflow - if i missed some item/tag in the old version, i could simply use "arrow up" to go back to the previous image to add the missing tags. Now the input box has always the focus, making it hard to correct the errors, although it's great, when no mistakes are made. If i just could use the "Esc" key as an equivalent to the "stop" button, it would be perfect. :thumbsup:

Glad you like it. :smiley:
I removed the Stop button because it wasn't really necessary. The Cancel button finishes the loop now so it's working with the Esc key.

Excellent! That saves me 99 extra key strokes in a 100 images session. :bulb: :arrow_right:

I handle pictures taken with digital cameras very often, so I'm curious about what kind of tags do you add to your images and how do you make use of these (what kind of search e.g.)?

Hi, tbone. The tags i am adding are mostly description of what is visible in those images. For example, wide angle shots can easily include more than 30-40 tags, like names of buildings, streets, trees, plants, animals, persons, types of ships & boats, names of the various canals or lakes, bridges, presence of clouds, ice, snow, or funny situations.

Basically, it helps me to find certain things, i otherwise would have to search manually, which is a very tough task having about 25.000 images (which isn't even that much, but it becomes more all the time). I also started to rate the images, but that's only a rough estimate so far, i will have to refine it. Since i couple of months i only give my main selction of images one star as a minimum, because when i start my rating's search "1 to 5 stars", it acts like a counter. That's much easier, than adding the file counts of each session folder using the Windows calculator, like i did first :slight_smile:.

Ok, tagging the images the way you describe it, seems to be quite time consuming, but you think it's worth it?
I have a similar amount of pictures taken, right now I put picture sets into dated folders (using a sensible name and "kind of"-tags in the foldername), but tagging for pictures is something I always thought would be a nice option.

I'm not sure if I may ask here, but:

  • You then search through your tagged images with the dopus search (using tags criteria)?.
  • How are these tags stored, are they put into the images directly or somehow into the filesystem?
  • Is there any other application out there, which is capable of making use of these tags? Is it some kind of standard, like for mp3 (i guess it's not)?

Thank you! o))

ps: I did not understand what you tried to achieve by giving 1 star to have some kind of counter, maybe you can give another explanation? o) I'm quite interested in how you and others manage their files, there's always something to learn! o)

Wondered if you live by the coast and then I saw "Hamburg", that makes perfect sense now. o))

Yep. As a hobby photographer, i can't complain about a lack of motifs.