Author Topic: Categories sorted  (Read 2492 times)

unterwasserfoto_at

  • Full Member
  • **
  • Posts: 120
Categories sorted
« on: April 17, 2015, 11:27:34 PM »
Whats there....? The Categories will be not sorted?

For each c in Cats

Debug.print c.QualifiedName 

bring the Categories confuse, like the sample

21_Ort|Europa - europäisches - europäischer * Europe - european
21_Ort|Europa - europäisches - europäischer * Europe - european|Österreich - österreichisches - österreichischer - österreichische
12_DatumDB
21_Ort
20_Grundeinstellungen
11_DatumAll
12_DatumDB|2015
12_DatumDB|2015|03 Maerz
12_DatumDB|2015|03 Maerz|23
11_DatumAll|2015
11_DatumAll|2015|03 Maerz
11_DatumAll|2015|03 Maerz|23
21_Ort|_001_Kontinent
Berufsfotograf in Österreich.
HW: Nikon D5, Nikon Coolscan 5000, Subal Unterwassergehäuse, DJI Phantom
SW Photoshop CS4, Adobe Bridge, IMatch6

JohnZeman

  • Global Moderator
  • *****
  • Posts: 1463
  • I'm too damn old to act my age.
Re: Categories sorted
« Reply #1 on: April 18, 2015, 01:14:35 AM »
You are right, in a script the categories are not returned in a sorted manner unless you tell the script to sort categories.

To see how to sort them take a look at Category Jumper in the script gallery (link below).

https://www.photools.com/community/index.php?topic=723.0

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Categories sorted
« Reply #2 on: April 18, 2015, 08:37:17 AM »
Also check out the The Sorter Class help topic.

unterwasserfoto_at

  • Full Member
  • **
  • Posts: 120
Re: Categories sorted
« Reply #3 on: April 18, 2015, 09:02:04 AM »
Thx

@John
I have see your script before. But i don remamber it.
Its great. Respect.

Also i look for the Sorter-Methode, but i dont understand it use it and the syntax for it

Dim s        As    New Sorter
Dim cats        As    Categories
Dim c            As   Category


Set cats = f. Categories(False,False)
s.SortCategories (cats,ecmStandardCS,True)

Berufsfotograf in Österreich.
HW: Nikon D5, Nikon Coolscan 5000, Subal Unterwassergehäuse, DJI Phantom
SW Photoshop CS4, Adobe Bridge, IMatch6

JohnZeman

  • Global Moderator
  • *****
  • Posts: 1463
  • I'm too damn old to act my age.
Re: Categories sorted
« Reply #4 on: April 18, 2015, 02:40:18 PM »
I'm heading out the door to work for the rest of the day but here's a real simple example that sorts the categories assigned to the focused file.

Code: [Select]
Sub Main

Debug.Clear

Dim f As File
Set f = Application.GetFileWindow(imfwtCurrent).FocusedFile

Dim s As New Sorter
Dim c As Category
Dim cats As Categories
Set cats = f.Categories(True,True)
s.SortCategories cats,ecmStandardCS,True

For Each c In cats
Debug.Print c.QualifiedName
Next

Set c = Nothing
Set cats = Nothing

End Sub

unterwasserfoto_at

  • Full Member
  • **
  • Posts: 120
Re: Categories sorted
« Reply #5 on: April 18, 2015, 04:27:27 PM »
Thx
i have allready down.

Now i have new Problems. I would like write into the file the IPTC Data. pfffffff..........
Berufsfotograf in Österreich.
HW: Nikon D5, Nikon Coolscan 5000, Subal Unterwassergehäuse, DJI Phantom
SW Photoshop CS4, Adobe Bridge, IMatch6

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Categories sorted
« Reply #6 on: April 18, 2015, 07:24:33 PM »
Don't write legacy IPTC data if you don't rally must. This data has been declared legacy by the IPTC committee 10 years ago. See the IMatch help for details about XMP data, IPTC contained in XMP, and the legacy IPTC data.

To read and write metadata in scripts, use the metadata classes.

See the topic Metadata Classes in the IMatch help system, plus the corresponding sample scripts.
You cannot directly write metadata from a script to a file. You use the Metadata classes and let IMatch take care for the rest.

unterwasserfoto_at

  • Full Member
  • **
  • Posts: 120
Re: Categories sorted
« Reply #7 on: April 21, 2015, 08:16:57 PM »
MARIO!!!!
I have - i don`t know why - 7.000 unwritten images.

Soooooo, when i set the option to write automatic, IMatch to try all the images. But many on a place how are write-protected!!

I wish me a methode to order IMatch from the script, that IMatch start writing the IPTC-Data to the images. Is this possible????


for each f in Select

data.Update vals
data.WriteBack
f.IPTCwrite 'this methode order only IMatch to finish the prozess to write from the Database to the Images
Berufsfotograf in Österreich.
HW: Nikon D5, Nikon Coolscan 5000, Subal Unterwassergehäuse, DJI Phantom
SW Photoshop CS4, Adobe Bridge, IMatch6

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Categories sorted
« Reply #8 on: April 21, 2015, 08:41:33 PM »
You cannot trigger a write-back from a script.
Either IMatch writes back files immediately, or when you use the pending write-back command.
As I tried to explain above, it can cause many problems when you could override the automatic write-back processing of images. IMatch may already be writing files while your script runs.

unterwasserfoto_at

  • Full Member
  • **
  • Posts: 120
Re: Categories sorted
« Reply #9 on: April 21, 2015, 10:04:12 PM »
Whats this?
Warning: Error converting value for ExifIFD:SubSecTime

Where i can set this and what value?
Berufsfotograf in Österreich.
HW: Nikon D5, Nikon Coolscan 5000, Subal Unterwassergehäuse, DJI Phantom
SW Photoshop CS4, Adobe Bridge, IMatch6

Mario

  • IMatch Developer
  • Administrator
  • *****
  • Posts: 30082
Re: Categories sorted
« Reply #10 on: April 21, 2015, 10:09:28 PM »
That's a warning message from ExifTool. It is always issued when there are no 1/100s in a file (which is normal).

I don't know why you post such questions in the Scripting and Apps board, though. Try to use the proper board for your questions - General Discussion and Questions. This is not related to scripting but to metadata processing and ExifTool.

See the ExifTool web site and the ExifTool FAQ for more information about ExifTool warnings. Or just Google and you'll have the answer in one second.