MPEG-2 Trimming Utility

I'm looking for a utility that can take MPEG-2 video (no audio) and trim it into individual clips. I had some old 8mm film transferred to MPEG and now I need to trim it so that I can use the individual clips in iMovie HD. I see lots of utilities available for the PC World, but not for the Mac (I'm a recent convert...)
Thanks in advance for the help.
Dave

MPEG Streamclip

Similar Messages

  • Macbook pro 1,1 2006 10.6.8 TRIM utility

    Hi folks
    Back again.
    So, I'm running a first gen Macbook Pro, in good health.
    I have a macpro at home and an i7 imac at home, so the heavy lifting is taken care of, I want to upgrade my macbook, to give it a couple of extra years (hopefully) for light duties as an offline edit or location preview, camera tethering laptop.
    I was on os10.4 which was strangling my apps and flash etc, just upgraded to 10.6.8 with fresh install, my core apps all up to date and working so happy there.
    I can't do anything the processor ram or gfx (all maxed at time of purchase, 2.0ghz, 2gb, 256mb) so looking at increasing performance via disks.
    I have a 100gb 7200 drive, whish is working, but as a 7 yo mechanical part, I'm keen to switch out and at the sametime upgrade.
    It's a sata 1 port, but I should still be able to improve sequential reading and writing, even if it doesn't get near potential speed of best ssds.
    I was advised to look at SSHDs, but am struggling to find stock of the Sata2 500gb/4gb 7200 version.  Seagate wouldn't commit to guaranteeing compatibility with such an old laptop, other users on here suggested that this was the only spec that would work.
    So, i'm back at SSD's, looking at Sandisk 128gb, just the basic one, sys build is 50gb approx, so want more headroom than a 64gb.
    I've read about TRIM issues, and lack of third party support within 10.6.8, (my macbook can't go any higher) but have seen some third party utilities online, so:
    1.  can anybody recommend a 128gb SsD thats worked in their early macbook
    2.  did you use a TRIM utility? was your drive supported by 10.6.8? did you use a third party? which?
    3.  slight tangent, going to install expresscard esata slot for storage expansion, probably via 2nd ssd in enclosure. Any issues?
    PLEASE PLEASE PLEASE don't say 'just buy a new mac' or 'don't waste money' it's roughly my only option, the ssds can be reused when macbook dies so not a total waste, only other cost has been £14 for new os.  Really cannot afford new macbook.

    PaulRussell,
    I can only offer an answer to your second question line: version 2.2 of Trim Enabler is its last version to run under Mac OS X 10.6.8.

  • Can't open mp4 file

    I transfered video clips from the Sony EX 3 using the Sony XDcam software. I then transfered it to another hard drive, and I'm trying to import it into my FCP program, but I can't even open up the file. QT says "The movie could not be opened: the movie contains some invalid data." Does anyone know what this means and how to fix it? Thanks.

    Lubella wrote:
    The file says mp4 next to it. Should I try converting it to mp2? How would I do that?
    The issue seems to be that the files are already MPEG-2 which QT cannot edit. If they are MPEG-2 you need to buy the QT MPEG-2 codec ($20) and then open the files in MPEG Streamclip, trim as needed , then export to DV or a high bitrate non lossy codec like Animation or a high quality lossy codec like H.264 and then use that file in Final Cut.
    There should be no need to use Sony software to export the files if they are just files, drag from the card or drive or whoever they are stored. Then try Streamclip.

  • Installing SSD on MacBook Pro

    So I'm planning to replace my original hard drive off my Early-2011 MacBook Pro with an SSD.
    I understand the whole process of replacing it, but I'm wondering on which hard drive to use.
    Will a Samsung 840 Series Pro work with it?
    Link: http://www.amazon.co.uk/Samsung-Series-256GB-Solid-State/dp/B009LI7CTY/ref=sr_1_ 2?ie=UTF8&qid=1390162797&sr=8-2&keywords=macbook+pro+ssd
    If so, it's a simple job of taking the old out and putting the new one in, then using the OS X install disk?

    I know I am late to the party on this subject but... I just recently replaced the hard drive on my Late 2011 17" Macbook Pro. I started researching the process I read all kinds of posts with links to other information on the TRIM utility and KAST signing and everyone talking about how much trouble they were having trying to put an SSD in their Macbook Pro. I almost took the drive back to the store but I decided to talk to one of the Apple geniuses first. I could not believe what he was telling was correct because it was so simple. I pulled out the 750 GB hard drive that came with my Macbook Pro and installed a Samsung EVO 850 128 GB SSD. I booted off the network (press "C") and it went out to Apple and downloaded the OS that came with the Mac afterwards I upgraded to Yosemite. That was all I had to do. No worries about TRIM or KAST.
    Once again I am convinced Apple makes the best products on the market. I doubt you can do this simply with a PC and Windows.

  • AC3 Audio and Quicktime 7.6 Problem

    I was wondering if anyone else is having a problem with opening an audio file with the .ac3 extension in the updated Quicktime 7.6?
    What I have been doing, for a couple of years now, is that I capture a TV program from my DVR using the firewire port. Once the file is loaded on my Mac, I then open MPEG Streamclip, trim out the commercials, Export to Quicktime using H264 and 2 channel AAC audio, after the export is done, I would then do a Demux to AC3 to get a separate audio only file containing the 5.1 surround sound.
    I would open the .ac3 audio only file, open the .mov video file (both in Quicktime). I would then copy the 5.1 audio track from the .ac3 file, Go to the .mov file, perform Edit/Add to Movie. This way I would have 2 audio tracks, AAC a 2 channel track and AC3 a 6 channel track.
    But now with Quicktime 7.6, I cannot open the .ac3 file at all, I get "The file is not a movie file." error message with no error code.
    Any suggestions?
    Thanks,
    Bill

    POSSIBLE SOLUTION
    I think I have discovered a way to workaround the AC3 5.1 sound problem.
    I found an old 20GB drive and installed Tiger 10.4 onto the drive. I then downloaded the "MacOSXUpdCombo10.4.11PPC.dmg" file and updated the system to Tiger 10.4.11. I performed all of the updates (System Security updates and the Java updates) through Software Update except for iTunes and QuickTime.
    I then downloaded the "QuickTime755_Tiger.dmg" file from Apple and updated to QuickTime 7.5.5
    DO NOT UPGRADE TO 7.6
    I then opened the TV show in QuickTime 7.5.5, I extracted the audio file from the program and saved as a separate audio file (it saves as a .mov file).
    I opened this audio file in QuickTime 7.5.5 and then exported the audio
    selecting Export Movie to QuickTime movie,
    clicked on the options button,
    the sound box should already be checked,
    clicked on the settings button,
    under the Format drop down I clicked on AAC,
    Channels: I clicked on 5.1,
    then Rate:48.000,
    checked on Show Advanced Settings,
    Quality: Normal,
    Encoding Strategy: Constant Bit Rate,
    Target Bit Rate: 384
    (used MediaInfo Mac to gate this information),
    clicked OK,
    Clicked OK,
    then named the file, saved it and then waited for audio to be converted from AC3 5.1 to ACC 5.1.
    If you now open up this file in QuickTime 7.5.5 it is an ACC format with 5.1 and plays fine.
    I then restarted to my regular drive with QuickTime 7.6 loaded and it plays the audio file without any problems.
    I'm sure that there must be a way to repackage the AC3 audio file in an AAC container that will work better and faster, but for now this seems to work, so I am going to try some other shows that I have.
    Let me know if this works for others.
    Bill
    Message was edited by: Boliver
    Message was edited by: Boliver

  • Session expired within 10-20 seconds while working on Visual Administartor.

    session expired within 10-20 seconds while working on Visual Administartor.
    Details: In VA, each dispatcher and Server process have four components:
    kernel, Interfaces, Libraries and Services.
    While working on Kernel in VA of dispatcher or Server, I'm getting 'session expired' after every 10-20 seconds.
    I'm not getting the same 'session expired' problem while working on interfaces, libraries or services.
    After 2-3 minute of wait, again i'm able to work on kernel  but again after 10-20 seconds, session get expired.
    Pls suggets to resolve this problem. We are on SP level 20.
    r1n0v3:xpdadm 5> ./go
    java version "1.4.2.10"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2.10-060112-14:28)
    Java HotSpot(TM) Server VM (build 1.4.2 1.4.2.10-060112-19:42-IA64N IA64, mixed mode)
    java.lang.ClassCastException
            at com.sap.engine.services.adminadapter.impl.Util.trim(Util.java:167)
            at com.sap.engine.services.adminadapter.impl.Util.compareProperties(Util.java:142)
            at com.sap.engine.services.adminadapter.gui.node.ManagerNodeView.deselectSingleManagerNode(ManagerNodeView.java:86)
            at com.sap.engine.services.adminadapter.gui.node.ManagerNodeView.deselectNode(ManagerNodeView.java:79)
            at com.sap.engine.services.adminadapter.gui.AdminManager.deselectManagerNode(AdminManager.java:266)
            at com.sap.engine.services.adminadapter.gui.AdminManager.deselectNode(AdminManager.java:146)
            at com.sap.engine.services.adminadapter.gui.AdminManager.valueChanged(AdminManager.java:96)
            at javax.swing.JTree.fireValueChanged(JTree.java:2392)
            at javax.swing.JTree$TreeSelectionRedirector.valueChanged(JTree.java:2763)
            at javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(DefaultTreeSelectionModel.java:629)
            at javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(DefaultTreeSelectionModel.java:1076)
            at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPaths(DefaultTreeSelectionModel.java:287)
            at javax.swing.tree.DefaultTreeSelectionModel.setSelectionPath(DefaultTreeSelectionModel.java:170)
            at javax.swing.JTree.setSelectionPath(JTree.java:1168)
            at javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(BasicTreeUI.java:2215)
            at javax.swing.plaf.basic.BasicTreeUI$MouseHandler.handleSelection(BasicTreeUI.java:2863)
            at javax.swing.plaf.basic.BasicTreeUI$MouseHandler.mousePressed(BasicTreeUI.java:2824)
            at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:222)
            at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
            at java.awt.AWTEventMulticaster.mousePressed(AWTEventMulticaster.java:221)
            at java.awt.Component.processMouseEvent(Component.java:5161)
            at java.awt.Component.processEvent(Component.java:4961)
            at java.awt.Container.processEvent(Container.java:1569)
            at java.awt.Component.dispatchEventImpl(Component.java:3679)
            at java.awt.Container.dispatchEventImpl(Container.java:1627)
            at java.awt.Component.dispatchEvent(Component.java:3541)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3195)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
            at java.awt.Container.dispatchEventImpl(Container.java:1613)
            at java.awt.Window.dispatchEventImpl(Window.java:1606)
            at java.awt.Component.dispatchEvent(Component.java:3541)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:480)
            at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    Exception occurred during event dispatching:
    Thanks in advance
    Amar

    Update on my problem of VA:
    'Session expired' session only happened when i'm clicking the 'cluster manager' of Kernel or server instances.
    For all managers in kernel, i'm not getting this problem.
    I have seen some following properties in Cluster Manager. Not sure, these are the cause of problems:
    Key                                                                              value
    ___MS_PROP_GET_CLIENT_STATISTIC                        -
    ___MS_PROP_GET_HARDWARE_ID                            M0565709169
    ___MS_PROP_GET_INFO                                             -
    ___MS_PROP_GET_PARAMS                                      -
    ___MS_PROP_GET_SERVICE_INFO                            -
    ___MS_PROP_GET_STATISTIC                                    -
    ___MS_PROP_GET_SYSTEM_ID                                 XPD
    cluster.name                                                               -
    Pls suggets if your dispatcher or server kernel have the above mentioned properties value and what would be the impacty if i remove the properties that have no value assigned.
    Thanks once again in advance.
    Amar

  • Importing A Single Chapter Of A Movie Into iMovie?

    Hi,
    I've got a movie that has chapters encoded in it in my iTunes library. I'd like to import a single chapter of the movie into iMovie (or possibly GarageBand?) to work with. I'd rather not import the entire movie and then delete everything except the one chapter as that would take ages and lots of space. Is it possible to import just a single chapter of the movie, and, if so, how can this be done? Also what is the best way to go about this (iMovie, Garageband, etc.?). Thanks!
    Kate

    Is it possible to import just a single chapter of the movie, and, if so, how can this be done?
    No. The whole movie would have to be imported before you could trim it in either iMovie or GarageBand. You could, however, oen the file in either QT Pro or MPEG Streamclip, trim the file to the segment you want, save it to your hard drive, and the easily import just the saved segment to either iMovie or GarageBand.

  • Apple -clueless about its own software !! can anybody give me a straight answer to this ?

    APPLE - clueless about its own software !!! Can anybody please give me a straight answer to this question - how do I zero out my Apple SSD ??
    I have spoken to Apple engineers in-store and via phone support and nobody seems to know how to do it, in fact the guys at the retail store were not even aware that the option for secure erase has been disabled for macs with SSD running Lion. Now im aware that some people will say this is to protect the lifetime of the SSD, but this is irrelevant as Apple SSD's running Lion has TRIM utility. Furthermore to save people's time you cannot do it by externalling booting or by holding down C or CMD+R !
    So, has anyone got a simple method for this, it cant be impossible !
    Please help

    mj25 wrote:
    APPLE - clueless about its own software !!! Can anybody please give me a straight answer to this question - how do I zero out my Apple SSD ??
    I have spoken to Apple engineers in-store and via phone support and nobody seems to know how to do it, in fact the guys at the retail store were not even aware that the option for secure erase has been disabled for macs with SSD running Lion. Now im aware that some people will say this is to protect the lifetime of the SSD, but this is irrelevant as Apple SSD's running Lion has TRIM utility. Furthermore to save people's time you cannot do it by externalling booting or by holding down C or CMD+R !
    So, has anyone got a simple method for this, it cant be impossible !
    Please help
    then if not coming up on google, apple or asking here, then is maybe impossible to do genius. you politeness get you lot of help here.

  • Accecc violation

    Hi,
    currently, I try to write my own publish service. Unfortunately, because LR does not support any kind of "sync" (there are already several 1000 of photos uploaded) I'm trying to write such a sync service. In principle it works fine. How does it work: In the publishing manager is a button sync. when pressing a connection to my server is beeing established and all photo-filenames (folderwise) will be returned. Now LR will try to find these files in the catalog. If found, then the photo will be added to the pubCollection.
    So far so good - and in principle it works. BUT: when the sync process is finished and I close the publishing manager, LR crashes with an access vialoation (VISTA all updates). Beside of this crash behaviour it doesn't happen in any case. Sometimes LR keeps alive and sometimes it crashes. So I assume it is a LR3 problem, or did I something wrong???
    Please see below my code fragments:
    function publishServiceExtention.getImages( publishService )
    local catalog = import 'LrApplication'.activeCatalog()
    LrTasks.startAsyncTask( function()
      local collections = publishService:getChildCollections()
      catalog:withWriteAccessDo('sync', function()
       for i, collection in pairs (collections) do
        collection:removeAllPhotos()
        folder = trim(string.match(collection:getName(), "%d%d%d%d.%d%d.%d%d."))
        local images = MyAPI.getImagesFromFolder(folder)
        for i, image in pairs ( images ) do
         image = trim(Utils.getFilenameNoExt(image))
         photos = catalog:findPhotos {
          searchDesc = {
            criteria = 'filename',
            operation = 'any',
            value = image,
         for k, photo in ipairs( photos ) do
          info("add to collection: " .. photo:getFormattedMetadata( 'fileName' ))    
          photoinfo = MyAPI.getImageInfo(image)
          collection:addPhotoByRemoteId( photo, photoinfo['id'], photoinfo['url'], true )
         end
        end
       end
      end)
    end)
    end
    Does anybody has an idea whether it is a problem of my code and how to fix it or is it a problem of LR.
    Thanks,
    Lars

    Lars,
    Thank you - its entirely possible that this  has something to do with the mysterious crashing my plugins have been  experiencing when operating for extended periods.
    I  will check and report...
    PS - Worthy of a double-posting, me-thinks!
    Rob

  • Converting mpeg-4 files to format that can be utilized by Power Point 2003

    I have created my first Power Point 2003 Presentation, and am trying to add uninterruped music, a post copyright version of George Solti's Beethoven's 5th. When I imported the tracks from the CD, they are MPEG-4. Power Point 2003 can't read the file when I try to open it under "Movie and Sound>". I returned to iTunes and tried converting it to an AAC file, but the software doesn't recognize that file either. What file extension is recognized by Power Point 2003 and does iTunes have a conversion tool?

    You may find these links helpful:
    http://msdn.microsoft.com/en-us/library/aa168133.aspx
    http://en.allexperts.com/q/Microsoft-PowerPoint-1035/PowerPoint-2003-Audio.htm
    In summary, use either WAV, AIFF, or MP3 format when you import from the CD.

  • How do I copy a DVD to my mac, and then trim it to upload clips to YouTube? They are not copyright protected DVDs.

    I am trying to take a DVD (non copyrighted) and be able to add 10 min clips of it to a YouTube Channel. How do I copy that DVD to my Mac and trim the clips I want to upload. Thank you.

    Copy the DVD to your desktop, then:
    You need to convert the VOB files in the TS-Folder of the DVD back to DV which iMovie is designed to handle. For that you need mpegStreamclip:
    http://www.squared5.com/svideo/mpeg-streamclip-mac.html
    which is free, but you must also have the  Apple mpeg2 plugin :
    http://store.apple.com/us/product/D2187Z/A/quicktime-mpeg-2-playback-component-f or-mac-os-x
    (unless you are running Lion in which case see below))
    which is a mere $20.
    Another possibility is to use DVDxDV:
    http://www.dvdxdv.com/NewFolderLookSite/Products/DVDxDV.overview.htm
    which costs $25.
    For the benefit of others who may read this thread:
    Obviously the foregoing only applies to DVDs you have made yourself, or other home-made DVDs that have been given to you. It will NOT work on copy-protected commercial DVDs, which in any case would be illegal.
    And from the TOU of these forums:
    Keep within the Law
    No material may be submitted that is intended to promote or commit an illegal act.
    Do not submit software or descriptions of processes that break or otherwise ‘work around’ digital rights management software or hardware. This includes conversations about ‘ripping’ DVDs or working around FairPlay software used on the iTunes Store.
    If you are running Lion or later:
    From the MPEG Streamclip homepage
    The installer of the MPEG-2 Playback Component may refuse to install the component in Lion. Apple states the component is unnecessary in Lion onwards, however MPEG Streamclip still needs it. See this:
    http://support.apple.com/kb/HT3381
    To install the component in Lion, please download MPEG Streamclip 1.9.3b7 beta above; inside the disk image you will find the Utility MPEG2 Component Lion: use it to install the MPEG-2 Playback Component in Lion. The original installer's disk image (QuickTimeMPEG2.dmg) is required.
    The current versions of MPEG Streamclip cannot take advantage of the built-in MPEG-2 functionality of Lion. For MPEG-2 files you still need to install the QuickTime MPEG-2 Playback Component, which is not preinstalled in Lion. (The same applies to Mountain Lion and Mavericks even though they have it preinstalled.) You don't have to install QuickTime 7.

  • Trim (SSD) in 10.6.7 - ? and what happens to the SSD if not?

    Am I up to date in assuming that there is no way to know when 10.6.7 will be released or whether it'll allow for using the trim function on SSDs (for all, not bizarrely just for new MacBooks)? And, second question, if 10.7 will indeed provide this function for all who's hardware permits it (like all MacPro, I guess)—what will happen to an SSD when in use for, say, 4 months without trimming? Will it degrade irreversibly, or will the use of that trim function then set it to the state it would have been in when trimming for 4 months constantly?
    thanks a lot

    There are a number of users, and threads, about using SSDs.
    TRIM is an OS level feature.
    OWC switched to Sand Force and the SF controllers have their own background garbage collection. I haven't seen much about the newest SF-2000s yet.
    Allow for over provisioning (when I formatted a couple SSDs, Disk Utility seem to 'map' 5GB or 10%, not sure which, so maybe it sets aside some). I just would get a drive that has extra space.
    You'll find Wikipedia has excellent articles on SSD, TRIM, write amplification and more. And Diskeeper blog has an article on the inner workings of SSD.
    http://en.wikipedia.org/wiki/Write_amplification
    No it won't be irreversible if there is some. Just keep a backup clone though. And keep SSD to just OS and apps, or if using for scratch, but use a standard mechanical drive for all your data and other purposes.
    http://macperformanceguide.com/Storage-SSD-Reconditioning.html
    There is a whole section devoted to SSD (70% down the page)
    http://macperformanceguide.com/index_topics.html
    The rest deals in speculation. Old axiom, we'll know when it gets there, not until.

  • Page Exporter Utility (PEU) 5 Script

    I love this script, It really has potential to shave valuable time off of our production (exporting Hundreds of pages manually to single files is tedious and time consuming). The problem I'm having is I'm hesitant to us it because it dosn't show warnings when there is a missing link or font. There's also no warning when it overwrites a file. My question is dose anyone know how to unsuppress the warnings? I've looked over the script and don't see anything that is actively suppressing them.
    Thanks
    Dan
    // PageExporterUtility5.0.js
    // An InDesign CS JavaScript
    // 08 NOV 2007
    // Copyright (C) 2007  Scott Zanelli. Lonelytree Software. (www.lonelytreesw.com)
    // Coming to you from Quincy, MA, USA
    // This program is free software; you can redistribute it and/or
    // modify it under the terms of the GNU General Public License
    // as published by the Free Software Foundation; either version 2
    // of the License, or (at your option) any later version.
    // This program is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU General Public License for more details.
    // You should have received a copy of the GNU General Public License
    // along with this program; if not, write to the Free Software
    // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    var peuINFO = new Array();
    peuINFO["csVersion"] = parseInt(app.version);
    // Save the old interaction level
    if(peuINFO.csVersion == 3) { //CS1
        peuINFO["oldInteractionPref"] = app.userInteractionLevel;
        app.userInteractionLevel = UserInteractionLevels.interactWithAll;
    else { //CS2+
        peuINFO["oldInteractionPref"] = app.scriptPreferences.userInteractionLevel;
        app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
    // See if a document is open. If not, exit
    if((peuINFO["numDocsToExport"] = app.documents.length) == 0){
        byeBye("Please open a document and try again.",true);
    // Global Variable Initializations
    var VERSION_NAME = "Page Exporter Utility 5.0"
    var pseudoSingleton = 0;
    var progCurrentPage = 0;// Used for progress bar
    var progTotalPages = 0; // Used for progress bar
    var commonBatchINFO = getNewTempENTRY(); // Used if "Set For All Batch Jobs" is selected
    commonBatchINFO["infoLoaded"] = false;
    peuInit(); // Initialize commonly needed info
    // Store information needed for batch processing (valid for single also)
    var printINFO = new Array();
    // Get all needed info by looping for each document being exported
    for(currentDoc = 0; currentDoc < peuINFO.numDocsToExport; currentDoc++) {
        // Get name of document and set it as the base name
        // minus the extention if it exists
        var tempENTRY = getNewTempENTRY(); // "Struct" for current document info
        tempENTRY.theDoc = app.documents[currentDoc]
        tempENTRY.singlePage = (tempENTRY.theDoc.documentPreferences.pagesPerDocument==1)?true:false;
        tempENTRY.getOut = true;
        var baseName = (tempENTRY.theDoc.name.split(".ind"))[0];
        // Display the dialog box and loop for correct info
        if((!commonBatchINFO.infoLoaded && peuINFO.batchSameForAll) || (!peuINFO.batchSameForAll) ){// get all info
            do{
                tempENTRY.getOut = true; // For handling input errors
                var mainDialog = createMainDialog(tempENTRY.theDoc.name, currentDoc+1, peuINFO.numDocsToExport);
                // Exit if cancel button chosen
                if(!mainDialog.show() ){
                    mainDialog.destroy();
                    byeBye("Exporting has canceled by user.",peuINFO.sayCancel);
                if(formatTypeRB.selectedButton == 4 - peuINFO.adjustForNoPS){
                    changePrefs();
                    tempENTRY.getOut = false;
                    continue;
                // Read info from dialog items and keep as defaults and place in tempENTRY
                peuINFO.defaultDir = outputDirs.selectedIndex;
                // The index of the selected directory is the same as the
                // index in the array of directories.
                tempENTRY.outDir = peuINFO.dirListArray[peuINFO.defaultDir];
                // Type of renaming to do
                tempENTRY.nameConvType = namingConvention.selectedButton
                // The base name to add page info to
                tempENTRY.baseName = removeColons(removeSpaces(newBaseName.editContents) );
                // The start [and end] page numbers
                var startEndPgs = startEndPgs.editContents;
                // Wether to do spreads or not
                peuINFO.doSpreadsON = (doSpreads.checkedState)?1:0;
                tempENTRY.doSpreadsON = peuINFO.doSpreadsON;
                // Wether to send entire file as one document
                peuINFO.doOneFile = (oneFile.checkedState)?1:0;
                tempENTRY.doOneFile = peuINFO.doOneFile;
                // Export format type
                tempENTRY.formatType = formatTypeRB.selectedButton + peuINFO.adjustForNoPS;
                // Set persistence during warnings
                peuINFO.editStartEndPgs = startEndPgs;
                baseName = tempENTRY.baseName;
                peuINFO.exportDefaultType = tempENTRY.formatType;
                // Determine if page replacement token exists when the page token option is used
                if(peuINFO.pageNamePlacement == 2){
                    var temp = tempENTRY.baseName.indexOf("<#>");
                    if(temp == -1){//Token isn't there
                        alert("There is no page item token (<#>) in the base name. Please add one or change the page naming placement preference.");
                        tempENlert.getOut = false;
                        pseudoSingleton--; // Allow prefs to be accessed again, but just once
                        continue;
                    else
                        pseudoSingleton++;
                else // Try to remove any <#>s as a precaution
                    tempENTRY.baseName = tempENTRY.baseName.replace(/<#>/g,"");   
                // Layer Versioning & Batch options
                if(currentDoc < 1){
                    peuINFO.layersON = (doLayers.checkedState)?1:0;
                    if(peuINFO.numDocsToExport > 1){
                        peuINFO.batchSameForAll = (commonBatch.checkedState)?1:0;
                        peuINFO.batchON = (doBatch.checkedState)?1:0;
                        if(!peuINFO.batchON)
                            peuINFO.numDocsToExport = 1;
                //Check if spreads chosen with 'Add ".L"' option as this isn't supported.
                if(peuINFO.doSpreadsON && tempENTRY.nameConvType == 1){
                    alert ("Spreads cannot be used with the 'Add \".L\"' option.\nThis combination is not supported. (1.1)");
                    tempENTRY.nameConvType = 0;
                    tempENTRY.getOut = false;
                    continue;
                else if(peuINFO.doSpreadsON && tempENTRY.nameConvType == 4){
                    alert ("Spreads cannot be used with the 'Numeric Override' option.\nThis combination is not supported. (1.2)");
                    tempENTRY.nameConvType = 0;
                    tempENTRY.getOut = false;
                    continue;
                // Check if "Send Entire File At Once" is selected with JPG or EPS
                if(peuINFO.doOneFile && tempENTRY.formatType > 1 ){
                    alert ("The 'Send Entire File At Once' option can only be used with PostScript or PDF formats. (1.3)");
                    tempENTRY.getOut = false;
                    continue;
                // Check if: batch printing and using the "Same for all jobs options" and a page range other than "All" was used
                if(peuINFO.doBatch && peuINFO.batchSameForAll && startEndPgs != "All"){
                    alert ("The 'Set For All Batch Jobs' option can only be used with a Page Range of 'All'. Page Range has been reset to 'All'. (1.4)");
                    startEndPgs = "All";
                // Create page info, skip if doing entire file as one
                var tempPageCount = 0;
                if(tempENTRY.doOneFile)
                    tempPageCount = 1;
                else{
                    // Get names of all the pages. Needed when pages are named using sectioning
                    tempENTRY = recordPgNames(tempENTRY);
                    // Check Page Validity and get Page counts of entered section(s)
                    var temp = checkPages(tempENTRY, startEndPgs);
                    tempENTRY = temp[0];
                    tempPageCount = temp[1];
                    temp = null; // Free it up
            } while(!tempENTRY.getOut);
            // Remove dialog from memory
            mainDialog.destroy();
            // Determine if tag will fit correctly
            tempENTRY.useTag = usePgInfoTag(tempENTRY.theDoc.viewPreferences.horizontalMeasurementUnits,tempENTRY.theDoc.documentPreferences.pageWidth);
                // Get the format info for this document
            switch(tempENTRY.formatType){
                case 0://PS
                tempENTRY.psINFO = getPSoptions(tempENTRY.theDoc.name.split(".ind")[0]);
                break;
                case 1://PDF
                tempENTRY.pdfPRESET = getPDFoptions(tempENTRY);
                break;
                case 2: // EPS Formatting
                tempENTRY.epsINFO = getEPSoptions(tempENTRY.theDoc.name.split(".ind")[0]);
                peuINFO.origSpread = app.epsExportPreferences.epsSpreads;// Used to reset to original state when done
                app.epsExportPreferences.epsSpreads = peuINFO.doSpreadsON;
                break;
                case 3: // JPEG Formatting
                tempENTRY.jpegINFO = getJPEGoptions(tempENTRY.theDoc.name.split(".ind")[0]);
                break;
            // If Specific Directory was chosen for the output directory, get it now
            if(peuINFO.defaultDir == 0){
                tempENTRY.outDir = getDirectory("Please select the output directory:",peuINFO.startingDirectory);
                if(tempENTRY.outDir != null)
                    tempENTRY.outDir += "/";
                else
                    byeBye("Exporting has been canceled by user.", peuINFO.sayCancel);
            // Set the common elements for all batch jobs if it was selected
            if(!commonBatchINFO.infoLoaded && peuINFO.batchSameForAll){
                commonBatchINFO.infoLoaded = true;
                commonBatchINFO.pageNamePlacement = tempENTRY.pageNamePlacement;
                commonBatchINFO.outDir = tempENTRY.outDir;
                commonBatchINFO.nameConvType = tempENTRY.nameConvType
                commonBatchINFO.doSpreadsON = tempENTRY.doSpreadsON;
                commonBatchINFO.doOneFile = tempENTRY.doOneFile;
                commonBatchINFO.formatType = tempENTRY.formatType;
                commonBatchINFO.psINFO = tempENTRY.psINFO;
                commonBatchINFO.pdfPRESET = tempENTRY.pdfPRESET
                commonBatchINFO.epsINFO = tempENTRY.epsINFO
                commonBatchINFO.jpegINFO = tempENTRY.jpegINFO;
        } // End each/first of batch
        else{ // Get the base name for other batch jobs
            do{
                tempENTRY.getOut = true;
                var nameDialog = app.dialogs.add({name:(VERSION_NAME + ": Base Name for \"" + tempENTRY.theDoc.name + "\"" + ((peuINFO.numDocsToExport==1)?"":" (" + (currentDoc+1) + " of " + peuINFO.numDocsToExport + " documents)") ), canCancel:true} );
                with (nameDialog){
                    with (dialogColumns.add() ){
                        with(dialogRows.add() ){
                        staticTexts.add({staticLabel:"Enter the Base Name for \"" + tempENTRY.theDoc.name + "\""} );
                        var newBaseName = textEditboxes.add({editContents:baseName, minWidth:135} );
                        with(dialogRows.add() )
                            staticTexts.add({staticLabel:"", minWidth:400} );
                if(!nameDialog.show() ){
                    nameDialog.destroy();
                    byeBye("User canceled export.",peuINFO.sayCancel);
                else{
                    tempENTRY.baseName = removeColons(removeSpaces(newBaseName.editContents) );
                    nameDialog.destroy();
                    // Determine if page replacement token exists when the page token option is used
                    if(peuINFO.pageNamePlacement == 2){
                        var temp = tempENTRY.baseName.indexOf("<#>");
                        if(temp == -1){//Token isn't there
                            alert("There is no page item token (<#>) in the base name. Please add one or click cancel in the next dialog box.");
                            tempENTRY.getOut = false;
                    else // Try to remove any <#>s as a precaution
                        tempENTRY.baseName = tempENTRY.baseName.replace(/<#>/g,"");   
            }while(!tempENTRY.getOut);
            // Get names of all the pages. Needed when pages are named using sectioning
            tempENTRY = recordPgNames(tempENTRY);
            // Set pgStart and pgEnd, forcing "All" pages to output
            tempENTRY = (checkPages(tempENTRY, "All"))[0];
            // The page count is all pages due to common batching
            tempPageCount = tempENTRY.theDoc.pages.length;
            // This info is common, get it from commonBatchINFO:
            tempENTRY.pageNamePlacement = commonBatchINFO.pageNamePlacement;
            tempENTRY.outDir = commonBatchINFO.outDir;
            tempENTRY.nameConvType = commonBatchINFO.nameConvType
            tempENTRY.doSpreadsON = commonBatchINFO.doSpreadsON;
            tempENTRY.doOneFile = commonBatchINFO.doOneFile;
            tempENTRY.formatType = commonBatchINFO.formatType;
            tempENTRY.psINFO = commonBatchINFO.psINFO;
            tempENTRY.pdfPRESET = commonBatchINFO.pdfPRESET
            tempENTRY.epsINFO = commonBatchINFO.epsINFO
            tempENTRY.jpegINFO = commonBatchINFO.jpegINFO;
        // Get any layering info
        if(peuINFO.layersON){
            tempENTRY.layerINFO = layerManager(tempENTRY.theDoc);
            if (tempENTRY.layerINFO == null) // Only one layer, turn it off for this doc
                tempENTRY.layersON = false;
            else
                tempENTRY.layersON = true;
        // Sum up pages for the grand total for use in progress bar
        var temp = 1;
        if(peuINFO.doProgressBar && tempENTRY.layersON){
            // Figure tally for progress bar to include versions
            for(i=0;i < tempENTRY.layerINFO.verControls.length; i++)
                if (tempENTRY.layerINFO.verControls[i] == 1)
                    temp++;
            if(!peuINFO.baseLaersAsVersion)
                temp--;
        progTotalPages += (tempPageCount*temp);
        // All info for this doc is finally gathered, add it to the main printINFO array
        printINFO.push(tempENTRY);
        // Only one chance to change prefs: trigger singleton
        pseudoSingleton++;
    }// end of main for loop
    savePrefs(); // Record any changes
    // Initiallize progress bar if available
    if(peuINFO.doProgressBar)
        app.createProgressBar("Exporting Pages...", 0, progTotalPages, true);
    // Export by looping through all open documents if using batch option, otherwise just the front document is exported
    for(currentDoc = 0; currentDoc < printINFO.length; currentDoc++){
        var currentINFO = printINFO[currentDoc];
        // Set message in progress bar if available
        if(peuINFO.doProgressBar){
                var progCancel = app.setProgress(currentINFO.theDoc.name);
                if(progCancel)
                    byeBye("User canceled export.",peuINFO.sayCancel);
        // Set format options here so it's done just once per document
        setExportOption(currentINFO);
        // "Do one file" or PS/PDF with one page:
        if (currentINFO.doOneFile || currentINFO.singlePage){
            // Remove page token if it was entered and this name positioning option is set
            currentINFO.baseName = currentINFO.baseName.replace(/<#>/g,"");
            if(currentINFO.layersON){
                var theLayers = currentINFO.theDoc.layers;
                var baseControls = currentINFO.layerINFO.baseControls;
                var versionControls = currentINFO.layerINFO.verControls;
                var lastVersion = -1;
                // Loop for versioning
                 for(v = 0; v < versionControls.length; v++){
                    if(!versionControls[v])
                        continue;
                    if(lastVersion != -1)// Turn the last layer back off
                        theLayers[lastVersion].visible = false;
                    lastVersion = v;
                    theLayers[v].visible = true;
                    currentINFO.outfileName = addPartToName(currentINFO.baseName, theLayers[v].name, peuINFO.layerBeforeON)
                    // Export this version
                    exportPage(currentINFO, PageRange.allPages);
                    // Advance progress bar if available
                    if(peuINFO.doProgressBar)
                        advanceBar();
                // If Base layer/s is/are to be output as a version, do it now
                if(peuINFO.baseLaersAsVersion){
                    lastVersion = -1;
                    // Turn off all versioning layers
                    for(v = 0; v < currentINFO.layerINFO.baseControls.length; v++){
                        if(currentINFO.layerINFO.baseControls[v])// its a base layer, keep track of last base version layer number
                            lastVersion = v;
                        else
                            theLayers[v].visible = false;
                    if (!lastVersion == -1){// Only export if there was a base version
                        currentINFO.outfileName = addPartToName(currentINFO.baseName, theLayers[lastVersion].name, peuINFO.layerBeforeON);
                        // Export the base layer(s)
                        exportPage(currentINFO, PageRange.allPages);
                        // Advance progress bar if available
                        if(peuINFO.doProgressBar)
                            advanceBar();
            else{ // No layer versioning, just export
                currentINFO.outfileName = currentINFO.baseName;
                // Export the base layer(s)
                exportPage(currentINFO, PageRange.allPages);
                // Advance progress bar if available
                if(peuINFO.doProgressBar)
                    advanceBar();
            if(!peuINFO.batchON)
                byeBye("Done exporting as a single file.",true);
        else{ // Do single pages/spreads
            if (!currentINFO.hasNonContig)
                // Pages are contiguous, can just export
                outputPages(currentINFO.pgStart, currentINFO.pgEnd, currentINFO);
            else{ // Export non-contiguous
                // Loop through array of page sections
                for (ii = 0; ii < currentINFO.nonContigPgs.length; ii++){
                    temp = currentINFO.nonContigPgs[ii];
                    // Here we handle the start/end pages for any non-contig that has "-"
                    if (temp.indexOf("-") != -1){
                        temp2 = temp.split("-");
                        outputPages(temp2[0],temp2[1], currentINFO);
                    else // The non-contiguous page is a single page
                        outputPages(temp, temp, currentINFO);
        // Set the spread settings back to what it was originally
        try{
            switch (currentINFO.formatType){
                case 0: // PostScript Formatting
                    theDoc.printPreferences.printSpreads = peuINFO.origSpread;
                    break;
                case 1: // PDF Formatting
                    currentINFO.pdfPRESET.exportReaderSpreads = peuINFO.origSpread;
                    break;
                case 2: // EPS Formatting
                    app.epsExportPreferences.epsSpreads = peuINFO.origSpread;
                    break;
                case 3: // JPEG Formatting
                    app.jpegExportPreferences.exportingSpread = peuINFO.origSpread;
                    break;
        catch(e){/*Just ignore it*/}
    byeBye("The requested pages are done being exported.",true); // Last line of script execution
    /*         Operational Functions           */
    * Handle exporting
    function outputPages(pgStart, pgEnd, currentINFO){
        var pgRange;
        var layerName = "";
        var numVersions;
        var currentPage;
        var lastVersion = -1;
        var numericallyLastPage;
        if (currentINFO.layersON){
            var theLayers = currentINFO.theDoc.layers;
            var baseControls = currentINFO.layerINFO.baseControls;
            var versionControls = currentINFO.layerINFO.verControls;
            numVersions = versionControls.length;
            // Compensate for base layers as a version
            if(peuINFO.baseLaersAsVersion)
                numVersions++;
        else
            numVersions = 1;
        for (v = 0; v < numVersions; v++){
            if(currentINFO.layersON){
                if(v == (numVersions - 1) && peuINFO.baseLaersAsVersion){
                    var currentLayer = -1;
                    // Base layer(s) are to be output as a version
                    // Turn off all versioning layers
                    for(slbm = 0; slbm < baseControls.length; slbm++){
                        if(baseControls[slbm])// its a base layer, use its name for page name
                            currentLayer = slbm;
                        else
                            theLayers[slbm].visible = false;
                    // Check if there was no base layer at all
                    if (currentLayer == -1)
                        layerName = "**NO_BASE**"
                    else
                        layerName = theLayers[currentLayer].name;
                else{
                    if(!versionControls[v])
                        continue;
                    if(lastVersion != -1)// Turn the last layer back off
                        theLayers[lastVersion].visible = false;
                    lastVersion = v;
                    theLayers[v].visible = true;
                    layerName = theLayers[v].name;
            if (currentINFO.nameConvType == 4){
                currentPage = pgStart;
                numericallyLastPage = pgEnd;
            else if (currentINFO.doSpreadsON){
                currentPage = pgStart - 1;
                numericallyLastPage = pgEnd;
            else {
                currentPage = getPageOffset(pgStart, currentINFO.pageNameArray , currentINFO.pageRangeArray);
                numericallyLastPage = getPageOffset(pgEnd, currentINFO.pageNameArray, currentINFO.pageRangeArray);
            if(layerName != "**NO_BASE**"){
                do{
                    currentINFO.outfileName = getPageName(currentPage, layerName, currentINFO);
                    if (currentINFO.doSpreadsON){
                        pgRange = currentINFO.pageRangeArray[getPageOffset(currentINFO.theDoc.spreads[currentPage].pages[0].name, currentINFO.pageNameArray, currentINFO.pageRangeArray)];
                    else if (currentINFO.nameConvType == 4)
                        pgRange = currentINFO.pageRangeArray[currentPage-1];
                    else
                        pgRange = currentINFO.pageRangeArray[currentPage];
                    // Do the actual export:
                    exportPage(currentINFO, pgRange);
                    // Update progress bar if available
                    if(peuINFO.doProgressBar)
                        advanceBar();
                    currentPage++;
                } while(currentPage <= numericallyLastPage);
    * Export the page
    function exportPage(currentINFO, pgRange){
        var outFile = currentINFO.outDir + currentINFO.outfileName;
        switch (currentINFO.formatType){
            case 0: // PostScript Formatting
                with(currentINFO.theDoc.printPreferences){
                    printFile = new File(outFile + ((currentINFO.psINFO.ext)?".ps":""));
                    pageRange = pgRange;
                // Needed to get around blank pages using separations
                try{
                    currentINFO.theDoc.print(false);
                catch(e){/*Just skip it*/}
                break;
            case 1: // PDF Formatting
                app.pdfExportPreferences.pageRange = pgRange;
                currentINFO.theDoc.exportFile(ExportFormat.pdfType, (new File(outFile + ".pdf")), false, currentINFO.pdfPRESET);
                break;
            case 2: // EPS Formatting
                app.epsExportPreferences.pageRange = pgRange;
                currentINFO.theDoc.exportFile(ExportFormat.epsType, (new File(outFile + ".eps")), false);
                break;
            case 3: // JPEG Formatting
                if(pgRange == PageRange.allPages){
                    app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportAll;
                else{
                    app.jpegExportPreferences.jpegExportRange = ExportRangeOrAllPages.exportRange;
                    app.jpegExportPreferences.pageString = pgRange;
                currentINFO.theDoc.exportFile(ExportFormat.jpg, (new File(outFile + ".jpg")), false);
                break;
    * Create a name for the page being exported
    function getPageName(currentPage, layerName, currentINFO){
        var pgRename = "";
        if (currentINFO.doSpreadsON)
            currentINFO["currentSpread"] = currentINFO.theDoc.spreads[currentPage].pages;
        switch (currentINFO.nameConvType){
            case 3: // Odd/Even pages/spreads = .LA.F/LA.B, LB.F/LB.B ...
                pgRename = makeLotName(currentPage+1, peuINFO.subType);
                break;
            case 2: // Odd/Even pages/spreads = .F/.B
                pgRename = ((currentPage+1)%2 == 0) ? "B" : "F";
                break;
            case 1: // Add ".L" to the page name
                pgRename = "L" + currentINFO.pageNameArray[currentPage];
                break;
            case 0: case 4:// As is or Numeric Override
                            // Optionally add "P" and any zeros if options chosen and is numerically named
                            // otherwise, just the "seperatorChar" is added to page name
                if (currentINFO.doSpreadsON){
                    // Loops through number of pages per spread
                    // and adds each page name to the final name (P08.P01)
                    for (j = 0; j < currentINFO.currentSpread.length; j++){
                        if(currentINFO.currentSpread[j].appliedSection.includeSectionPrefix)
                            var tempPage = currentINFO.pageRangeArray[getPageOffset(currentINFO.currentSpread[j].name, currentINFO.pageNameArray, currentINFO.pageRangeArray)];
                        else
                            var tempPage = currentINFO.pageNameArray[getPageOffset(currentINFO.currentSpread[j].name, currentINFO.pageNameArray, currentINFO.pageRangeArray)];
                        var tempPageNum = parseInt(tempPage,10);
                        /* If section name starts with a number, need to compare length of orig vs parsed
                         * to see if the page name is solely a number or a combo num + letter, etc.
                        if (! isNaN(tempPageNum) && ((""+tempPage).length == (""+tempPageNum).length )){
                            if (peuINFO.addZeroON)
                                tempPage = addLeadingZero(tempPageNum, currentINFO.theDoc.pages.length);
                            if (peuINFO.addPon)
                                tempPage = "P" + tempPage;
                        pgRename = (j==0) ? tempPage : pgRename + peuINFO.charList[peuINFO.seperatorChar] + tempPage;
                else {
                    // Create a new name for an individual page
                    if (currentINFO.nameConvType == 4)
                        pgRename = currentPage;
                    else
                        pgRename = currentINFO.pageNameArray[currentPage];
                    if (! isNaN(parseInt(pgRename,10)) && (""+pgRename).length == (""+parseInt(pgRename,10)).length) {
                        if (peuINFO.addZeroON)
                            pgRename = addLeadingZero(pgRename, currentINFO.theDoc.pages.length);
                        if (peuINFO.addPon)
                            pgRename = "P" + pgRename;
                break;
        if(currentINFO.layersON)
            pgRename = addPartToName(pgRename, layerName, peuINFO.layerBeforeON);
        // Add page name to base name based on option selected
        if(peuINFO.pageNamePlacement == 2)
            pgRename = removeColons(currentINFO.baseName.replace(/<#>/g,pgRename) );
        else
            pgRename = addPartToName(currentINFO.baseName, pgRename,peuINFO.pageNamePlacement);
        return pgRename;
    * Add a name part before or after a given base string
    function addPartToName(theBase, addThis, addBefore){
        //Remove any colons
        theBase = removeColons(theBase);
        addThis = removeColons(addThis);
        return (addBefore) ? (addThis + peuINFO.charList[peuINFO.seperatorChar] + theBase ):(theBase + peuINFO.charList[peuINFO.seperatorChar] + addThis);
    * Find the offset page number for a page by its name
    function getPageOffset(pgToFind, pageNameArray, pageRangeArray){
        var offset;
        for(offset = 0; offset<pageRangeArray.length;offset++){
            if((""+ pgToFind).toLowerCase() == (("" + pageNameArray[offset]).toLowerCase() ) || (""+ pgToFind).toLowerCase() == (("" + pageRangeArray[offset]).toLowerCase() ) )
                return offset;
        return -1;
    * Replace any colons with specialReplaceChar
    function removeColons(tempName){
        return tempName.replace(/:/g,peuINFO.charList[peuINFO.specialReplaceChar]);
    * Remove spaces from front and end of name
    function removeSpaces(theName){
        // Trim any leading or trailing spaces in base name
        var i,j;
        for(i = theName.length-1;i>0 && theName.charAt(i) == " ";i--);// Ignore any spaces on end of name
        for(j = 0; j<theName.length && theName.charAt(j) == " ";j++);// Ignore any spaces at front of name
        theName = theName.substring(j,i+1);
        return theName
    * Add leading zero(s)
    function addLeadingZero(tempPageNum, pageCount){
        if(peuINFO.zeroPadding == 0){
            // Normal padding
            if((tempPageNum < 10 && pageCount < 100) || (tempPageNum > 9 && pageCount > 99 && tempPageNum < 100))
                return addSingleZero(tempPageNum);
            else if(tempPageNum < 10 && pageCount > 99)
                return addDoubleZero(tempPageNum);
            else
                return ("" + tempPageNum);
        }else if(peuINFO.zeroPadding == 1){
            // Pad to 2 digits
            if(tempPageNum < 10)
                return addSingleZero(tempPageNum);
            else
                return ("" + tempPageNum);
        }else{
            // Pad to 3 digits
            if(tempPageNum < 10)
                return addDoubleZero(tempPageNum);
            else if(tempPageNum < 100)
                return addSingleZero(tempPageNum);
            else
                return ("" + tempPageNum);
    * Add leading zero helper for single
    function addSingleZero(pgNum){
        return ("0" + pgNum);
    * Add leading zero helper for double
    function addDoubleZero(pgNum){
        return ("00" + pgNum);
    * Create lot name from page number
    function makeLotName(thePage, subType){
        var iii = thePage;
        var curr = 0;
        var alphaBet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        var lotName = "L";
        if(subType == 0){
            while(iii>52){
                curr = Math.floor((iii-1)/52)-1;
                lotName += alphaBet[curr];
                if(curr >= 0)
                    iii -= 52*(1+curr);
                else
                    iii -= 52;
            lotName += alphaBet[Math.floor((iii-1)/2)%26];
        else
            for(iii=thePage; iii>0; iii-=52)
                lotName += alphaBet[Math.floor((iii-1)/2)%26];
        return lotName += (thePage & 0x1)?".F":".B";
    * Advance progress bar one unit
    function advanceBar(){
        var progCancel = app.setProgress(++progCurrentPage);
        if(progCancel)
            byeBye("User canceled export.",peuINFO.sayCancel);
    * Create an Empty tempENTRY "struct"
    function getNewTempENTRY(){
        var newTempENTRY = new Array();
        newTempENTRY["theDoc"] = null;
        newTempENTRY["singlePage"] = null;
        newTempENTRY["getOut"] = null;
        newTempENTRY["outDir"] = null;
        newTempENTRY["outfileName"] = "";
        newTempENTRY["nameConvType"] = null;
        newTempENTRY["baseName"] = null;
        newTempENTRY["doSpreadsON"] = null;
        newTempENTRY["doOneFile"] = null;
        newTempENTRY["formatType"] = null;
        newTempENTRY["layersON"] = null;
        newTempENTRY["hasNonContig"] = false;
        newTempENTRY["nonContigPgs"] = null;
        newTempENTRY["pageNameArray"] = new Array();
        newTempENTRY["pageRangeArray"] = new Array();
        newTempENTRY["psINFO"] = null;
        newTempENTRY["pdfPRESET"] = null;
        newTempENTRY["epsINFO"] = null;
        newTempENTRY["jpegINFO"] = null;
        newTempENTRY["layerINFO"] = null;
        newTempENTRY["useTag"] = null;
        newTempENTRY["pgStart"] = null;
        newTempENTRY["pgEnd"] = null;
        return newTempENTRY;
    * Record all the page/spread names
    function recordPgNames(tempENTRY){
            // Get names of all the pages. Needed when pages are named using sectioning
        for (i = 0; i < tempENTRY.theDoc.documentPreferences.pagesPerDocument; i++){
            var aPage = tempENTRY.theDoc.pages.item(i);
            tempENTRY.pageNameArray[i] = aPage.name;
            tempENTRY.pageRangeArray[i] = (aPage.appliedSection.includeSectionPrefix)? aPage.name : (aPage.appliedSection.name + aPage.name);
        return tempENTRY;
    * Set the export options
    function setExportOption(currentINFO){
            // Set any options here instead of with each page
        switch (currentINFO.formatType){
            case 0: // PostScript Formatting
                setPSoptions(currentINFO);
                break;
            case 1: // PDF Formatting
                // Nothing to do
                break;
            case 2: // EPS Formatting
                setEPSoptions(currentINFO.epsINFO);
                break;
            case 3: // JPEG Formatting
                setJPEGoptions(currentINFO.jpegINFO);
                break;
    * Get PostScript format options
    function getPSoptions(docName){
        var psOptions = new Array();
        psOptions["ignore"] = true;
        var tempGetOut, PSdlog, pgHeight, pgWidth;
        var changeAddPSextention, tempBaseName;
        var printPreset;
        do{
            tempGetOut = true;
            PSdlog = app.dialogs.add({name:"PostScript Options for \"" + docName + "\"", canCancel:true} );
            with (PSdlog)
                with (dialogColumns.add() ){
                    with (dialogRows.add() )
                        staticTexts.add({staticLabel:"Print Presets:"} );
                    printPreset = dropdowns.add({stringList:peuINFO.psPrinterNames , minWidth:236, selectedIndex:peuINFO.defaultPrintPreset} );
                    with (dialogRows.add() )
                        staticTexts.add({staticLabel:"Override PS Page Size (" + peuINFO.measureLableArray[peuINFO.measurementUnits] + ")"} );
                    with (borderPanels.add() )
                        with (dialogColumns.add() )
                            with (dialogRows.add() ){
                                staticTexts.add({staticLabel:"Width:", minWidth:45} );
                                pgWidth = textEditboxes.add({editContents:"0", minWidth:53} );
                                staticTexts.add({staticLabel:"Height:", minWidth:45} );
                                pgHeight = textEditboxes.add({editContents:"0", minWidth:54} );
                    with (dialogRows.add() ){
                        staticTexts.add({staticLabel:"Add \".ps\" to end of file name"} );
                        changeAddPSextention = dropdowns.add({stringList:["No","Yes"], selectedIndex:peuINFO.addPSextention} )
            if((PSdlog.show()) ){
                // Get the page height + width
                pgHeight = parseFloat(pgHeight.editContents);
                pgWidth = parseFloat(pgWidth.editContents);
                // Check entered H & W for error
                if(isNaN(pgHeight) || isNaN(pgWidth) || pgHeight < 0 || pgWidth < 0 ){
                    alert ("Both page height and width must be numeric and greater than zero (3.1).");
                    pgHeight = "0";
                    pgWidth  = "0";
                    tempGetOut = false;
                    continue;
                if(pgHeight > 0 && pgWidth > 0) // User changed size, use the new size
                    psOptions.ignore = false;
                psOptions["height"] = pgHeight + peuINFO.measureUnitArray[peuINFO.measurementUnits];
                psOptions["width"] = pgWidth + peuINFO.measureUnitArray[peuINFO.measurementUnits];
                psOptions["ext"] = changeAddPSextention.selectedIndex;
                peuINFO.addPSextention = psOptions["ext"];
                psOptions["preset"] = printPreset.selectedIndex
                peuINFO.defaultPrintPreset = psOptions.preset;
                savePrefs();
                PSdlog.destroy();
            else{
                PSdlog.destroy();
                byeBye("Exporting has been canceled by user.",peuINFO.sayCancel);
        } while(!tempGetOut);
        return psOptions;
    * Set Postscript options
    function setPSoptions(theINFO){
        with(currentINFO.theDoc.printPreferences){
            activePrinterPreset = peuINFO.csPSprinters[theINFO.psINFO.preset];
            peuINFO.origSpread = printSpreads; // Used to reset to original state when done
            printSpreads = theINFO.doSpreadsON;
            if(colorOutput != ColorOutputModes.separations && colorOutput != ColorOutputModes.inripSeparations)
                printBlankPages = true;
            if (theINFO.useTag)
                pageInformationMarks = true;
            else
                pageInformationMarks = false;
            if(!theINFO.psINFO.ignore){
                try{
                    paperSize = PaperSizes.custom;
                    paperHeight = theINFO.psINFO.height;
                    paperWidth = theINFO.psINFO.width;
                catch(Exception){
                    alert ("The current PPD doesn't support custom page sizes. The page size from the Print Preset will be used (3.2).");
    * Get PDF options
    function getPDFoptions(theINFO){
        var PDFdlog = app.dialogs.add({name:"PDF Options for \"" + theINFO.theDoc.name.split(".ind")[0] + "\"", canCancel:true} );
        var temp = new Array();
        for(i=0;i<app.pdfExportPresets.length;i++)
            temp.push(app.pdfExportPresets[i].name);
        // Test if default PDFpreset is greater # than actual list.
        // This occurs if one was deleted and the last preset in the list was the default
        if(peuINFO.defaultPDFpreset > temp.length-1)
            peuINFO.defaultPDFpreset = 0;
        with (PDFdlog)
            with (dialogColumns.add() ){
                with (dialogRows.add() )
                    staticTexts.add({staticLabel:"PDF Export Preset:"} );
                pdfPresets = dropdowns.add({stringList: temp, minWidth:50, selectedIndex:peuINFO.defaultPDFpreset} );
        if(PDFdlog.show() ){
            temp = app.pdfExportPresets[pdfPresets.selectedIndex];
            peuINFO.defaultPDFpreset = pdfPresets.selectedIndex;
            peuINFO.origSpread = temp.exportReaderSpreads;
            try{
                temp.exportReaderSpreads = theINFO.doSpreadsON;
                temp.pageInformationMarks = (theINFO.useTag && temp.cropMarks)?true:false;
            }catch(e){/*ignore it*/}
            PDFdlog.destroy();
            return temp;
        else{
            PDFdlog.destroy();
            byeBye("PDF exporting has been canceled by user.", peuINFO.sayCancel);
    * Get JPEG options
    function getJPEGoptions(docName){
        var temp = new Array();
        var JPEGdlog = app.dialogs.add({name:"JPEG Options for \"" + docName + "\"", canCancel:true} );
        with (JPEGdlog)
            with (dialogColumns.add() ){
                with (dialogRows.add() )
                    staticTexts.add({staticLabel:"Quality:"} );
                JPEGquality = dropdowns.add({stringList:(new Array("Low","Medium","High","Maximum")) , minWidth:50, selectedIndex:peuINFO.defaultJPEGquality} );
                with (dialogRows.add() )
                    staticTexts.add({staticLabel:"Encoding Type:"} );
                    JPEGrender = dropdowns.add({stringList:["Baseline","Progressive"] , minWidth:50, selectedIndex:peuINFO.defaultJPEGrender } );
        if(JPEGdlog.show() ){
            peuINFO.defaultJPEGquality = JPEGquality.selectedIndex;
            temp["qualityType"] = peuINFO.defaultJPEGquality;
            peuINFO.defaultJPEGrender = JPEGrender.selectedIndex;
            temp["renderType"] = peuINFO.defaultJPEGrender;
        else{
            JPEGdlog.destroy();
            byeBye("JPEG exporting has been canceled by user.",peuINFO.sayCancel);
        JPEGdlog.destroy();
        return temp;
    * Set JPEG options
    function setJPEGoptions(theINFO){
        with(app.jpegExportPreferences){
            peuINFO.origSpread = exportingSpread; // Used to reset to original state when done
            exportingSpread = currentINFO.doSpreadsON;
            exportingSelection = false; // Export the entire page
            if(peuINFO.csVersion > 3)
                jpegExportRange = ExportRangeOrAllPages.exportRange;
            switch (theINFO.qualityType){
                case 0:
                    jpegQuality = JPEGOptionsQuality.low;
                    break;
                case 1:
                    jpegQuality = JPEGOptionsQuality.medium;
                    break;
                case 2:
                    jpegQuality = JPEGOptionsQuality.high;
                    break;
                case 3:
                    jpegQuality = JPEGOptionsQuality.maximum;
                    break;
            jpegRenderingStyle = (theINFO.renderType)? JPEGOptionsFormat.baselineEncoding : JPEGOptionsFormat.progressiveEncoding;
    * Get EPS options
    function getEPSoptions(docName){
        var epsOptions = new Array();
        var epsDialog = app.dialogs.add({name:"EPS Options for \"" + docName + "\"", canCancel:true} );
        var oldBleed = peuINFO.bleed;
        with (epsDialog){
            // Left Column
            with (dialogColumns.add() ){
                with (dialogRows.add() )
                with (borderPanels.add() )
                    with (dialogColumns.add() ){
                        with (dialogRows.add() )
                            staticTexts.add({staticLabel:"Flattener Presets:"} );
                        changeFlattenerPreset = dropdowns.add({stringList:peuINFO.flattenerNames , minWidth:180, selectedIndex:peuINFO.defaultFlattenerPreset} );
                        with (dialogRows.add() )
                            changeIgnoreOverride = checkboxControls.add({staticLabel:"Ignore Overrides", checkedState:peuINFO.ignoreON} );
                        with (dialogRows.add() )
                            staticTexts.add({staticLabel:"Preview Type:"} );
                        changePreviewPreset = dropdowns.add({stringList:peuINFO.previewTypes , minWidth:180, selectedIndex:peuINFO.defaultPreview} );
                        with (dialogRows.add() ){
                            staticTexts.add({staticLabel:"Bleed:"} );
                            changeBleedVal = realEditboxes.add({editValue:peuINFO.bleed, minWidth:60} );
                            staticTexts.add({staticLabel:peuINFO.measureLableArray[peuINFO.measurementUnits]} );
                        with (dialogRows.add() )
                            staticTexts.add({staticLabel:"OPI Options:"} );
                        with (dialogRows.add() ){
                            staticTexts.add({staticLabel:"Omit:"} );
                            changeOpiEPS = checkboxControls.add({staticLabel:"EPS", checkedState:peuINFO.epsON} );
                            changeOpiPDF = checkboxControls.add({staticLabel:"PDF", checkedState:peuINFO.pdfON} );
                            changeOpiBitmap = checkboxControls.add({staticLabel:"Bitmapped", checkedState:peuINFO.bitmapON} );
            // Right column
            with (dialogColumns.add() ){
                with(borderPanels.add() ){
                    with(dialogColumns.add() ){
                        with (dialogRows.add() ){
                            staticTexts.add({staticLabel:"PostScript level:"} );
                            var changePSlevel = dropdowns.add({stringList:["2","3"] , minWidth:75, selectedIndex:peuINFO.psLevel} );
                        with (dialogRows.add() ){
                            staticTexts.add({staticLabel:"Color mode:"} );
                            if(peuINFO.csVersion == 3)
                                var changeColorMode = dropdowns.add({stringList:["Unchanged","Grayscale", "RGB", "CMYK"] , minWidth:100, selectedIndex:peuINFO.colorType } );
                            else
                                var changeColorMode = dropdowns.add({stringList:["Unchanged","Grayscale", "RGB", "CMYK","PostScript Color Management"] , minWidth:100, selectedIndex:peuINFO.colorType } );
                        with (dialogRows.add() ){
                            staticTexts.add({staticLabel:"Font embedding:"} );
                            var changeFontEmbedding = dropdowns.add({stringList:["None","Complete", "Subset"] , minWidth:100, selectedIndex:peuINFO.fontEmbed } );
                        with (dialogRows.add() ){
                            staticTexts.add({staticLabel:"Type of data to send:"} );
                            var changeDataToSend = dropdowns.add({stringList:["All","Proxy"] , minWidth:50, selectedIndex:peuINFO.dataSent } );
                        with (dialogRows.add() ){
                            staticTexts.add({staticLabel:"Data type:"} );
                            var changeDataType = dropdowns.add({stringList:["Binary","ASCII"] , minWidth:50, selectedIndex:peuINFO.dataType } );
                        with (dialogRows.add() ){
                            staticTexts.add({staticLabel:"Perform OPI replacement:"} );
                            var changeOPIreplace = dropdowns.add({stringList:["No","Yes"] , minWidth:50, selectedIndex:peuINFO.opiReplacement} );
        do{
            var getOut = true;
            if((epsDialog.show()) ){
                // Use these to update the prefs file
                peuINFO.defaultFlattenerPreset = changeFlattenerPreset.selectedIndex;
                peuINFO.ignoreON = (changeIgnoreOverride.checkedState)?1:0;
                peuINFO.defaultPreview = changePreviewPreset.selectedIndex;
                peuINFO.bleed = changeBleedVal.editContents;
                peuINFO.epsON = (changeOpiEPS.checkedState)?1:0;
                peuINFO.pdfON = (changeOpiPDF.checkedState)?1:0;
                peuINFO.bitmapON = (changeOpiBitmap.checkedState)?1:0;
                peuINFO.psLevel = changePSlevel.selectedIndex;
                peuINFO.colorType = changeColorMode.selectedIndex;
                peuINFO.fontEmbed = changeFontEmbedding.selectedIndex;
                peuINFO.dataSent = changeDataToSend.selectedIndex;
                peuINFO.dataType = changeDataType.selectedIndex;
                peuINFO.opiReplacement = changeOPIreplace.selectedIndex;
                // Check if bleed value is OK
                peuINFO.bleed = parseFloat(peuINFO.bleed)
                if (isNaN(peuINFO.bleed)){
                    alert("Bleed value must be a number (1.1).");
                    getOut = false;
                    peuINFO.bleed = oldBleed;
                else if (peuINFO.bleed < 0){
                    alert("Bleed value must be greater or equal to zero (1.2).");
                    getOut = false;
                    peuINFO.bleed = oldBleed;
                else {
                    // Check if bleed is too big
                    try {
                        app.epsExportPreferences.bleedBottom = "" + peuINFO.bleed + peuINFO.measureUnitArray[peuINFO.measurementUnits];
                    catch (Exception){
                        alert("The bleed value must be less than one of the following: 6 in | 152.4 mm | 432 pt | 33c9.384");
                        getOut = false;
                        peuINFO.bleed = oldBleed;
            else{
                epsDialog.destroy();
                byeBye("EPS Export canceled by user.", peuINFO.sayCancel);
        }while(!getOut);
            // These are used for exporting
            epsOptions["defaultFlattenerPreset"] = changeFlattenerPreset.selectedIndex;
            epsOptions["ignoreON"] = peuINFO.ignoreON;
            epsOptions["defaultPreview"] = changePreviewPreset.selectedIndex;
            epsOptions["bleed"] = peuINFO.bleed;
            epsOptions["epsON"] = peuINFO.epsON;
            epsOptions["pdfON"] = peuINFO.pdfON;
            epsOptions["bitmapON"] = peuINFO.bitmapON;
            epsOptions["psLevel"] = changePSlevel.selectedIndex;
            epsOptions["colorType"] = changeColorMode.selectedIndex;
            epsOptions["fontEmbed"] = changeFontEmbedding.selectedIndex;
            epsOptions["dataSent"] = changeDataToSend.selectedIndex;
            epsOptions["dataType"] = changeDataType.selectedIndex;
            epsOptions["opiReplacement"] = changeOPIreplace.selectedIndex;
            epsDialog.destroy();
            return epsOptions;
    *     Apply chosen settings to the EPS export prefs
    function setEPSoptions(theINFO){
        with(app.epsExportPreferences){
            appliedFlattererPreset = peuINFO.flattenerNames[theINFO.defaultFlattenerPreset];
            bleedBottom = "" + theINFO.bleed + peuINFO.measureUnitArray[peuINFO.measurementUnits];
            bleedInside = bleedBottom;
            bleedOutside = bleedBottom;
            bleedTop = bleedBottom;
            epsSpreads = currentINFO.doSpreadsON;
            ignoreSpreadOverrides = theINFO.ignoreON;
            switch (theINFO.dataType){
                case 0:
                    dataFormat = DataFormat.binary;
                    break;
                case 1:
                    dataFormat = DataFormat.ascii;
                    break;
            switch (theINFO.colorType){
                case 0:
                    epsColor = EPSColorSpace.unchangedColorSpace;
                    break;
                case 1:
                    epsColor = EPSColorSpace.gray;
                    break;
                case 2:
                    epsColor = EPSColorSpace.rgb;
                    break;
                case 3:
                    epsColor = EPSColorSpace.cmyk;
                    break;
                case 4:
                    epsColor = EPSColorSpace.postscriptColorManagement;
                    break;
            switch (theINFO.fontEmbed){
                case 0:
                    fontEmbedding = FontEmbedding.none;
                    break;
                case 1:
                    fontEmbedding = FontEmbedding.complete;
                    break;
                case 2:
                    fontEmbedding = FontEmbedding.subset;
                    break;
            switch (theINFO.dataSent){
                case 0:
                    imageData = EPSImageData.allImageData;
                    break;
                case 1:
                    imageData = EPSImageData.proxyImageData;
                    break;
            switch (theINFO.defaultPreview){
                case 0:
                    preview = PreviewTypes.none;
                    break;
                case 1:
                    preview = PreviewTypes.tiffPreview;
                    break;
                case 2:
                    preview = PreviewTypes.pictPreview;
                    break;
            switch (theINFO.psLevel){
                case 0:
                    postScriptLevel = PostScriptLevels.level2;
                    break;
                case 1:
                    postScriptLevel = PostScriptLevels.level3;
                    break;
            // Setting these three to false prevents a conflict error when trying to set the opiImageReplacement value
            omitBitmaps = false;
            omitEPS = false;
            omitPDF = false;
            if (theINFO.opiReplacement){
                opiImageReplacement = true;
            else {
                opiImageReplacement = false;
                omitBitmaps = theINFO.bitmapON;
                omitEPS = theINFO.epsON;
                omitPDF = theINFO.pdfON;
    * Build the main dialog box
    function createMainDialog (docName, thisNum, endNum){
        var theDialog = app.dialogs.add({name:(VERSION_NAME + ": Enter the options for \"" + docName + "\"" + ((endNum==1)?"":" (" + thisNum + " of " + endNum + " documents)") )
    , canCancel:true} );
        with (theDialog){
            // Left Column
            with (dialogColumns.add() ){
                with (dialogRows.add() )
                    staticTexts.add({staticLabel:"Page Naming Options"} );
                with(borderPanels.add() ){
                    with(dialogColumns.add() ){
                        // Radio butons for renaming convention
                        namingConvention = radiobuttonGroups.add();
                        with(namingConvention){
                            radiobuttonControls.add({staticLabel:"As Is", checkedState:(peuINFO.nameConvType == 0)} );
                            radiobuttonControls.add({staticLabel:"Add \".L\"", checkedState:(peuINFO.nameConvType == 1)} );
                            radiobuttonControls.add({staticLabel:"Odd/Even = \".F/.B\"", checkedState:(peuINFO.nameConvType == 2)} );
                            radiobuttonControls.add({staticLabel:"Odd/Even = \"LA.F/LA.B\"" , checkedState:(peuINFO.nameConvType == 3)});
                            radiobuttonControls.add({staticLabel:"Numeric Override" , checkedState:(peuINFO.nameConvType == 4)});
                    with (dialogRows.add() )
                        staticTexts.add({staticLabel:""} );
                        with(dialogRows.add() ){
                        staticTexts.add({staticLabel:"Base Name"} );
                        newBaseName = textEditboxes.add({editContents:baseName, minWidth:100} );
            // Middle Column
            with (dialogColumns.add() ){
                with (dialogRows.add() )
       

    RichardM0701, are you the same person as scottbentley?
    I fear your response doesn't make a lot of sense. The easiest way is to put your files into a book, which will not harm them. The easiest script is often no script at all.
    I don't understand your comment about separate text boxes, files contain text boxes and definitionally multiple files means multiple separate text boxes.
    I do not know what you are referring to with respect to the toc update, perhaps you could reference a particular command or script, or provide a screenshot.
    It sounds like now you are interested in updating multiple tables of contents in a single fell swoop -- this would appear to have nothing to do with the original question. If that's the case, please start a new thread.

  • Java.util.MissingResourceException: Can't find bundl :ERROR plz Help

    hey guys am trying to connect to my data base and view data toa jsp page but i got this error :
    Exception report
    message
    descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: java.util.MissingResourceException: Can't find bundle for base name DataBase, locale en_US
    root cause
    java.util.MissingResourceException: Can't find bundle for base name DataBase, locale en_US
    note The full stack traces of the exception and its root causes are available in the Sun Java System Application Server 9.1 logs.
    here is the code database _proper
    drivername=oracle.jdbc.driver.OracleDriver
    dataSourceName=jdbc/orcl/WOH
    dsLookupPrefix=WOH.getstring("dslookupprefix");
    user=SYSTEM
    password=SYSTEM
    location=192.168.1.3
    port=1521
    sid=ORCL
    and here is the Dao connection class
    package version.dao;
    import java.util.*;
    //to provide JDBC classes
    import java.sql.*;
    * @author freddy
    public class DAODirect {
    * Insert the type's description here.
    * Creation date: (12/25/2006 12:13:56 PM)
    * @author: Administrator
         private Connection connection = null;
         private Statement statement = null;
         private String driverName =null;// "oracle.jdbc.driver.OracleDriver";//null;
         private String url =null;//"jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL";//null;
         private ResultSet rs = null;
         private String columnNames[];
         private int columnCount;
         private Object[] record;
         * PFSDataBase constructor comment.
         public DAODirect() {
              super();
              ResourceBundle database = ResourceBundle.getBundle("DataBase");
    //1 get the driver name
              driverName = database.getString("drivername");
              String user = database.getString("user");
              String password = database.getString("password");
              String location = database.getString("location");
              String port = database.getString("port");
              String sid = database.getString("sid");
    //String dataSourceName=database.getString("dataSourceName");
    //2- get the Connection url
              url =
                   "jdbc:oracle:thin:"
                        + user
                        + "/"
                        + password
                        + "@"
                        + location
                        + ":"
                        + port
                        + ":"
                        + sid;
              System.out.println("++++++++"+url);
    System.out.println("++++++++"+url);
         public void closeStatement() {
              try {
                   if (statement != null) {
                        statement.close();
                        statement = null;
              } catch (Exception e) {
         public void commitDB() throws Exception{
              connection.commit();     
         public boolean connect() throws Exception {
              try {
                   if (connection == null) {
    //1- loading of JDBC Drivers
                        Class.forName(driverName);
                        System.out.println(url);
    //this line =conn = DriverManager.getConnection(
    // "jdbc:oracle:thin:@noizmaker:1521:osiris",
    // "scott", "tiger");
    //2- Establish Connection
                        connection = DriverManager.getConnection(url);
                        return true;
                   } else {
                        throw (
                             new Exception("connection is not disconnected, you have to disconnect this connection before reconnecting it again"));
              } catch (SQLException e) {
                   e.printStackTrace();
                   throw (new Exception("Unable to connect to database,Error Loading Driver"));
         public void createStatement() throws Exception {
              if (statement != null) {
                   closeStatement();
              if (connection == null) {
                   throw (new Exception("database is not connected"));
              statement = connection.createStatement();//3-bulit_in funnction that create and send sql statment
         public void disconnect() throws Exception {
              if (connection != null) {
                   try {
                        connection.close();
                        connection = null;
                   } catch (Exception e) {
                   //isConnected = false;
              } else {
                   throw (new Exception("can not disconnect database"));
    // ResultSet is: A table of data representing a database result set, which is usually generated by executing a statement that queries the database
         public ResultSet execute(String query) throws Exception {
              if (connection == null) {
                   throw (new Exception("database is not connected"));
              if (statement == null) {
                   throw (new Exception("statement is not created"));
              return statement.executeQuery(query);//bulit_in funnction that 4-execute given sql statment
         public void getColumnNames(ResultSet result) throws Exception {
              try {
    //An object that can be used to get information about the types and properties of the columns in a ResultSet object.
                   ResultSetMetaData resultsMetaData = result.getMetaData();
                   columnCount = resultsMetaData.getColumnCount();
                   columnNames = new String[columnCount];
                   for (int i = 1; i < columnCount + 1; i++) {
                        columnNames[i - 1] = resultsMetaData.getColumnName(i).trim();//trim to remove whaite space
              } catch (Exception e) {
                   throw (new Exception("Result Set Columns " + e.getMessage()));
         public Connection getConnection(){
              return connection;     
         public void rollBack() throws Exception{
              connection.rollback();     
         public Vector rsToVector(ResultSet rs) throws Exception {
              getColumnNames(rs);
              Vector resultSetData = new Vector();
              resultSetData.addElement(columnNames);
              try {
                   this.record = new Object[columnCount];
                   while (rs.next()) {
    //ave each raw
                        Object[] record = new Object[columnCount];
                        for (int i = 1; i < columnCount + 1; i++) {
                             Object entry = rs.getObject(i);
                             record[i - 1] = entry;
    // here we print the whole tabel after we save each record in record[]
                        resultSetData.addElement(record);
                   return resultSetData;
              } catch (Exception e) {
                   resultSetData.clear();
                   throw (new Exception("Result Set : " + e.getMessage()));
         public void setAutoCommit(boolean commitType) throws Exception{
              connection.setAutoCommit(commitType);     
         public boolean update(String query) throws Exception {
              if (connection == null) {
                   throw (new Exception("database is not connected"));
              try {
    //create query and execute it
                   createStatement();
                   statement.execute(query);
                   return true;
              } catch (Exception e) {
                   throw (
                        new Exception(
                             "Error in manipulating query :" + e.getMessage()));
              } finally {
                   closeStatement();
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package version.dao;
    import java.sql.ResultSet;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.SQLException;
    import javax.sql.DataSource;
    import javax.naming.InitialContext;//unknown
    import java.util.ResourceBundle;//unknown
    * @author freddy
    * This is the Data Access Object (DAO), which deals with all Database transactions,
    * connections,and pooling (through Data Source implementation).
    * This class configured through the database.properties file
    * which contains all the database parameters
    * @author: Tariq Qasem
    public class DAO {
         private Connection connection = null;
         private Statement statement = null;
         private String dataSourceName =null; //MyDataSource; //null;
         private String dsLookupPrefix = null;//java:comp/env/;
    //null;
         private ResultSet rs = null;
         * DAO constructor comment.
         public DAO() {
              super();
              ResourceBundle database = ResourceBundle.getBundle("DataBase");
              dataSourceName = database.getString("dataSourceName");
              dsLookupPrefix = database.getString("dsLookupPrefix");
         * @param request PortletRequest
         * @return void
         * this method close pooled statement
         public void closeStatement() {
              try {
                   if (statement != null) {
                        statement.close();
                        statement = null;
              } catch (Exception e) {
         * @param request PortletRequest
         * @return boolean
         * this method connects to the database
         public boolean connect() throws Exception {
              try {
                   if (connection == null) {
                        InitialContext ctx = new InitialContext();
                   DataSource ds = (DataSource) ctx.lookup(dsLookupPrefix+dataSourceName);
                        connection = ds.getConnection();
                        return true;
                   } else {
                        throw (
                             new Exception("connection is not disconnected, you have to disconnect this connection before reconnecting it again"));
              } catch (SQLException e) {
                   e.printStackTrace();
                   throw (new Exception("Unable to connect to database"));
         public void createStatement() throws Exception {
              if (statement != null) {
                   closeStatement();
              if (connection == null) {
                   throw (new Exception("database is not connected"));
              statement = connection.createStatement();
         * @param request PortletRequest
         * @return void
         * this method disconnect the database connection
         public void disconnect() throws Exception {
              if (connection != null) {
                   try {
                        connection.close();
                        connection = null;
                   } catch (Exception e) {
              } else {
                   throw (new Exception("can not disconnect database"));
         * @param request PortletRequest
         * @return boolean
         * this method updates (executes) Insert and Updates queries on the database
    /*     public boolean update(String query) throws Exception {
              if (connection == null) {
                   throw (new Exception("database is not connected"));
              try {
                   createStatement();
                   statement.execute(query);
                   return true;
              } catch (Exception e) {
                   throw (
                        new Exception(
                             "Error in manipulating query :" + e.getMessage()));
              } finally {
                   closeStatement();
         public int update(String query) throws Exception {
              int records = 0;
              if (connection == null) {
                   throw (new Exception("database is not connected"));
              try {
                   createStatement();
                   records = statement.executeUpdate(query);
                   return records;
              } catch (Exception e) {
                   throw (
                        new Exception(
                             "Error in manipulating query :" + e.getMessage()));
              } finally {
                   closeStatement();
         * @param request PortletRequest
         * @return ResultSet
         * this method executes select queries on the database
         public ResultSet execute(String query) throws Exception {
              if (connection == null) {
                   throw (new Exception("database is not connected"));
              if (statement == null) {
                   throw (new Exception("statement is not created"));
              return statement.executeQuery(query);
         * @param request PortletRequest
         * @return void
         * this method to set the commit transaction on the database to be auto
         public void setAutoCommit(boolean commitType) throws Exception{
              connection.setAutoCommit(commitType);     
         * @param request PortletRequest
         * @return void
         * this method commit database transaction
         public void commitDB() throws Exception{
              connection.commit();     
         * @param request PortletRequest
         * @return void
         * this method rollback database transaction
         public void rollBack() throws Exception{
              connection.rollback();     
         * @param request PortletRequest
         * @return Connection
         * this method return the database connection as java object
         public Connection getConnection(){
              return connection;     
    and this is my jsp page:
    <%--
    Document : index
    Created on : Mar 16, 2008, 10:14:55 AM
    Author : freddy
    --%>
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <h2>Hello World!</h2>
    <%
    version.dao.DAODirect dao=new version.dao.DAODirect();
    try
    boolean connected = dao.connect();
    dao.createStatement();
    String query = " SELECT ID,NAME FROM version";
    java.sql.ResultSet rs = dao.execute(query);
    while(rs.next()){
    out.println(rs.getInt("P_ID")+" ");
    out.println(rs.getString("P_FN")+"<BR>");
    dao.closeStatement();
    dao.disconnect();
    catch(Exception e)
    out.print(e.getMessage());
    %>
    </body>
    </html>
    plz guys help me i need this for my graduation project also if anyone know kind of tutorialsfor building J2me/J2EE application using wifi plzzzsend me links or anything ,thx in advance

    This can happen after modifying the calendar properties and not reloading the application. Try reloading or restarting the application. This could also mean the Calendar.properties file has been moved, deleted, or become corrupted. A default properties file can be found at:
    "Tomcat-install-dir"\webapps\"your-web-application"\WEB-INF\classes\defaultPropFile\. Copy this file to: "Tomcat-install-dir"\webapps\"your-web-application"\WEB-INF\classes\. Stop and restart the web server. From a browser, run "hostname"/"your-web-application"/src/setupCalendar.jsp.

  • Bug on native code of OJVM java.util.zip.CRC32.updateBytes(CRC32.java)

    I want to unzip OpenOffice 1.0 files inside the OJVM but it fails into the native method java.util.zip.CRC32.updateBytes(CRC32.java).
    The first execution of the code runs OK, but the second not.
    After a long wait it shutdown the connection and the oracle trace file shows an stack trace like this:
    *** 2003-04-18 11:31:31.926
    *** SESSION ID:(17.97) 2003-04-18 11:31:31.926
    java.lang.IllegalArgumentException
    at java.util.zip.CRC32.updateBytes(CRC32.java)
    at java.util.zip.CRC32.update(CRC32.java)
    at java.util.zip.ZipInputStream.read(ZipInputStream.java)
    at oracle.xml.parser.v2.XMLByteReader.fillByteBuffer(XMLByteReader.java:354)
    at oracle.xml.parser.v2.XMLUTF8Reader.fillBuffer(XMLUTF8Reader.java:142)
    at oracle.xml.parser.v2.XMLByteReader.saveBuffer(XMLByteReader.java:448)
    at oracle.xml.parser.v2.XMLReader.fillBuffer(XMLReader.java:2012)
    at oracle.xml.parser.v2.XMLReader.skipWhiteSpace(XMLReader.java:1800)
    at oracle.xml.parser.v2.NonValidatingParser.parseMisc(NonValidatingParser.java:305)
    at oracle.xml.parser.v2.NonValidatingParser.parseProlog(NonValidatingParser.java:274)
    at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:254)
    at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:225)
    at com.prism.cms.frontend.EditPropertiesActions.processUpload(EditPropertiesActions.java:1901)
    Exception signal: 11 (SIGSEGV), code: 1 (Address not mapped to object), addr: 0x6d3a74a0, PC: [0x40263600, eomake_reference_to_eobjec
    t()+80]
    Registers:
    %eax: 0x54a54000 %ebx: 0x40429c20 %ecx: 0x54a546bf
    %edx: 0x6d3a7478 %edi: 0x402b27d0 %esi: 0x45c718ac
    %esp: 0xbfffbf20 %ebp: 0xbfffbf48 %eip: 0x40263600
    %efl: 0x00010206
    The code of the java method is:
    public static void processUpload(String id_page, String longname,
    String filename, String filetype,
    String s00)
    throws SQLException {
    Integer p_id = new Integer(id_page);
    String toSource;
    XMLDocument doc = null;
    DOMParser theParser = null;
    InputStream XSLStream = null;
    BufferedWriter out = null;
    #sql { select path||name||'.html' into :toSource from pages where id_page=:p_id };
    if ("Cancel".equalsIgnoreCase(s00)) {
    Jxtp.redirecUrl("/dbprism/ldoc/live/edit.html?p_source="+toSource);
    return;
    if ("no-file".equals(filename) && "no-contenttpye".equals(filetype)) {
    Jxtp.redirecUrl("/dbprism/ldoc/live/edit.html?p_source="+toSource);
    return;
    if ("xml".equalsIgnoreCase(filetype))
    #sql { call CMSj.moveFromUpload(:filename,:p_id) };
    else if ("sxw".equalsIgnoreCase(filetype)) {
    XSLProcessor processor = new XSLProcessor();
    XSLStylesheet theXSLStylesheet = null;
    BLOB locator = null;
    // open sxw file, it will be in zip format with a file named content.xml
    // then convert content.xml to document-v10.dtd with an stylesheet
    #sql { select blob_content into :locator from wpg_document where name = :filename for update };
    ZipInputStream zin = new ZipInputStream(locator.binaryStreamValue());
    ZipEntry entry;
    try {
    while((entry=zin.getNextEntry())!=null)
    if ("content.xml".equalsIgnoreCase(entry.getName())) {
    Integer newVersion;
    CLOB dstDoc;
    CMSDocURLStreamHandlerFactory.enableCMSDocURLs();
    try {
    URL inUrl = new URL("cms:/stylesheets/sxw2document-v10.xsl");
    XSLStream = inUrl.openStream();
    // Create the Stylesheet from the stream
    theXSLStylesheet = processor.newXSLStylesheet(XSLStream);
    // Stores the document processing it with the given stylesheet
    theParser = new DOMParser();
    theParser.setValidationMode(theParser.NONVALIDATING);
    theParser.setBaseURL(new URL("cms:/dtd/"));
    theParser.parse(zin);
    doc = theParser.getDocument();
    #sql { SELECT NVL(MAX(version),0)+1 INTO :newVersion FROM content
    WHERE cn_id_page = :p_id };
    #sql { INSERT INTO content( cn_id_page, version, owner, status, source_file,
    file_size, content, created, modified, created_by,
    modified_by)
    VALUES ( :p_id, :newVersion, sys_context('cms_context','user_id'),
    'Uploaded', :filename, 0 , EMPTY_CLOB(), SYSDATE, SYSDATE,
    sys_context('cms_context','user_id'),
    sys_context('cms_context','user_id')) };
    #sql { SELECT content INTO :dstDoc FROM content
    WHERE cn_id_page = :p_id AND version = :newVersion for update };
    #sql { call DBMS_LOB.trim(:inout dstDoc,0) };
    out = new BufferedWriter(dstDoc.getCharacterOutputStream(),dstDoc.getChunkSize());
    processor.processXSL(theXSLStylesheet, doc, new PrintWriter(out));
    #sql { delete from wpg_document where name=:filename };
    } catch (SAXParseException spe) {
    throw new SQLException("processUpload SAXParseException: "+xmlError(spe));
    } catch (SAXException se) {
    throw new SQLException("processUpload SAXException: "+se.getLocalizedMessage());
    } catch (XSLException xsle) {
    throw new SQLException("processUpload XSLException: "+xsle.getLocalizedMessage());
    } finally {
    if (XSLStream!=null)
    XSLStream.close();
    if (theParser!=null)
    theParser = null;
    if (out!=null) {
    out.flush();
    out.close();
    zin.close();
    } catch (IOException ioe) {
    throw new SQLException("processUpload IOException: "+ioe.getLocalizedMessage());
    } finally {
    if (XSLStream!=null)
    XSLStream = null;
    if (out!=null)
    out = null;
    if (zin!=null)
    zin = null;
    Jxtp.redirecUrl("/dbprism/ldoc/live/edit.html?p_source="+toSource);
    Basically it takes the content from a BLOB column of the wpg_document table, unzip it using java.util.zip package, look for the file content.xml and parse it using Oracle XML toolkit.
    Using an open source utility which replace java.util.package (http://jazzlib.sourceforge.net/) it works perfect because is a pure java application.
    Best regards, Marcelo.
    PD: I am using Oracle 9.2.0.2 on Linux.

    The cause of errors was a dying Westen Digital drive, specially the 48G partition reserved only for $ORACLE_BASE (/dev/sdb3 mounted on /opt/oracle).
    A simple quick scan of unmounted partition (badblocks -v /dev/sdb3) reported more than thousand new bad blocks (compared to the last scan six months ago). Although I strongly believe, specially in the case of WDC drives, that the best utility to "repair" bad blocks is the one that opens a window and prints the message: "Go to the nearest shop and buy a new drive", I was very curious to prove my suspicion just on this drive. After zero-filling the partition with dd, then formatting it (mke2fs -cc) and mounting again, the 11g installation and database creation (on the same partition) successfully completed, performing fast and smoothly. To make sure it was not a casual event, I repeated the installation once again with full success. The database itself is working fine (by now). Well, the whole procedure took me more than four hours, but I'm pretty satisfied. I learned once again - stay away from Western Digital. As Oracle cannot rely on dying drive, my friend is going tomorrow to spend a 150+ euro on two 250G Seagate Barracudas and replace both WDC drives, even though the first drive seems to be healthy.
    In general there is no difference between loading correct data from good disk into bad memory and loading the incorrect data from dying disk into good memory. In both cases the pattern is damaged. For everyone who runs into the problem similar to this, and the cause cannot be easily determined, the rule of thumb must be:
    1. test memory and, if it shows any error, check sockets and test memory modules individually
    2. check disks for bad blocks regardless of the result of memory testing
    Therefore I consider your answer being generally correct.
    Regards
    NJ

Maybe you are looking for