iView home page
iView Multimedia Forum Index

FAQ FAQ     SearchSearch     MemberlistMemberlist     UsergroupsUsergroups    RegisterRegister  
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

lower to UPPER case

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    iView Multimedia Forum Index -> VB Script
View previous topic :: View next topic  
Author Message
markbolton



Joined: 19 Apr 2006
Posts: 10

PostPosted: Fri Feb 09, 2007 2:21 pm    Post subject: lower to UPPER case Reply with quote

Hi there.... I am a user of media pro3 and wondered if you could help. My new agents (I am a photographer) require me to use their metadata teplates (photoshop), but this means that I have to do two things which, as yet, I havent found a way to do in Iview. I need to select a group of images and write the file name into the 'Document Title' field. I also need to change the case of the description and keywords to Upper case. I am not knbowledgable about sript writing and wondered if there was a script 'library' that I might find these two scripts in (if they exist!).... any help gratefully received. Mark
Back to top
View user's profile Send private message
John Bean



Joined: 24 Jun 2006
Posts: 245
Location: Lancashire

PostPosted: Sat Feb 10, 2007 10:52 am    Post subject: Reply with quote

Don't know if there's a standard script but I have a very similar one that required only very minor changes to do what you need, so here it is:

Code:

Const kMsgBoxTitle = "Save filename"

Set app = CreateObject("iView.Application")

If (app.Catalogs.count = 0) Then

   MsgBox "Please launch iView MediaPro.", vbCritical, kMsgBoxTitle

ElseIf (app.ActiveCatalog.Selection.Count = 0) Then

   MsgBox "Select one or more items first", vbCritical, kMsgBoxTitle

Else

   For Each mediaItem In app.ActiveCatalog.Selection

      If (mediaItem.Name <> "") Then
      
         mediaitem.Annotations.Title = mediaitem.Name

         With mediaitem.annotations
            
            If (.Description <> "") Then
               .Description = UCase(.Description)
            End If

            If (.Keywords <> "") Then
               .Keywords = UCase(.Keywords)
            End If
            
         End With

      End If

   Next

   MsgBox "Done", vbInformation, kMsgBoxTitle
   
End If



Save it as an appropriately named .vbs file in the correct place (use the reveal script under tools to find the right place) and it will appear on the scripts menu. Select a file and run it to test it does what you want. If it's ok select all files and let it run :-)
Back to top
View user's profile Send private message Visit poster's website
markbolton



Joined: 19 Apr 2006
Posts: 10

PostPosted: Tue Feb 13, 2007 2:17 pm    Post subject: Reply with quote

good lord, its brilliant.... many thanks for that....I didn't think it would be possible to do this and youve saved me a lot of time and effort. Cheers!!! Mark
Back to top
View user's profile Send private message
John Bean



Joined: 24 Jun 2006
Posts: 245
Location: Lancashire

PostPosted: Tue Feb 13, 2007 4:03 pm    Post subject: Reply with quote

markbolton wrote:
good lord, its brilliant....


I wouldn't go that far, but nice to be appreciated ;-)

It's quick and easy enough to churn out one of these little bespoke scripts if you use proper scripting tools, less easy if all you have is a scripting reference document and a text editor to work with. As you've discovered, even a tiny script can sometimes save huge amounts of time and effort.
Back to top
View user's profile Send private message Visit poster's website
markbolton



Joined: 19 Apr 2006
Posts: 10

PostPosted: Tue Feb 13, 2007 4:21 pm    Post subject: Reply with quote

I'd like to learn more about scripting. In this case it seems that VB is ideal...what would I need to get started learning how to make them? M
Back to top
View user's profile Send private message
johnbeardy



Joined: 22 Nov 2004
Posts: 1137
Location: Dulwich, South ("Sarf") London

PostPosted: Tue Feb 13, 2007 5:39 pm    Post subject: Reply with quote

Have something you want to do, like this, and hack a script or two to do it. ie don't "learn VB" in the general, learn it through specific tasks that give you immediate benefits.

John
_________________
PC and Mac too
iView scripts & utilities
Back to top
View user's profile Send private message Visit poster's website
John Bean



Joined: 24 Jun 2006
Posts: 245
Location: Lancashire

PostPosted: Wed Feb 14, 2007 9:30 pm    Post subject: Reply with quote

John's advice is sound, but doesn't suit everyone. My advice is use the web ("Google is your friend") - there's a vast amount of information and tutorials at all levels about VBScript. Don't confuse this with VB (Visual Basic) despite the similarity, VB is not a scripting language.

It helps a lot to understand the basics of Windows scripting and how it works in general before applying it to a specific example, but John's suggestion of taking existing scripts (like the one I did for you) and messing about with them in conjunction with the iView scripting reference to make it do other things.

Finally I really do recommend you use an editor that knows all about VBScript - preferably one that also provides ways of examining the objects and methods available to you while you're writing the script. If you use Microsoft Office the built-in editor for VBA (the scripting language for Office) will do this for any VBScript not just VBA, but I don't use Office so I use a better, smaller VBScript editor called Vbsedit. It's not free but it's not expensive and is very productive when writing VBScript. There's a free working try-out available, see
http://www.vbsedit.com for details.

Something to play with anyway :-)
Back to top
View user's profile Send private message Visit poster's website
mantra



Joined: 29 Jun 2007
Posts: 133

PostPosted: Wed Jan 23, 2008 6:56 pm    Post subject: Reply with quote

John Bean wrote:
Don't know if there's a standard script but I have a very similar one that required only very minor changes to do what you need, so here it is:

Code:

Const kMsgBoxTitle = "Save filename"

Set app = CreateObject("iView.Application")

If (app.Catalogs.count = 0) Then

   MsgBox "Please launch iView MediaPro.", vbCritical, kMsgBoxTitle

ElseIf (app.ActiveCatalog.Selection.Count = 0) Then

   MsgBox "Select one or more items first", vbCritical, kMsgBoxTitle

Else

   For Each mediaItem In app.ActiveCatalog.Selection

      If (mediaItem.Name <> "") Then
      
         mediaitem.Annotations.Title = mediaitem.Name

         With mediaitem.annotations
            
            If (.Description <> "") Then
               .Description = UCase(.Description)
            End If

            If (.Keywords <> "") Then
               .Keywords = UCase(.Keywords)
            End If
            
         End With

      End If

   Next

   MsgBox "Done", vbInformation, kMsgBoxTitle
   
End If



Save it as an appropriately named .vbs file in the correct place (use the reveal script under tools to find the right place) and it will appear on the scripts menu. Select a file and run it to test it does what you want. If it's ok select all files and let it run :-)


great
to capitalize only the first letter, what should i change in the script?
_________________
Giovanni
Back to top
View user's profile Send private message
ianw



Joined: 23 Dec 2005
Posts: 126
Location: Bromley, Kent, UK

PostPosted: Thu Jan 24, 2008 1:32 pm    Post subject: Reply with quote

mantra wrote:
to capitalize only the first letter, what should i change in the script?

See johnbeardy's 'Rename - first letter capital' script on this page - http://www.beardsworth.co.uk/iview_scripts.php?group=iview

Ian
Back to top
View user's profile Send private message
mantra



Joined: 29 Jun 2007
Posts: 133

PostPosted: Thu Jan 24, 2008 2:30 pm    Post subject: Reply with quote

ianw wrote:
mantra wrote:
to capitalize only the first letter, what should i change in the script?

See johnbeardy's 'Rename - first letter capital' script on this page - http://www.beardsworth.co.uk/iview_scripts.php?group=iview

Ian


you mean http://www.beardsworth.co.uk/iview/iview/Rename%20-%20first%20letter%20capital%20.vbs.txt?PHPSESSID=b25770bf9a0386ee1883251ea1bad0af

but it changes the files name not the matadata
for example if u have a file like car.jpg , this script rename in Car.jpg

but if u have metadata like keywords-->car it doesn't change your metadata
_________________
Giovanni
Back to top
View user's profile Send private message
ianw



Joined: 23 Dec 2005
Posts: 126
Location: Bromley, Kent, UK

PostPosted: Fri Jan 25, 2008 12:51 am    Post subject: Reply with quote

mantra wrote:
but it changes the files name not the matadata

Correct - but it's an example of code that makes the first letter a capital. I thought you might then experiment to get a script working.

However to speed things up...
Code:
'----------------------------------------------------------------------------
' For selected images convert all keywords to lower case and then make first
' letter upper case
'
' e.g. Alphabet -> Alphabet (no change)
'      alphabet -> Alphabet
'      AlPhAbEt -> Alphabet
'      ALPHABET -> Alphabet
'
' e.g. Alphabet soup -> Alphabet soup (no change)
'      Alphabet Soup -> Alphabet soup
'      alphabet soup -> Alphabet soup
'      AlPhAbEt SoUp -> Alphabet soup
'      ALPHABET SOUP -> Alphabet soup
'
' If you want to capitalise each word within a keyword then replace
'  If Mid(keywords,bit,1) = ";" Then
' with
'  If Mid(keywords,bit,1) = ";" Or Mid(keywords,bit,1) = " " Then
'
' e.g. Alphabet soup -> Alphabet Soup
'      Alphabet Soup -> Alphabet Soup (no change)
'      alphabet soup -> Alphabet Soup
'      AlPhAbEt SoUp -> Alphabet Soup
'      ALPHABET SOUP -> Alphabet Soup
'----------------------------------------------------------------------------

Const kMsgBoxTitle = "Capitalise Keywords"

Set ivApp = CreateObject("iView.Application")
   
If (ivApp.Catalogs.Count = 0) Then
 MsgBox "Please launch iView MediaPro.", vbCritical, kMsgBoxTitle
Else
 Main
End If

Sub Main()
 Set ivCat = ivApp.ActiveCatalog
 For Each ivItem In ivCat.Selection
  If ivItem.Annotations.Keywords <> "" Then
   ivItem.Annotations.Keywords = ProperCase(ivItem.Annotations.Keywords)
  End If
 Next
End Sub

Function ProperCase(keywords)
 keywords = Ucase(Left(keywords,1)) & Lcase(Mid(keywords,2))
 For bit = 2 To (Len(keywords)-1)
  If Mid(keywords,bit,1) = ";" Then
   keywords = Left(keywords,bit) & Ucase(Mid(keywords,bit+1,1)) & Mid(keywords,bit+2)
  End If
 Next
 ProperCase = keywords
End Function

I've only tested this on a few images and it seems to do the trick but you use at your own risk i.e. back up your catalog before trying.

It may leave behind unused keywords in the organise panel. I don't know a way of avoiding this. You will have to manually delete these.

Ian
Back to top
View user's profile Send private message
mantra



Joined: 29 Jun 2007
Posts: 133

PostPosted: Fri Jan 25, 2008 7:17 am    Post subject: Reply with quote

ianw wrote:
mantra wrote:
but it changes the files name not the matadata

Correct - but it's an example of code that makes the first letter a capital. I thought you might then experiment to get a script working.

However to speed things up...
Code:
'----------------------------------------------------------------------------
' For selected images convert all keywords to lower case and then make first
' letter upper case
'
' e.g. Alphabet -> Alphabet (no change)
'      alphabet -> Alphabet
'      AlPhAbEt -> Alphabet
'      ALPHABET -> Alphabet
'
' e.g. Alphabet soup -> Alphabet soup (no change)
'      Alphabet Soup -> Alphabet soup
'      alphabet soup -> Alphabet soup
'      AlPhAbEt SoUp -> Alphabet soup
'      ALPHABET SOUP -> Alphabet soup
'
' If you want to capitalise each word within a keyword then replace
'  If Mid(keywords,bit,1) = ";" Then
' with
'  If Mid(keywords,bit,1) = ";" Or Mid(keywords,bit,1) = " " Then
'
' e.g. Alphabet soup -> Alphabet Soup
'      Alphabet Soup -> Alphabet Soup (no change)
'      alphabet soup -> Alphabet Soup
'      AlPhAbEt SoUp -> Alphabet Soup
'      ALPHABET SOUP -> Alphabet Soup
'----------------------------------------------------------------------------

Const kMsgBoxTitle = "Capitalise Keywords"

Set ivApp = CreateObject("iView.Application")
   
If (ivApp.Catalogs.Count = 0) Then
 MsgBox "Please launch iView MediaPro.", vbCritical, kMsgBoxTitle
Else
 Main
End If

Sub Main()
 Set ivCat = ivApp.ActiveCatalog
 For Each ivItem In ivCat.Selection
  If ivItem.Annotations.Keywords <> "" Then
   ivItem.Annotations.Keywords = ProperCase(ivItem.Annotations.Keywords)
  End If
 Next
End Sub

Function ProperCase(keywords)
 keywords = Ucase(Left(keywords,1)) & Lcase(Mid(keywords,2))
 For bit = 2 To (Len(keywords)-1)
  If Mid(keywords,bit,1) = ";" Then
   keywords = Left(keywords,bit) & Ucase(Mid(keywords,bit+1,1)) & Mid(keywords,bit+2)
  End If
 Next
 ProperCase = keywords
 Set ivCat = ivApp.ActiveCatalog
 For Each ivItem In ivCat.Selection
  If ivItem.Annotations.People <> "" Then
   ivItem.Annotations.People = ProperCase(ivItem.Annotations.People)
  End If
 Next
End Sub

Function ProperCase(People)
 People = Ucase(Left(People,1)) & Lcase(Mid(People,2))
 For bit = 2 To (Len(People)-1)
  If Mid(People,bit,1) = ";" Then
   People = Left(People,bit) & Ucase(Mid(People,bit+1,1)) & Mid(People,bit+2)
  End If
 Next
 ProperCase = People

End Function

I've only tested this on a few images and it seems to do the trick but you use at your own risk i.e. back up your catalog before trying.

It may leave behind unused keywords in the organise panel. I don't know a way of avoiding this. You will have to manually delete these.

Ian


thanks! :D
i will try to exend to other fileld
I added the filed People
i think it could be easy
is enough to change "Keywords" to "People" or "Creator" "Event"
_________________
Giovanni
Back to top
View user's profile Send private message
ianw



Joined: 23 Dec 2005
Posts: 126
Location: Bromley, Kent, UK

PostPosted: Fri Jan 25, 2008 7:53 am    Post subject: Reply with quote

mantra wrote:
is enough to change "Keywords" to "People" or "Creator" "Event"

Yes and No. I'm not sure your version of my script will work? Also I don't think it is a good idea to have a script that changes both keywords and people. Keep it simple and have them in different scripts.

This script will capitalise each word in the People field.

Code:
'----------------------------------------------------------------------
' For selected images convert all "People" to lower case and then make
' first letters of each word upper case
'----------------------------------------------------------------------

Const kMsgBoxTitle = "Capitalise People"

Set ivApp = CreateObject("iView.Application")
   
If (ivApp.Catalogs.Count = 0) Then
 MsgBox "Please launch iView MediaPro.", vbCritical, kMsgBoxTitle
Else
 Main
End If

Sub Main()
 Set ivCat = ivApp.ActiveCatalog
 For Each ivItem In ivCat.Selection
  If ivItem.Annotations.People <> "" Then
   ivItem.Annotations.People = ProperCase(ivItem.Annotations.People)
  End If
 Next
End Sub

Function ProperCase(string)
 string = Ucase(Left(string,1)) & Lcase(Mid(string,2))
 For bit = 2 To (Len(string)-1)
  If Mid(string,bit,1) = ";" Or Mid(string,bit,1) = " " Then
   string = Left(string,bit) & Ucase(Mid(string,bit+1,1)) & Mid(string,bit+2)
  End If
 Next
 ProperCase = string
End Function

However this may not be a good idea as not every name will come out correct. For example "Oscar de la Hoya" will become "Oscar De La Hoya".

What about names with hyphens or apostrophes? My friend Lucy-Anne O'Connor will become Lucy-anne O'connor!

You could change the script to handle these but then it won't handle MacDonald, which would become Macdonald. You could work even change the script to handle this, but if your name is Macey you don't want it to become MacEy!

You'll never cope with unusual names like "Audrey fforbes-Hamilton"!!!

You can't have that many People set up in your catalogs that you can't correct these manually - and you should then have a vocabulary set up to prevent you entering names incorrectly.

The above script is simpler now so that if you wanted to capitalise Creator then you just change 'People' to 'Creator' and save as a new script.

Ian

ps - please don't quote so much in a reply, makes it hard to follow!
Back to top
View user's profile Send private message
mantra



Joined: 29 Jun 2007
Posts: 133

PostPosted: Fri Jan 25, 2008 8:58 am    Post subject: Reply with quote

ianw wrote:
mantra wrote:
is enough to change "Keywords" to "People" or "Creator" "Event"

Yes and No. I'm not sure your version of my script will work? Also I don't think it is a good idea to have a script that changes both keywords and people. Keep it simple and have them in different scripts.

This script will capitalise each word in the People field.

However this may not be a good idea as not every name will come out correct. For example "Oscar de la Hoya" will become "Oscar De La Hoya".

What about names with hyphens or apostrophes? My friend Lucy-Anne O'Connor will become Lucy-anne O'connor!

You could change the script to handle these but then it won't handle MacDonald, which would become Macdonald. You could work even change the script to handle this, but if your name is Macey you don't want it to become MacEy!

You'll never cope with unusual names like "Audrey fforbes-Hamilton"!!!

You can't have that many People set up in your catalogs that you can't correct these manually - and you should then have a vocabulary set up to prevent you entering names incorrectly.

The above script is simpler now so that if you wanted to capitalise Creator then you just change 'People' to 'Creator' and save as a new script.

Ian

ps - please don't quote so much in a reply, makes it hard to follow!


thanks Ianw
i agree , it's not a good idea capitalize every words
thanks for the script :D
i tried to make 1 script for many tasks
but u said it's better one for 1 porpoise
_________________
Giovanni
Back to top
View user's profile Send private message
mantra



Joined: 29 Jun 2007
Posts: 133

PostPosted: Sun Jan 27, 2008 9:22 am    Post subject: Reply with quote

ianw wrote:
mantra wrote:
is enough to change "Keywords" to "People" or "Creator" "Event"

Yes and No. I'm not sure your version of my script will work? Also I don't think it is a good idea to have a script that changes both keywords and people. Keep it simple and have them in different scripts.

This script will capitalise each word in the People field.


However this may not be a good idea as not every name will come out correct. For example "Oscar de la Hoya" will become "Oscar De La Hoya".

What about names with hyphens or apostrophes? My friend Lucy-Anne O'Connor will become Lucy-anne O'connor!

You could change the script to handle these but then it won't handle MacDonald, which would become Macdonald. You could work even change the script to handle this, but if your name is Macey you don't want it to become MacEy!

You'll never cope with unusual names like "Audrey fforbes-Hamilton"!!!

You can't have that many People set up in your catalogs that you can't correct these manually - and you should then have a vocabulary set up to prevent you entering names incorrectly.

The above script is simpler now so that if you wanted to capitalise Creator then you just change 'People' to 'Creator' and save as a new script.

Ian

ps - please don't quote so much in a reply, makes it hard to follow!



Hi Ian
this script capitalize only the first letter
for example john zorn became John zorn
any idea to capilalize the "zorn" too?
_________________
Giovanni
Back to top
View user's profile Send private message
ianw



Joined: 23 Dec 2005
Posts: 126
Location: Bromley, Kent, UK

PostPosted: Sun Jan 27, 2008 10:21 am    Post subject: Reply with quote

Giovanni,

Please read my earlier post from Fri Jan 25, 2008 7:53 am. The script there does what you want.

However the script cannot 'work' 100% - not every name should have a capital letter at the begining of each word. Also what makes a word a word? This script will capitalise the first letter of a name and then every letter following a space.

Again, please don't quote whole messages in reply - it makes it hard to follow, and maybe why you missed the script you are looking for!

Ian
Back to top
View user's profile Send private message
mantra



Joined: 29 Jun 2007
Posts: 133

PostPosted: Sun Jan 27, 2008 10:45 am    Post subject: Reply with quote

ianw wrote:
Giovanni,

Please read my earlier post from Fri Jan 25, 2008 7:53 am. The script there does what you want.

However the script cannot 'work' 100% - not every name should have a capital letter at the begining of each word. Also what makes a word a word? This script will capitalise the first letter of a name and then every letter following a space.

Again, please don't quote whole messages in reply - it makes it hard to follow, and maybe why you missed the script you are looking for!

Ian

thanks for the answer
well i have for example "mercatino di natale" and the script change it in "Mercatino di natale"

i guess the script should change in "Mercatino Di Natale"
so it's deoesn't work @ 100%
_________________
Giovanni
Back to top
View user's profile Send private message
ianw



Joined: 23 Dec 2005
Posts: 126
Location: Bromley, Kent, UK

PostPosted: Sun Jan 27, 2008 11:00 am    Post subject: Reply with quote

Because this thread is now so cluttered I think you've taken the wrong script.

This script - the same as in my post above - works on the name you've supplied - "mercatino di natale" becomes "Mercatino Di Natale".

Code:
'----------------------------------------------------------------------
' For selected images convert all "People" to lower case and then make
' first letters of each word upper case
'----------------------------------------------------------------------

Const kMsgBoxTitle = "Capitalise People"

Set ivApp = CreateObject("iView.Application")
   
If (ivApp.Catalogs.Count = 0) Then
 MsgBox "Please launch iView MediaPro.", vbCritical, kMsgBoxTitle
Else
 Main
End If

Sub Main()
 Set ivCat = ivApp.ActiveCatalog
 For Each ivItem In ivCat.Selection
  If ivItem.Annotations.People <> "" Then
   ivItem.Annotations.People = ProperCase(ivItem.Annotations.People)
  End If
 Next
End Sub

Function ProperCase(string)
 string = Ucase(Left(string,1)) & Lcase(Mid(string,2))
 For bit = 2 To (Len(string)-1)
  If Mid(string,bit,1) = ";" Or Mid(string,bit,1) = " " Then
   string = Left(string,bit) & Ucase(Mid(string,bit+1,1)) & Mid(string,bit+2)
  End If
 Next
 ProperCase = string
End Function


Note that if I click on the name in the organize panel it shows the original lower case version. This is because the people names are being held in a vocabulary (which I have not asked iView to do?). This conversion does not change the vocabulary file - you will have to do this manually.

Ian
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    iView Multimedia Forum Index -> VB Script All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



  © iView Multimedia Ltd. | All Rights Reserved Privacy Policy | Copyright | Site Map