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 

Build catalogs from folders

 
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 -> AppleScript
View previous topic :: View next topic  
Author Message
idoremus



Joined: 18 Nov 2004
Posts: 11

PostPosted: Thu Mar 15, 2007 7:04 pm    Post subject: Build catalogs from folders Reply with quote

I am not a scripter but have been working on a script to automatically build catalogs. It worked fine two years ago with "iView MediaPro 2.6" but seems to have one bug that I can't get rid of: With "iView MediaPro 3.1.2 (Build 42D4)" I can't seem to have the script start a new catalog for each new folder. I get one massive catalog for everything. Now even reverting to my old "iView 2.6" I get the same problem.

Any help would be appreciated.

Here is my script:
Code:

property xtrafolder : "Extras"
property atext : "Assignment Info"
property catfolder : "Catalogs"

display dialog "This script will build an iView catalog for each folder of each disk image that is mounted."

with timeout of 0 seconds --No timeout
   tell application "Finder"
      set v to every disk of application "Finder" whose comment is "ThisOne"
      repeat with the_folder in v
         set m to the name of the_folder
         set DVDstuff to folder "Stuff4DVD" of home as alias
         set software_folder to folder "iView Catalog Reader 2.6" of DVDstuff
         set assignstuff to folder "Assignment Exports" of DVDstuff
         set trax_file to item "Trax.fp7" of DVDstuff
         
         if not (exists folder catfolder of the_folder) then
            set tofolder3 to make folder at the_folder with properties {name:catfolder}
         else
            set tofolder3 to folder catfolder of the_folder
         end if
         if not (exists folder xtrafolder of the_folder) then
            set tofolder to make folder at the_folder with properties {name:xtrafolder}
         else
            set tofolder to folder xtrafolder of the_folder
         end if
         if not (exists folder atext of the_folder) then
            set tofolder2 to make folder at the_folder with properties {name:atext}
         else
            set tofolder2 to folder atext of the_folder
         end if
         
         set label index of tofolder3 to 4
         set label index of tofolder to 4
         set label index of tofolder2 to 4
         
         try
            duplicate software_folder to tofolder
            duplicate trax_file to tofolder2
         end try
         
         set assignfolders to (every folder of the_folder whose label index is 0) --Assignment folder
         repeat with acurfolder in assignfolders
            set foldername to name of acurfolder
            --set foldername to acurfolder's name
            set fname to name of acurfolder
            set assignpathfl to the URL of acurfolder
            set assignpath to text 26 thru -1 of assignpathfl
            set afoldername to name of acurfolder
            set archname to name of the_folder
            set infotextUcode to afoldername & "   " & assignpath & return --set "\t" for tab stops.
            set infoRecord to infotextUcode as record
            set infotext to «class ktxt» of infoRecord
            set info_drop to folder "Archive Info" of DVDstuff
            set output to ((info_drop as alias) & "Archive_" & archname & ".txt")
            my write_to_file(infotext, output, true)
            
            try
               duplicate item (((foldername) as text) & ".txt") of assignstuff to tofolder2
               --move item (((foldername) as text) & ".txt") of assignstuff to tofolder
            end try
            try
               tell application "iView MediaPro"
                  set acurfolder to acurfolder as alias
                  open acurfolder
                  select front catalog
                  tell catalog 1
                     set myCount to count of media items
                     repeat with x from 1 to myCount
                        rebuild media item x
                     end repeat
                  end tell
                  set tofolder3 to tofolder3 as alias
                  save front catalog in file (((tofolder3) as text) & fname & ".ivc")
                  close front catalog
               end tell
            end try
         end repeat
         
         eject disk m
         
      end repeat
   end tell
   display dialog "iViewBuild is finished."
end timeout

on write_to_file(this_data, target_file, append_data)
   try
      set the target_file to the target_file as text
      set the open_target_file to open for access file target_file with write permission
      if append_data is false then set eof of the open_target_file to 0
      write this_data to the open_target_file starting at eof
      close access the open_target_file
      return true
   on error
      try
         close access file target_file
      end try
      return false
   end try
end write_to_file



_________________
Macintosh /Dual 2.7 GHz. Power Mac G5 /2GB RAM/ OS X (10.4.8)
Back to top
View user's profile Send private message Send e-mail
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 -> AppleScript 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