Process and subprocess - share variables

Hello,
I have a main process that calls a subprocess. At the same time the main process will continue working due to a parallel path.
when the subprocess finishes, I would like that some data(payload) on my main process get updated. Is this possible?
OR
Is it possible to share data between a main process and subprocess?
Any example?
thank you
fwu

Hello,
What do you mean with "and only a single conversation"? does it means that if my main process calls 2 subprocess only one of this subprocess will be able to communicate with the main process exactly in the same moment? Or that at design time i will not be able to specify a conversation for more than one subprocess?
Delegating the interaction to a bpel subprocess menas that my subprocess would have to be created in bpel? But does bpel has human task objects?
Another question, when I add a subprocess to a main process, Im able to link the subprocess with the main process. When does this route will be followed? Exactly when the subprocess is called or just when it finishes?
Finally, where should I define this: "if the subprocess is defined to callback to the parent"
thanl you for your attention,
fwu

Similar Messages

  • SAP GRC - ERM - Role update issue - Business Process and Subprocess

    Hello Friends:
    We are NOT currently maintaining Business processes or sub processes in GRC 5.3 for all roles. We don't want to maintain them in GRC 10 when we upload the roles. These 2 fields are Mandatory in GRC 10.0 - Can we make them NOT mandatory and leave them blank?? Currently we are facing some issues in uploading the roles
    Please advise.
    Regards
    Ashish

    Dear Ameet:
    I just dislike the idea where SAP has made options for Business Process and Subprocess columns mandatory in uploading the roles as well from backend.
    I am NOT using BRM, but still need to upload the roles for SAP to recognize them to be assigned to the users in GRC 10.0
    I was facing the issues in uploading the roles initially, but now i have made it simple - just assign all the roles without the information of being FI or SD or Mm - to IT00 business process and sub process. So, all the roles are now uploaded to the system. I was just curious to know if they can me made Non-mandatory field by any settings.
    But anyways, thanks for your input.
    Regards
    Ashish Desai

  • Creating variables in Process Flows and using thse variables in the filter

    Hi,
    I am new to OWB and in learing stage. Need to information.
    *1. as to how pass/create/use variables to OWB mapping ?*
    *2. Creating variables in Process Flows and using thse variables in the filter operator of the OWB mapping?*
    *3. Other mechanisms of how to create/use variables within OWB mapping itself ?*
    can you please provide the above details and guide me / help me in this regard.
    Thanks,
    skms.

    1. Add parameters to your mapping using the MAPPING INPUT PARAMETER from the pallette.
    2. Add parameters to the START operator in the process flow. Bind the process flow parameter to the Mapping parameter.
    3. May be appropriate to use CONSTANTS instead of parameters.
    Regards
    Si

  • How can we know perticular rfc is connected to process code and subprocess

    Hi all,
    we are integrating plm system to SAP ERP system(ecc). Plm system is connected to sap through sap CAD INTERFACE. In the cad interface they are configured process codes(5 chatecters length for identifying application like BOMCN for BOM) and subprocess codes(2 characters length for crete , delete e.t.c).
    These functions call dialog rfc interface like BOM_CREATE_BILL_OF_ MATERIAL. My question is how these process codes are calling RFC's and these are dialog rfc's how we can run in backgroung procesing. I will appreciate for early reply.

    Hi Prasad,
    -Inbound IDOC Development-
    Create Idoc segments (WE31)
    Create Idoc (WE30)
    Create message type (WE81)
    Assign Message type to Idoc type (WE82)
    Develop posting program.
    Configure the function to handle one or more idocs in the same call (BD51)
    Assign function module to Idoc and message type (WE57)
    Create inbound process code (WE42)
    Add message type to inbound parameters for partner (WE20)
    -Outbound IDOC Development-
    Create Idoc segments (WE31)
    Create Idoc (WE30)
    Create message type (WE81)
    Assign Message type to Idoc type (WE82)
    Develop posting program.
    Configure the function to handle one or more idocs in the same call (BD51)
    Assign function module to Idoc and message type (WE57)
    Create inbound process code (WE41)
    Add message type to inbound parameters for partner (WE20)
    Regards,
    Prabhudas

  • Find network share process and kill it

    Hi All,
    Is it possible that we could find open network share access process and kill it?
    For example, user is opened a folder via network share (e.g: \\myserver\c$\myfolder). Is it possible that we could somehow query process to identify this open network share process and kill it before attemp to delete C:\myfolder? Please advise.
    Best Regards,
    Andy Pham
    Best Regards, Andy Pham

    You could try checking for open file handles, as described here:
    http://stackoverflow.com/questions/317071/how-do-i-find-out-which-process-is-locking-a-file-using-net. They have both a solution using an external executable utility (SysInternals) and one using PInvoke. You could also use this other utility which is specifically
    targeted at hosts of network shares:
    http://technet.microsoft.com/en-us/sysinternals/bb897552.aspx.
    Wasabi Fan

  • Problem with Threads and a static variable

    I have a problem with the code below. I am yet to make sure that I understand the problem. Correct me if I am wrong please.
    Code functionality:
    A timer calls SetState every second. It sets the state and sets boolean variable "changed" to true. Then notifies a main process thread to check if the state changed to send a message.
    The problem as far I understand is:
    Assume the timer Thread calls SetState twice before the main process Thread runs. As a result, "changed" is set to true twice. However, since the main process is blocked twice during the two calls to SetState, when it runs it would have the two SetState timer threads blocked on its synchronized body. It will pass the first one, send the message and set "changed" to false since it was true. Now, it will pass the second thread, but here is the problem, "changed" is already set to false. As a result, it won't send the message even though it is supposed to.
    Would you please let me know if my understanding is correct? If so, what would you propose to resolve the problem? Should I call wait some other or should I notify in a different way?
    Thanks,
    B.D.
    Code:
    private static volatile boolean bChanged = false;
    private static Thread objMainProcess;
       protected static void Init(){
            objMainProcess = new Thread() {
                public void run() {
                    while( objMainProcess == Thread.currentThread() ) {
                       GetState();
            objMainProcess.setDaemon( true );
            objMainProcess.start();
        public static void initStatusTimer(){
            if(objTimer == null)
                 objTimer = new javax.swing.Timer( 1000, new java.awt.event.ActionListener(){
                    public void actionPerformed( java.awt.event.ActionEvent evt){
                              SetState();
        private static void SetState(){
            if( objMainProcess == null ) return;
            synchronized( objMainProcess ) {
                bChanged = true;
                try{
                    objMainProcess.notify();
                }catch( IllegalMonitorStateException e ) {}
        private static boolean GetState() {
            if( objMainProcess == null ) return false;
            synchronized( objMainProcess ) {
                if( bChanged) {
                    SendMessage();
                    bChanged = false;
                    return true;
                try {
                    objMainProcess.wait();
                }catch( InterruptedException e ) {}
                return false;
        }

    Thanks DrClap for your reply. Everything you said is right. It is not easy to make them alternate since SetState() could be called from different places where the state could be anything else but a status message. Like a GREETING message for example. It is a handshaking message but not a status message.
    Again as you said, There is a reason I can't call sendMessage() inside setState().
    The only way I was able to do it is by having a counter of the number of notifies that have been called. Every time notify() is called a counter is incremented. Now instead of just checking if "changed" flag is true, I also check if notify counter is greater than zero. If both true, I send the message. If "changed" flag is false, I check again if the notify counter is greater than zero, I send the message. This way it works, but it is kind of a patch than a good design fix. I am yet to find a good solution.
    Thanks,
    B.D.

  • My wife and I share the iPad. Can we set up separate accounts to log in (like on our Mac)?

    My wife and I share the iPad. Can we set up separate accounts to log in (like on our Mac)?

    Good question, but I'm 99.9% certain the answer is "no".  Here are some considerations:
    Think of the heritage of iOS.  It really started with iPhones and maybe iPods.  These devices cost a whole lot less than a Mac.  They are generally not thought of as shared (with exceptions, of course, as is true for you).
    Think of the backup process.  i-devices typically sync with one iTunes on one computer.  How would an i-device with multiple users enstantiate this?
    Anyway, all this is to say I'm convinced you cannot do what you're inquiring about.

  • Why should you explicitly open and close shared variable connections?

    I'm looking into switching over from the old Datasocket API to the new Shared Variable API for programmatic access to shared variables, and I noticed that LV doesn't seem to have any problems executing Shared Variable Reads & Writes without first opening the connection explicitly. That is, I can just drop in a shared varaible Read VI, wire a constant to the refnum input, and it will work. I'm wondering, then, what benefits are offered by explicitly opening the conenction ahead of time...?
    I guess I could see some cases where you want to open all necessary connections in an initialization state of a top-level state machine, particularly if you want to use the "Open & Verify Connection"---so you could jump straight to an error case if any connections fail. But other than that, why else might one want to explicitly open the connections.
    And, along those lines, are there any problems with implicitly opening the connections? One reason why I am hesitant to open them explicitly is because for one of our applications, we need to be able to dynamically switch from one variable to another at runtime. It would be nice to just switch the variable refnum (wired to the input of the Read function), without having to manually close out the old connection and open a new one. A quick prototype of this seems to work. But am I shooting myself in the foot by doing so?
    Thanks in advance.

    I'd expect there's a very small number of people at NI that would know the answer to the detail you're asking for.  But, let's try to extrapolate from this rather old post to see if we can understand what they're forming their impression on.
    The shared variable has to have some sort of reference going on in the background.  It looks like they're calling this a connection.  It's how LabVIEW knows where to find this variable on the network.  We can also see this reference certainly exists if we're opening/closing the reference in the explicit method.  You see the connection as just a string referencing the variable by URL.  This "reference" has to be stored somewhere.  No matter how we're looking at this, we're aware there's a reference of some sort stored. 
    Now, we'd want to look at what would cause this reference to go away.  If you open/close explicitly, it's easy to see it goes away at the close.  If it's implicit, when would it make sense to close it out?  The VI can't be expected to guess where it's done being referenced and close it out.  This puts us into a situation where the soonest it could close is when the VI ends.  From my experience, references tend to be wiped when you close out LabVIEW.  It's this kind of idea that makes the FGV possible.  I wouldn't be surprised by Morgan's claim here.
    If we look at scalability, you're talking about two different topics.  You're talking about adding an extra open, close, read, etc rather than just a few wires.  That certainly would look a mess.  In terms of the dynamic swap that was being discussed, we wouldn't be adding all of those.  The concern would be if enough connections were opened it'd start to behave similar to a memory leak.  This could be something that works with a smaller number of variables.  If you continue to scale, it becomes problematic.  This is why they suggest it's not scalable. 
    To your questions:
    Does LV allocate some kind of session in memory using that string as a lookup?
    It would HAVE to allocate some memory to hold that string.  Otherwise, it'd be pointless to even have the reference. 
    Does it reuse that session if other parts of the application reference the same variable, or does it create a unique session for each referencing call to "Read Variable.vi"?
    I would expect this to be "it depends."  With the implicit method, I would expect it to open a new reference in each point it isn't wired.  This is similar to int x,y = 5;  x and y share the same value but are their own unique memory location.  If you wire the reference to the other points, it should use the same reference.  This would make more sense to me than the program seeking out any other potential usage of the variable in the application to see if there's already a reference open.  I could be wrong, though.
    And what resources does this "connection" actually represent?
    At best, this is just the string.  At worst, it's the string and the TCP socket.  I'd lean towards the first.  Opening and closing sockets should be relatively easy in most applications.  But, it also wouldn't surprise me if it holds the socket.
    I'm sure others have a better understanding than I do.  But, that's what I'd expect for anything you've asked.

  • My wife and I share our Mac OS 10.6.8 since downloading Skype on her account she can not stay connected to any web site she pulls up. I removed Skype from here account but it stll happens. What can I do to clear this up?

    My wife and I share the same Mac OS 10.6.8 and since downloading Skype on her accout she came not asty connected to any web site for more than a few seconds. I have remove Skype from her account but not mine. I don't have the problem on my accout and I still have Skype loaded. How can I fix this problem?

    O.k. Thanks for the clarification. I poked around in my TimeCapsule router's settings (TimeCapsule is an Apple Airport Extreme router with attached hard drive for wireless backup/storage). Unfortunately, it doesn't look like I can disable multicasting with the TimeCapsule. I can change the multicasting 'rate'. Settings are Low, Medium, High. It's currently set to Low.
    I did a few web searches, and found an Apple.com article: <http://support.apple.com/kb/HT3789?viewlocale=en_US> which explained how to disable Bonjour Service Advertisements. I believe this is the same thing as 'Multicasting'. The process is a modification of "/System/Library/LaunchDaemons/com.apple.mDNSResponder.plist", and a restart of the Mac is required afterwards.
    I'm a bit concerned that disabling multicasting will interfere with my AppleTVs and iTunes music sharing, but I may try it next time I'm up for a computer workout. This task will require editing of system preference files, could require multiple restarts, might interfere with my AppleTVs, could interfere with my iTunes file sharing, doesn't have a documented relationship to my problem.
    This is way to difficult for something that should just work. Did you say you had read something about a relationship between this bonjour multicasting and smb connectivity? If it was online could you post the link?
    I'm currently able to connect to the drive using NFS, but I have to manually configure that connection each time I reboot (can't get the 'Disk Utility' configured to do it automatically). While it's working with NFS, it's not my preferred connect method (for various reasons).

  • Using HttpServletRequest object to share variables between static methods.

    Does anyone know of the overhead/performance implications of using the HttpServletRequest object to share variables between a static method and the calling code?
    First, let me explain why I am doing it.
    I have some pagination code that I would like to share across multiple servlets. So I pulled the pagination code out, and created a static method that these servlets could all use for their pagination.
    public class Pagination {
         public static void setPagination (HttpServletRequest request, Config conf, int totalRows) {
              int page = 0;
              if (request.getParameter("page") != null) {
                   page = new Integer(request.getParameter("page")).intValue();
              int articlesPerPage = conf.getArticlesPerPage();
              int pageBoundary = conf.getPageBoundary();
                int numOfPages = totalRows / articlesPerPage;  
                // Checks if the page variable is empty (not set)
                if (page == 0 || (page > numOfPages && (totalRows % articlesPerPage) == 0 && page < numOfPages + 1)) {    
                 page = 1;  // If it is empty, we're on page 1
              // Ex: (2 * 25) - 25 = 25 <- data starts at 25
             int startRow = page * articlesPerPage - (articlesPerPage);
             int endRow = startRow + (articlesPerPage);           
             // Set array of page numbers.
             int minDisplayPage = page - pageBoundary;
             if (minDisplayPage < 1) {
                  minDisplayPage = 1;     
             int maxDisplayPage = page + pageBoundary;
             if (maxDisplayPage > numOfPages) {
                  maxDisplayPage = numOfPages;     
             int arraySize = (maxDisplayPage - minDisplayPage) + 1;
             // Check if there is a remainder page (partially filled page).
             if ((totalRows % articlesPerPage) != 0) arraySize++;
             // Set array to correct size.
             int[] pages = new int[arraySize];
             // Fill the array.
             for (int i = 1; i <= pages.length; i++) {
                  pages[i - 1] = i;
             // Set pageNext and pagePrev variables.
             if (page != 1) {
                  int pagePrev = page - 1;
                  request.setAttribute("pagePrev", pagePrev);
             if ((totalRows - (articlesPerPage * page)) > 0) {
                 int pageNext = page + 1;
                 request.setAttribute("pageNext", pageNext);
             // These will be used by calling code for SQL query.
             request.setAttribute("startRow", startRow);
             request.setAttribute("endRow", endRow);
             // These will be used in JSP page.
             request.setAttribute("totalRows", totalRows);
             request.setAttribute("numOfPages", numOfPages);
             request.setAttribute("page", page);
             request.setAttribute("pages", pages);          
    }I need two parameters from this method (startrow and endrow) so I can perform my SQL queries. Since this is a multithreaded app, I do not want to use class variables that I will later retrieve through methods.
    So my solution was to just set the two parameters in the request and grab them later with the calling code like this:
    // Set pagination
    Pagination.setPagination(request, conf, tl.getTotalRows());
    // Grab variables set into request by static method
    int startRow = new Integer(request.getAttribute("startRow").toString());
    int endRow = new Integer(request.getAttribute("endRow").toString());
    // Use startRow and endRow for SQL query below...Does anyone see any problem with this from a resource/performance standpoint? Any idea on what the overhead is in using the HttpServletRequest object like this to pass variables around?
    Thanks for any thoughts.

    You could either
    - create instance vars in both controllers and set them accordingly to point to the same object (from the App Delegate) OR
    - create an instance variable on the App Delegate and access it from within the view controllers
    Hope this helps!

  • Firefox become in Offline mode and unable to open any page and when shut down it remains in processes and freez up, blocking another to be run

    When I on my Laptop, Acer Aspire 5735 with Windows 7 Ultimate run Firefox all runs perfectly smooth, all is working as expected, but when I go to Sleep mode or Hibernate (Firefox remains open) after turning on Firefox is not active any more, all open tabs are there but surfing is unavailable. Firefox reports message that it is in Offline mode (but menu File > Work Offline is not checked and if I check it and uncheck it again it doesn't have any impact). Which means If I open new tab and write web address it wont open, if I click any link in opened tabs from before, it wont open anything and it will show message that Firefox is in offline mode. After that I shut down Firefox by using Close(x) button and it disappears from desktop but it remains in memory and active processes not allowing any other instance of Firefox to be run. Finally I shut it down on force (End process) and start another instance and all works perfect. I am not sure is this only my problem with hardware/software configuration so I wanted to share this.

    This is a pain but I have resolved it. This is instructions for Windows 7 but it may be the same on other Operating systems.
    Note: "''YOUR USERNAME''" relates to the account you log on to Windows with.
    # First go to control '''panel / folder options''' and ''uncheck'' ''''Hide extensions for known file types'''', ''check'' ''''Show hidden files and folders'''' and ''check'' ''''Show hidden operating system files'''' then click ''apply'' and ''OK''.
    # Go here :''' C:\Users\"YOUR USERNAME"\AppData\Roaming\Mozilla\Firefox\''' and copy the '''Profiles''' folder to your desktop.
    # Go here : '''C:\Users\"YOUR USERNAME"\AppData\Local\Mozilla\Firefox\''' and copy the '''Profiles''' folder to your desktop. You will need to rename this as you already have a Profiles folder so name it '''Profiles2'''.
    # Uninstall Firefox (''selecting to remove all user settings'') then go here: '''C:\Program Files\''' and delete the ''Mozilla Firefox'' folder.
    # Go here : '''C:\Users\"YOUR USERNAME"\AppData\Roaming''' and delete the ''Mozilla'' folder
    # Go here: '''C:\Users\"YOUR USERNAME"\AppData\Local\ '''delete the ''Mozilla'' folder.
    # Open another browser (i.e.'' Internet Explorer'') and download and install ''C-Cleaner'' here: [http://www.piriform.com/ccleaner/download/standard]
    # Once installed run the ''''Registry cleaner'''' over and over until no problems are detected and exit the application. You may now uninstall it but it is probably one of the best free apps available as it has a better uninstaller than Windows does and controls which programs run when Windows starts without using the 'msconfig' command.
    # Now download the latest version of Firefox with your other browser and install it then run the application once and close it down.
    # Open the ''Profiles'' folder on your desktop and inside you will find one or more folders with a name ending in '''.default''' (i.e. ''uomifhku.default''). Right click each folder and select '''Properties''' to see which contains the highest amount of data or the bigger file size. Once you have done that open the largest folder and make sure there is nothing in there with '''... @security.compass''' written on it. If there is then delete it. Hold your ''left'' mouse button and move your mouse pointer over all of the files to highlight in blue. Put your mouse cursor on any one of the files, ''right click'' and select 'Copy' to copy them all to system memory and then close the folder.
    # Go here: '''C:\Users\"YOUR USERNAME"\AppData\Local\Mozilla\Firefox\Profiles''' and find the folder ending in '''.default''' then open it. Now ''right click'' anywhere on the background in the main Payne containing the files and select 'paste'. When prompted to '''Overwrite Files''' and '''Merge Folders''' always accept and proceed. Once done, close the window.
    # Open the '''Profiles2''' folder on your desktop and inside you will find one or more folders with a name ending in '''.default''' (i.e. ''uomifhku.default''). Right click each folder and select '''Properties''' to see which contains the highest amount of data or the bigger file size. Once you have done that open the largest folder and make sure there is nothing in there with '''... @security.compass''' written on it. If there is then delete it. Hold your'' left'' mouse button and move your mouse pointer over all of the files to highlight in blue. Put your mouse cursor on any one of the files, ''right click'' and select '''Copy''' to copy them all to system memory and then close the folder.
    # Go here : '''C:\Users\"YOUR USERNAME"\AppData\Roaming\Mozilla\Firefox\Profiles''' and find the folder ending in '''.default''' then open it. Now right click anywhere on the background in the main Payne containing the files and select '''paste'''. When prompted to '''Overwrite Files''' and '''Merge Folders''' always accept and proceed. Once done, close the window.
    Start Firefox and if all is well you should be working again and it back in the state you left it last without the bug.
    Many thanks, sparkyuiop

  • Active Directory and Windows Share

    I have several Mac labs that are working perfecting with the Active Directory client in OS X 10.4.9. I recently made a change to the client and am now creating local home folders for users. Using the network home folders slowed the boot process and affected certain applications when pref files were not deleted properly from the Windows share.
    What I would like to do now is have 2 or 3 windows shares mounted automatically for ALL users who log into a computer. Ideally the mounts should be done with the username and password of the user who just authenticated.
    Does anyone have any suggestions on how this could be accomplished?
    Thank you.

    This should be possible using Mac OS X Server in a Golden (or Magic) Triangle scenario with your Active Directory network. This means your Macs would use AD for authentication but your Mac OS X Server would control workstation settings such as auto-mounting drives. The settings could be applied to users and groups from Active Directory.
    Hope this helps! bill
    1 GHz Powerbook G4   Mac OS X (10.4.9)  

  • Creating a Web Service to handle flow between BPEL process and XML Gateway

    I am new to Web Services. I have never created one, yet I have the task of designing the following for a project.
    Any help as to what steps I need to take would be very very helpful. There is a lot of information on XML, SOA and WSDL out there that it can get very confusing, and sometimes you just need someone to point the way
    What I need to do is create a Custom Send and a Custom Receive Program (both web services) handle the message flow between an Enterprise BPEL processes and a Deployed XML Gateway.
    BPEL compresses this XML business object document (for faster transmission), and sends remotely to this Custom Receive web service, which in turn calls a decompress java program and then send the document to the XML gateway inbound web service.
    The Custom Send web service does just the opposite. It needs to take the business object document from XML gateway, call the compress java program and then send to the Enterprise BPEL.
    In a nutshell...these Custom Send/Receive Web services handle the message flow between the Enterprise BPEL process and the Deployed XML Gateway.
    What I need help on...
    -Creating this in JDeveloper- where do I get started?
    -How does a web service receive a compressed file sent to me via BPEL? Does it just sit there waiting for it?
    -Is this a synchronous or asynchronous design?
    -Will this be 2 web services (Send and Receive) or do I make 1 with 2 functionalities
    -How do I call the java compress/decompress program within the web service? (this java function is already created and ready to be called)
    -Is this decompressed business object file an XML schema and an XML message? Or just a message?
    -I need to send this to the XML Gateway Web Service to load. How does that work?
    -I have a Generic XML Gateway WSDL file...I assume I need to take all the info I get and map it to this template? Is this true? How do I do that?
    Like I said, any help would be appreciated. Links answers to my many questions would be fabulous.
    -Jason

    If you are talking about simple XML transformation of the SOAP payload between the client calling your service and the final destination of the message you are routing, the ESB approach may be a better fit.
    If you have more complex transformation in mind, with major processing and rework of the message in the intermediary, you may be better of with using the POJO approach. Write your service and embed a callout to the other service in your implementation. If the two services share the same Java Model, you may even be able to re-use the same Java Bean.
    To get SOAP Element instead of Java bean, you just need to use the noDataBinding option with either genProxy and topDownAssemble (or assemble). See the WS-Guide [1] for details. Chapter 18 will give you all the details about the different WSA command line parameters.
    Hope this helps,
    -Eric
    [1] http://download-west.oracle.com/docs/cd/B31017_01/web.1013/b28974/toc.htm

  • Slow processing and getting opening errors/warnings

    I've modified the PDF Binder sample to get a plugin that would open PDF's and Tif files, and save them as PDF/A-1b (code below).
    It's working. The problem: it's processing too slow (compared with the Actions batch processing)... and I've been getting warnings/and errors about "The imput file is corrupt or of an unknown/unsupported type" type. This is stopping my batch process until I click OK, and the it continues.
    I am trying to process a few thousand of tif files now. I tried first to use the Batch processing capability built in the Acrobat X... an it works, but only with the first 255 documents in the folder... then gives an "insufficient disk space" message for the rest of the files in the directory.
    So, 2 questions: Does anyone knows why it is so slow processing the tiff files and... how I can make my code "silent" so it does not wait for the OK after the message??
    Thanks in advance.
    The code:
    ADOBE SYSTEMS INCORPORATED
    Copyright (C) 1998-2006 Adobe Systems Incorporated
    All rights reserved.
    NOTICE: Adobe permits you to use, modify, and distribute this file
    in accordance with the terms of the Adobe license agreement
    accompanying it. If you have received this file from a source other
    than Adobe, then your use, modification, or distribution of it
    requires the prior written permission of Adobe.
      \file PDFBinder.cpp
    - Implements a method to convert multiple files into PDFs and bind the PDFs
    into one PDF file. The code shows how to use AVConversionToPDFHandler to
    convert files to PDF and how to use PDDocInsertPages() to combind PDF files.
    // Headers.
    #include <stdio.h>
    #include <ctype.h>
    #ifndef MAC_PLATFORM
    #include <direct.h>
    #include "PIHeaders.h"
    #endif
    // Defines ----------
    // Define this flag to show AVConversionToPDFEnumHandler info. in log file.
    #define SHOW_TOPDF_HANDLER_TYPES   
    // define this flag to use file type filter 
    #define USE_FILE_FILTER   
        Constants/Declarations
    // Message display control.  Ture: display
    ASBool bEcho = true;
    // File location. User can change the following filenames.
    #if WIN_PLATFORM
        const char* STRING_PDFBinderFolder = "C:\\Fairfax\\Adobe\\in";
        const char* STRING_PDFOutputFolder = "C:\\Fairfax\\Adobe\\PDFA";
        const char* FOLDERSYMBOL="\\";
    #endif
    #if MAC_PLATFORM
        const char* STRING_PDFBinderFolder = "/PDFBinder";
        const char* FOLDERSYMBOL="/";
    #endif
    char* OutputPdfFileName = "PDFBinderOutput.pdf";
    char* LogFileName = "PDFProcessLog.txt";
    static ASInt32 gNumToPDFExt;
    static ASInt32 gNumFromPDFExt;
    static AVConversionFromPDFHandler RightHandler;
    const int MAX_FILENAME_LENGTH = 256;
    char sLogFileName[MAX_FILENAME_LENGTH];
    // Filter -----------
    // Filter is a list of file types which can be converted to PDF in this program.
    // Use a filter may fit user's specific needs and ensure a smooth automation process.
    // Of course, the user can turn off the filter in two ways:
    //   (1) gPDFBinderFileFilter = "";
    //   (2) comment out //USE_FILE_FILTER 
    // The filter should be consistent with the Acrobat viewer's menu capability:
    //   Create PDF from multiple files ...
    // Here we put the types which have been tested, but user can expand it.
    const char* gPDFBinderFileFilter = "pdf,tif,tiff,PDF,TIF,TIFF";
    const int MAX_STRING_LENGTH = 2048;
    AVConversionToPDFHandler gHandler;
    // functions in this file.
    int    ConvertAndInsertFileToPDF(ASPathName aspItem, char* aFileName, PDDoc  PDFfile);
    void BindingFileToPDF(ASPathName aPathName, char* aFilename, ASFileSysItemPropsRec nFileAttrb, PDDoc targetPDdDoc, ASPathName outputPathName, int *ipTotal, int *ipConverted);
    ASBool PassPDFBinderFileFilter(char* filename);
    int    ConvertAndSavePDFInTargetFolder(ASPathName aPathName, char* aFileName, PDDoc PDFfile, ASPathName outputPathName);
    char* NewFileName(char *& aFileName);
    // callbacks
    ACCB1 ASBool ACCB2 MyAVConversionToPDFEnumProc(AVConversionToPDFHandler handler, AVConversionEnumProcData data);
    ACCB1 ASBool ACCB2 AVConversionToPDFEnumFindHandler(AVConversionToPDFHandler handler, AVConversionEnumProcData data);
    static ACCB1 ASBool ACCB2 myAVConversionFromPDFEnumProc(AVConversionFromPDFHandler handler, AVConversionEnumProcData data);
        Implementation
    /**    This sample implements a method to convert multiple files into PDF
      and bind the PDFs into one PDF file .
        This sample shows developers how to grammatically implement To-PDF file
      converson functionality.  Basically, the code uses AVConversionToPDFHandler
      to convert files to PDF and PDDocInsertPages()to combine PDF files.
      This plug-in is designed to run from a menu item, and by setting bEcho = false
      it may be run without any graphics user interface on the screen. Therefore, it 
      can be executed from other programs such as C IAC, VB IAC, and JavaScript
      to meet enterprise workflow needs.
        How to run it :
        - This sample adds a menu item "PDF Binder" under the Acrobat SDK submenu. Two ways to
        execute it: 1) click the menu item to run the program using a fixed file location
        hard coded; 2) press the shift key and click the menu item to choose a folder where
        files to be converted are located.
        - Without folder selection, this original code is to convert and bind files in a
        directory    C\test\PDFBinder for Win, or a folder   MacHD:test:PDFBinder for Mac.
        You can copy the test files in the project's testfiles folder to the appropriate location 
        for testing. You may locate files to be converted in another directory/folder, and
        specify the location in the string variable PDFBinderFolder in the code.
        - When you have the files to be converted ready in the specified location,
        run Acrobat 6 menu Advanced->AcrobatSDK->PDF Binder to start the operation.  There are
        echo messages informing you of the operation start and end, but you can change and
        rebuild the code to turn off the display on screen.
        - An output file PDFBinderOutput.pdf in the same location is created
        when the program succeeds. A text log file  PDFBinderLog.txt in the same
        location records the process and results.
        -  You can set bEch = false in the code to turn off any display on the screen.
        This is necessary when you  call the menu function from within other programs
        of C IAC, VB IAC, JavaScript. 
        -  An optional file filter is used to pre-process the files. The filter only allows
        the files with predefined types to be processed. You can change the file type list
        as you wish. Using a filter may ensure a smooth automation process, since you can put
        only well-tested file types in the filter. To turn off the filter, you can set
        gPDFBinderFileFilter = "" or not to define USE_FILE_FILTER 
        - Note this is a sample only, developers need to make further improvement for
        their actual use. For example, you can set up a list of files to use the method for
        the conversion and binding. And you can add code to handle special file types.
          @see AVConversionConvertToPDFWithHandler
        @see AVConversionEnumToPDFConverters
        @see ASFileSysDestroyFolderIterator
        @see PDDocOpen
        @see PDDocClose
        @see PDDocInsertPages
        @see PDDocCreatePage
        @see PDDocDeletePages
        @see PDPageRelease
        @see ASFileSysCreatePathName
        @see ASFileSysFirstFolderItem
        @see ASFileSysNextFolderItem
        @see ASFileSysGetNameFromPath
        @see ASFileSysReleasePath
    ACCB1 void ACCB2 PDFBinderCommand(void*)
        // if the menu item clicked with Shift key pressed down, go to interactive mode.
        // let the user to choose a folder and process all the file in the folder.
        ASText dispText = ASTextNew();
        char PDFBinderFolder[MAX_STRING_LENGTH];
        ASBool shiftKeyIsDown = ((AVSysGetModifiers() & AV_SHIFT) != 0);
        if(shiftKeyIsDown) {
            AVOpenSaveDialogParamsRec dialogParams;
            // Configure the dialog box parameters.
            memset (&dialogParams, 0, sizeof (AVOpenSaveDialogParamsRec));
            dialogParams.size = sizeof(AVOpenSaveDialogParamsRec);
            dialogParams.windowTitle = ASTextFromScriptText("Choose folder with files to bind",kASRomanScript);
            dialogParams.flags |= kAVOpenSaveAllowForeignFileSystems;
            dialogParams.initialFileSys = ASGetDefaultUnicodeFileSys();
            ASPathName thePath;
            ASFileSys fileSys;
            AVAppBeginModal(NULL);
            if(ASBoolToBool(AVAppChooseFolderDialog(&dialogParams, &fileSys, &thePath)) != true){
                AVAppEndModal();
                //AVAlertNote("Failed to select the folder");
                return;
            AVAppEndModal();
    #ifdef WIN_PLATFORM       
            ASFileSysDisplayASTextFromPath(ASGetDefaultUnicodeFileSys(), thePath, dispText);
            ASHostEncoding bestEnc = ASTextGetBestEncoding(dispText, (ASHostEncoding)PDGetHostEncoding());
            strncpy(PDFBinderFolder, ASTextGetEncoded(dispText, bestEnc), MAX_STRING_LENGTH - 1);
    #else       
            ASPlatformPath aspPath;
            ASFileSysAcquirePlatformPath(fileSys, thePath, ASAtomFromString("POSIXPath"), &aspPath);
            strncpy(PDFBinderFolder, (char *)ASPlatformPathGetPOSIXPathPtr(aspPath), MAX_STRING_LENGTH - 1);
            ASFileSysReleasePlatformPath(fileSys, aspPath);
            // remove extra path separator
            char e = PDFBinderFolder[strlen(PDFBinderFolder)-1];
            if(e == ':' || e == '/')
                PDFBinderFolder[strlen(PDFBinderFolder)-1]='\0';
            dispText = ASTextFromScriptText(PDFBinderFolder, kASEUnicodeScript);
    #endif
            ASFileSysReleasePath(fileSys, thePath);
        // Otherwise, the hard coded file path will be used.
        else {
            strcpy(PDFBinderFolder, STRING_PDFBinderFolder);
            dispText = ASTextFromScriptText(PDFBinderFolder, kASRomanScript);
        // instruction message
        char strMsg[MAX_STRING_LENGTH] = "";
        sprintf(strMsg, "This function will convert and process Tiff and PDF files in the selected directory. ");
        strcat(strMsg, " You need to copy your files in C:\\Fairfax\\Adobe\\in directory." );
        strcat(strMsg, " Files will be processed into C:\\Fairfax\\Adobe\\PDFA directory." );
        strcat(strMsg, " If you are ready, click OK to continue, or click Cancel to quit. " );
        strcat(strMsg, " \nNote you can press down Shift key and click the menu item to have a folder selection. " );
        strcat(strMsg, " \nNote you can turn off the echo message by setting bEcho = false and rebuild the code. " );
        if(ASBoolToBool(bEcho)==true){
            ASInt32 choice = AVAlert(ALERT_CAUTION, strMsg, "OK", "Cancel", NULL, true);
            if(choice==2) {
                return;
        // create a new target pdf file with one empty page
        PDDoc TargetPDF = PDDocCreate();
        ASFixedRect mediaBox = { fixedZero, ASInt32ToFixed(792), ASInt32ToFixed(612), fixedZero };
        PDPage emptyPage = PDDocCreatePage (TargetPDF, PDBeforeFirstPage, mediaBox);
        PDPageRelease (emptyPage);
        //     get available headlers and set our file filter
        char ValidExt[MAX_STRING_LENGTH];
        memset(ValidExt, 0, MAX_STRING_LENGTH);
    #ifdef SHOW_TOPDF_HANDLER_TYPES   
        // enumerate AVConversioToPDF handlers to get all available file
        // types which can be converted to PDF.
        AVConversionEnumToPDFConverters(MyAVConversionToPDFEnumProc, (AVConversionEnumProcData) ValidExt);
        //AVAlertNote("Converters Defined");
        //AVAlertNote(ValidExt);
        //AVAlertNote(gPDFBinderFileFilter);
    #endif
    #ifdef USE_FILE_FILTER    
        // set File filter
        strcpy(ValidExt, gPDFBinderFileFilter);
        //AVAlertNote(ValidExt);
    #endif
        // process all files in the directory
        int iNumFiles = 0;
        int iNumFilesConverted = 0;
        char* Done = "Converted";
        char* NotDone = " - ";
        char fileName[MAX_FILENAME_LENGTH+1];
        ASFileSysItemPropsRec props;
        ASFolderIterator iter;
        ASPathName aspItem = NULL;
        memset(&props, 0, sizeof(props));
        props.size = sizeof(props);
        //AVAlertNote("Props Defined");
        ASPathName theFolder = NULL;
        ASFileSys fileSys = NULL;
        DURING
    #ifdef WIN_PLATFORM   
        fileSys = ASGetDefaultFileSysForPath(ASAtomFromString("ASTextPath"), dispText);
        theFolder = ASFileSysCreatePathName (fileSys, ASAtomFromString("ASTextPath"), dispText, 0);
        //AVAlertNote("FileSys and Folder Defined");
    #else
        fileSys = ASGetDefaultFileSysForPath(ASAtomFromString("POSIXPath"), PDFBinderFolder);
        theFolder = ASFileSysCreatePathName (fileSys,
                                ASAtomFromString("POSIXPath"), PDFBinderFolder, 0);
    #endif
        if (theFolder==NULL) {
            //AVAlertNote("Fail to create ASPathName for the selected folder.");
            E_RTRN_VOID
        // Find first file in current directory
        if((iter = ASFileSysFirstFolderItem(fileSys, theFolder, &props, &aspItem))==FALSE) {
            //AVAlertNote("This is either an invalid folder or the folder contains no files.");
            E_RTRN_VOID
        ASFileSysReleasePath(fileSys, theFolder);
        //AVAlertNote("Folder Released");
        // get filename only
        if(ASFileSysGetNameFromPath(fileSys, aspItem, fileName, sizeof(fileName))) {
            E_RTRN_VOID
        HANDLER   
            // exception handling
            char errorMsg[256];
            ASGetErrorString (ASGetExceptionErrorCode(), errorMsg, 256);
            if(aspItem!=NULL) ASFileSysReleasePath(fileSys, aspItem);
            if(theFolder!=NULL) ASFileSysReleasePath(fileSys, theFolder);
            // display an error message.
            if(ASBoolToBool(bEcho)==true) {
                AVAlertNote (errorMsg);
            return;
        END_HANDLER
        //AVAlertNote(fileName);
        // go to binding if it's a valid type of file
        if(props.type == kASFileSysFile && PassPDFBinderFileFilter(fileName)) {
            char outFileName[] = "";
            //strcat(outFileName, STRING_PDFOutputFolder);
            //strcat(outFileName, FOLDERSYMBOL);
            //strcat(outFileName, fileName);
            strcat(outFileName, STRING_PDFOutputFolder);
            strcat(outFileName, FOLDERSYMBOL);
            strcat(outFileName, fileName);
            //AVAlertNote(outFileName);
            ASPathName outputFileName = ASFileSysCreatePathName (ASGetDefaultFileSys(), ASAtomFromString("Cstring"), outFileName, 0);
            BindingFileToPDF(aspItem, fileName, props, TargetPDF, outputFileName ,&iNumFiles, &iNumFilesConverted);
            //AVAlertNote("File Processed");
        ASFileSysReleasePath(fileSys, aspItem);
        // process all other files 
        while(ASFileSysNextFolderItem(fileSys, iter, &props, &aspItem)) {
            // get filename only
            if(ASFileSysGetNameFromPath(fileSys, aspItem, fileName, sizeof(fileName))) {
                return;
            // go to binding if it's a valid type of file
            if(props.type == kASFileSysFile && PassPDFBinderFileFilter(fileName))  {
                char outFileName[] = "";
                //strcat(outFileName, STRING_PDFOutputFolder);
                //strcat(outFileName, FOLDERSYMBOL);
                //strcat(outFileName, fileName);
                strcat(outFileName, STRING_PDFOutputFolder);
                strcat(outFileName, FOLDERSYMBOL);
                strcat(outFileName, fileName);
                //AVAlertNote(outFileName);
                ASPathName outputFileName = ASFileSysCreatePathName (ASGetDefaultFileSys(), ASAtomFromString("Cstring"), outFileName, 0);
                BindingFileToPDF(aspItem, fileName, props, TargetPDF, outputFileName, &iNumFiles, &iNumFilesConverted);
                //AVAlertNote("File Processed");
            ASFileSysReleasePath(fileSys, aspItem);
        ASPathName pdfPathName = NULL;
        DURING
        // close the findfile
        ASFileSysDestroyFolderIterator(fileSys, iter);
        // save and close the output pdf file
        // create path
        ASText pathText = ASTextNew();
        ASTextCatMany(
            pathText,
            dispText,
            ASTextFromScriptText(FOLDERSYMBOL, kASRomanScript),
            ASTextFromScriptText(OutputPdfFileName, kASRomanScript),
            NULL);
    #ifdef WIN_PLATFORM
        ASFileSys fileSys = ASGetDefaultFileSysForPath(ASAtomFromString("ASTextPath"), pathText);
        pdfPathName = ASFileSysCreatePathName (fileSys,
                                ASAtomFromString("ASTextPath"), pathText, 0);
    #else
        char path[MAX_STRING_LENGTH];
        strncpy(path, ASTextGetEncoded(pathText,
            ASTextGetBestEncoding(pathText, (ASHostEncoding)PDGetHostEncoding())), MAX_STRING_LENGTH - 1);
        ASFileSys fileSys = ASGetDefaultFileSysForPath(ASAtomFromString("POSIXPath"), path);
        pdfPathName = ASFileSysCreatePathName (fileSys,
                                ASAtomFromString("POSIXPath"), path, 0);   
    #endif
        if(pdfPathName==NULL) {
            E_RTRN_VOID
        // delete the empty page
        if(PDDocGetNumPages(TargetPDF)>1) {
            PDDocDeletePages (TargetPDF, 0,0,NULL, NULL);
        // save
        //PDDocSave (TargetPDF, PDSaveFull | PDSaveCollectGarbage | PDSaveLinearized,
        //            pdfPathName, ASGetDefaultUnicodeFileSys(),    NULL, NULL);
        PDDocClose (TargetPDF);
        //ASFileSysReleasePath(fileSys, pdfPathName);
        HANDLER   
            // exception handling
            char errorMsg[256];
            ASGetErrorString (ASGetExceptionErrorCode(), errorMsg, 256);
            if(pdfPathName!=NULL) ASFileSysReleasePath(fileSys, pdfPathName);
            // display an error message.
            if(ASBoolToBool(bEcho)==true) {
                AVAlertNote (errorMsg);
            return;
        END_HANDLER
        // use this line to show the massage on screen if you need
        //if(ASBoolToBool(bEcho)==true) {
        AVAlertNote ("Folder Completed. PDF/A Output files generated.");
        return;
    /* ConvertAndInsertFileToPDF
    /** Internal function \n
    ** Convert a file to PDF, then insert it to target PDF file.
    ** @param aFileName IN  char string, filename.
    ** @param PDFfile IN/OUT PDDoc of the target PDF file.
    ** @return 0 if OK, 1 if failed.
    int    ConvertAndInsertFileToPDF(ASPathName aPathName, char* aFileName, PDDoc PDFfile)
        PDDoc tempPDF;
        char* Ext;
        DURING
            // get file extention
            Ext = strrchr(aFileName,'.');
            if(Ext) {
                Ext++;
            else {
                E_RETURN (1);
            // if the file is PDF, open PDDoc
            if(strcmp(Ext,"PDF")==0 || strcmp(Ext,"pdf")==0) {
                tempPDF = PDDocOpen (aPathName, ASGetDefaultFileSys(), NULL, true);
                if(tempPDF==NULL) {
                    PDDocClose(tempPDF);
                    E_RETURN (1);
            // else convert it to PDF
            else
                // let it automatically find right handler for the file and do the job.
                AVConversionStatus stat = AVConversionConvertToPDF
                    (kAVConversionAsyncOkay, //kAVConversionNoFlags
                      aPathName, ASGetDefaultFileSys(), &tempPDF, NULL);
                // check if successful
                if(stat != kAVConversionSuccess) {
                    //AVAlertNote("Cannot convert the file.");
                    E_RETURN (1);
        HANDLER   
            // exception handling
            char errorMsg[256];
            ASGetErrorString (ASGetExceptionErrorCode(), errorMsg, 256);
            // display an error message.
            if(ASBoolToBool(bEcho) == true) {
                AVAlertNote (errorMsg);
            return 1;
        END_HANDLER
        // insert new PDF into target PDF
        DURING
            // insert all pages of new pdfc to TargetPDFfile.
            PDDocInsertPages(PDFfile, PDLastPage, tempPDF, 0,
                            PDAllPages, PDInsertAll, NULL, NULL, NULL, NULL);
            PDDocClose(tempPDF);
        HANDLER
             char errorMsg[256];
            ASGetErrorString (ASGetExceptionErrorCode(), errorMsg, 256);
            if(ASBoolToBool(bEcho)==true) {
                AVAlertNote(errorMsg);
        END_HANDLER
            if(strcmp(Ext,"doc")==0) {
                char fname[40];
                sprintf(fname,"%s.pdf",aFileName);
                remove(fname);
            return 0;
    /* MyAVConversionToPDFEnumProc
    /** Internal callback function \n
    ** called for every AVConversionToPDFHandler.
    ** get the valid type (file extention) for the conversion. 
    ** @return true.
    ACCB1 ASBool ACCB2 MyAVConversionToPDFEnumProc(AVConversionToPDFHandler handler,
                                                 AVConversionEnumProcData data)
        ASUns16 numFileExt = handler->convFilter.numFileDescs;
        for (int i = 0; i < numFileExt; i++) {
            char* ext = handler->convFilter.fileDescs[i].extension;
            if(strlen(ext)>0) {
                strcat((char*) data, ext);
                strcat((char*) data, ",");
        return true;
    /* this is alternative code to get right conversion handler for a specific file
       to be converted. It works with function AVConversionConvertToPDFWithHandler.
       It's not used now, but kept for user's reference.
    ACCB1 ASBool ACCB2 AVConversionToPDFEnumFindHandler(AVConversionToPDFHandler handler,
                                                 AVConversionEnumProcData data)
        ASUns16 numFileExt = handler->convFilter.numFileDescs;
        for ( int i = 0; i < numFileExt; i++)
            char* ext = handler->convFilter.fileDescs[i].extension;
            if(strlen(ext)) {
                if(!strcmp((char*) data, ext)) {
                    gHandler = handler;
                    return false;
        return true;
    /* BindingFileToPDF
    /** Internal callback function for binding process \n
    ** IN: char* aFilename, ASFileSysItemPropsRec nFileAttrb \n
    **     PDDoc targetPDdDoc, int *ipTotal, \n
    **     int *ipConverted, FILE *logfile \n
    ** OUT: int *ipTotal, int *ipConverted. \n
    void BindingFileToPDF(ASPathName aPathName, char* aFilename, ASFileSysItemPropsRec nFileAttrb, PDDoc targetPDdDoc, ASPathName outputPathName, int *ipTotal, int *ipConverted)
        // ignore system, hidden files, and our target PDF and log file.
        if( nFileAttrb.isHidden 
            || (strcmp(aFilename,".")==0) || (strcmp(aFilename,".." )==0)
            || (strcmp(aFilename,OutputPdfFileName)==0) || (strcmp(aFilename,LogFileName)==0)) {
                return;
        (*ipTotal)++;
        char msg[MAX_STRING_LENGTH] = "";
        char* Done = "Converted";
        char* NotDone = " - ";
        // try to convert and insert it to target PDF file.
        // rc would be 0 for success, otherwise 1.
        int rc = ConvertAndSavePDFInTargetFolder(aPathName, aFilename, targetPDdDoc, outputPathName);
        // if converted
        if(rc==0) {
            (*ipConverted)++;
    /* PassPDFBinderFileFilter
    /** Internal callback function for binding process
    ** @return true if the IN aFilename is a valid file for PDF conversion,
    ** otherwise false.
    ASBool PassPDFBinderFileFilter(char* aFilename)
    #ifdef USE_FILE_FILTER
        // if the filter is empty, any file will pass.
        if(strlen(gPDFBinderFileFilter)==0)
            return true;
        char* Ext = strrchr(aFilename,'.');
        if(Ext!=NULL) {
            Ext++;
            if(strstr(gPDFBinderFileFilter, Ext)) {
                return true;
        return false;
    #else
            // not use filter, any file will pass.
            return true;
    #endif
    /* ConvertAndInsertFileToPDF
    /** Internal function \n
    ** Convert a file to PDF, then insert it to target PDF file.
    ** @param aFileName IN  char string, filename.
    ** @param PDFfile IN/OUT PDDoc of the target PDF file.
    ** @return 0 if OK, 1 if failed.
    int    ConvertAndSavePDFInTargetFolder(ASPathName aPathName, char* aFileName, PDDoc PDFfile, ASPathName outputPathName)
        PDDoc tempPDF;
        char* Ext;
        DURING
            // get file extention
            Ext = strrchr(aFileName,'.');
            if(Ext) {
                Ext++;
            else {
                E_RETURN (1);
            // if the file is PDF, open PDDoc
            if(strcmp(Ext,"PDF")==0 || strcmp(Ext,"pdf")==0) {
                tempPDF = PDDocOpen (aPathName, ASGetDefaultFileSys(), NULL, true);
                if(tempPDF==NULL) {
                    PDDocClose(tempPDF);
                    E_RETURN (1);
            // else convert it to PDF
            else
                // let it automatically find right handler for the file and do the job.
                AVConversionStatus stat = AVConversionConvertToPDF
                    (kAVConversionAsyncOkay, //kAVConversionNoFlags
                      aPathName, ASGetDefaultFileSys(), &tempPDF, NULL);
                // check if successful
                if(stat != kAVConversionSuccess) {
                    //AVAlertNote("Cannot convert the file.");
                    E_RETURN (1);
                else {
                    //change Extension
                    ASText asTmp = ASTextNew();
                    ASFileSysDisplayASTextFromPath(ASGetDefaultUnicodeFileSys(), outputPathName, asTmp);
                    //AVAlertNote(ASTextGetScriptText(asTmp, kASRomanScript));
                    if(strcmp(Ext,"TIF")==0 || strcmp(Ext,"tif")==0){
                        ASTextReplace(asTmp, ASTextFromScriptText(".tif", kASRomanScript), ASTextFromScriptText(".pdf", kASRomanScript));
                    } else {
                        ASTextReplace(asTmp, ASTextFromScriptText(".tiff", kASRomanScript), ASTextFromScriptText(".pdf", kASRomanScript));
                    //AVAlertNote(ASTextGetScriptText(asTmp, kASRomanScript));
                    outputPathName = ASFileSysCreatePathName (ASGetDefaultUnicodeFileSys(), ASAtomFromString("ASTextPath"), asTmp, 0);
        HANDLER   
            // exception handling
            char errorMsg[256];
            ASGetErrorString (ASGetExceptionErrorCode(), errorMsg, 256);
            // display an error message.
            if(ASBoolToBool(bEcho) == true) {
                AVAlertNote (errorMsg);
            return 1;
        END_HANDLER
        // Run OCR and Save new PDF into target PDF
        DURING
            //    OCR
            ASAtom cmdName;
            AVCommand cmd;
            cmdName=ASAtomFromString("PaperCapture");
            cmd=AVCommandNew(cmdName);
            ASCab config = ASCabNew();
            ASCabPutInt (config, "UIPolicy", kAVCommandUISilent);       //hide the interface
            if (kAVCommandReady ==     AVCommandSetConfig (cmd, config)) {
                //AVAlertNote("Config Ready");
            ASCab inputs = ASCabNew();
            ASCabPutPointer (inputs, kAVCommandKeyPDDoc, PDDoc, tempPDF, NULL);
            if (kAVCommandReady == AVCommandSetInputs (cmd, inputs)) {
                //AVAlertNote("Input Ready");
            ASCabDestroy (inputs);
            AVCommandStatus status = AVCommandExecute(cmd);
                        //switch (status) {
                        //    case kAVCommandReady :
                        //        AVAlertNote("Not working, but ready to work.");
                        //        break;
                        //    case kAVCommandWorking :
                        //        AVAlertNote("Still working");
                        //        break;   
                        //    case kAVCommandDone :
                        //        AVAlertNote("Done working");
                        //        break;   
                        //    case kAVCommandInError :
                        //        AVAlertNote("In Error");
                        //        break;       
                        //    case kAVCommandNotExecuted :
                        //        AVAlertNote("Command not executed due to lack of objects on which the command to be executed");
                        //        break;
            AVCommandDestroy(cmd);
            //Save
            //PDDocSave (tempPDF, PDSaveFull | PDSaveCollectGarbage | PDSaveLinearized, outputPathName, ASGetDefaultUnicodeFileSys(),    NULL, NULL);
            //ClosePDF
            //PDDocClose(tempPDF);
            //Convert to PDF/A Compliance
            //Select the right handler
            AVConversionEnumFromPDFConverters(myAVConversionFromPDFEnumProc, NULL);
            // do conversion
            AVConversionStatus stat = AVConversionConvertFromPDFWithHandler(RightHandler, NULL, kAVConversionAsyncOkay, tempPDF, outputPathName,  ASGetDefaultFileSys(), NULL);
            // check the returned status and show message
            //if (stat == kAVConversionSuccess)
            //                AVAlertNote( "The PDF/A file was saved in output folder." );
            //else if (stat == kAVConversionFailed)
            //                AVAlertNote( "The PDF/A conversion failed." );
            //else if (stat == kAVConversionSuccessAsync)
            //                AVAlertNote( "The conversion will continue asynchronously." );
            //else if (stat == kAVConversionCancelled)
            //                AVAlertNote( "The conversion was cancelled." );
            //Save
            //PDDocSave (tempPDF, PDSaveFull | PDSaveCollectGarbage | PDSaveLinearized, outputPathName, ASGetDefaultUnicodeFileSys(), NULL, NULL);
            //ClosePDF
            PDDocClose(tempPDF);
            ASFileSysReleasePath(ASGetDefaultFileSys(), outputPathName);
        HANDLER
             char errorMsg[256];
            ASGetErrorString (ASGetExceptionErrorCode(), errorMsg, 256);
            if(ASBoolToBool(bEcho)==true) {
                AVAlertNote(errorMsg);
        END_HANDLER
            if(strcmp(Ext,"doc")==0) {
                char fname[40];
                sprintf(fname,"%s.pdf",aFileName);
                remove(fname);
            return 0;
    //Select the appropiate handler for the PDF/A conversion
    static ACCB1 ASBool ACCB2 myAVConversionFromPDFEnumProc(AVConversionFromPDFHandler handler, AVConversionEnumProcData data)
        AVFileFilterRec filter = handler->convFilter;
        ASUns16 numFileExt = filter.numFileDescs;
        char *kUniqueID = handler->uniqueID;
        // go through the conversion handlers to find a handler for PDF extension files and the unique key matches the PDF/A one.
        for  (ASInt32  i = 0; i < numFileExt; i++)
            if  (strlen(handler->convFilter.fileDescs[i].extension)>0)
                // found it, fill in the handler and return false to stop going on.
                if (!strcmp(handler->convFilter.fileDescs[i].extension, "pdf") && !strcmp(kUniqueID,"com.callas.preflight.pdfa")) {
                    RightHandler = handler;
                    return  false ;
        return true;

    There are some options for various APIs to run "kinda silent" - but again, Acrobat is designed for INTERACTIVE use…so "completely silent" isn't really an option.
    As for speed – you'd need to be MUCH MORE specific about where your slow downs are.  Have you profiled?
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Mon, 12 Dec 2011 07:39:08 -0800
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: Slow processing and getting opening errors/warnings
    Re: Slow processing and getting opening errors/warnings
    created by FFX-ER<http://forums.adobe.com/people/FFX-ER> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/4079175#4079175

  • Calling stored procedure from page process and PLS-00049 error?

    Good morning guys!
    I'm dealing with several problems this morning! The one that I need to deal with first is the following.
    I created the page process (see below: 1st code) in order to validate if all records where LNG_GEBIET matches have the status 3 or 4. If that is the case I want to call the procedure "set_status_arbeit_zu_gebiet". If amountrs and countstat do not match, then nothing is supposed to be done.
    The problem lies within the stored procedure itself. I receive a PLS-00049 bind variable error for :new.LNG_GEBIET.
    Can you please tell me what I forgot to declare in code 2 below???
    Thank you guys!
    The page process:
    Declare
      amountrs    number;
      countstat   number;
    begin
    SELECT COUNT(*) INTO amountrs FROM TBL_PUNKTDATEN where LNG_GEBIET = :P4_CNT_GEBIET;
    SELECT COUNT(*) INTO countstat FROM TBL_PUNKTDATEN where LNG_GEBIET = :P4_CNT_GEBIET and INT_STATUS = 3 or LNG_GEBIET = :P4_CNT_GEBIET and INT_STATUS = 4;
        IF amountrs = countstat THEN
         set_status_arbeit_zu_gebiet;
        ELSE
         dbms_output.put('nothing');
        END IF ;
    end;Code 2 with the true problem!
    CREATE OR REPLACE PROCEDURE set_status_arbeit_zu_gebiet
    IS
        cursor c2 is select LNG_GEBIET from TBL_ARBEIT_ZU_GEBIET where PNUM = 1114 and LNG_GEBIET=:new.LNG_GEBIET;
        v_c2  c2%ROWTYPE;
    BEGIN
       open c2;
    fetch c2 into v_c2;
    if c2%notfound then
            INSERT INTO TBL_ARBEIT_ZU_GEBIET
            LNG_GEBIET,
              LNG_ARBEITSSCHRITT,
              PNUM,
              INT_BEARBEITER,
              DATE_DATUM,
              GEPL_DATUM
            VALUES
            (:new.LNG_GEBIET,
             52,
             1114,
             895,
             sysdate,
             to_date('01.01.1990', 'DD.MM.YYYY')
            commit;
            close c2;
    END set_status_arbeit_zu_gebiet;One more question: Is it possible to integrate the first validation that calls my stored procedure into code 2?
    Thanks for you time!
    Sebastian

    The error is in following statement:
    INSERT INTO TBL_ARBEIT_ZU_GEBIET ( ... ) VALUES ( :new.LNG_GEBIET, ... );
    As the statement is part of a procedure and not trigger so it is not able to bind this variable with any value.
    As a resolution, pass this value to the procedure from the process and use it in the insert statement.
    The process will have following IF statement:_
    IF amountrs = countstat THEN
    set_status_arbeit_zu_gebiet *(:P4_CNT_GEBIET)*;
    ELSE
    dbms_output.put('nothing');
    END IF ;
    and the procedure will be as follows:_
    CREATE OR REPLACE PROCEDURE set_status_arbeit_zu_gebiet *(p_lng_gebit varchar2)*
    IS
    cursor c2 is select LNG_GEBIET from TBL_ARBEIT_ZU_GEBIET where PNUM = 1114 and LNG_GEBIET= --:new.LNG_GEBIET-- p_lng_gebit ;
    v_c2 c2%ROWTYPE;
    BEGIN
    INSERT INTO TBL_ARBEIT_ZU_GEBIET ( ... )
    VALUES
    ( --:new.LNG_GEBIET--  p_lng_gebit, ... );
    END set_status_arbeit_zu_gebiet;

Maybe you are looking for

  • Adding a single quote

    Hi I am trying to check through a String before it is sent to the database to add in an extra single quote if a single quote is in the String, but it's not working char singleQuote = '\''; private static String prepareString (String SQLQuery) { Strin

  • How to stop bitmap conversion

    Hi All, Here is the situation. To get the reports one global temporary table has been created. Whenever reports has to generate 1) It first insert records into temporary table from multiple tables based on select statement (here global temporary tabl

  • Dvt alert not showing icons on graph

    I am showing icons on the line graph with the help of dvt:alert component. Code snippet: Alert map: public Map getAlertMap() { Alert alert1=new Alert(); //alert1.setXValue("2011-10-05 10:25:34"); alert1.setXValue("20"); alert1.setYValue(48.00); alert

  • Still Frames, Losing focus, PNG

    I'm put some still frames into my timeline, however, when I playback the stills, it loses focus. When I pause the timeline on the stills, it becomes fine, perfect focus and everything. (These stills are being taken from a seperate digital camera.) Th

  • Service procurement - External staff and tem labour

    Hi, We have a customer requirement w.r.t  external service procurement for external staff and temp labour. The requirement is "Is it possible to integrate the time sheet entry functionality provided for ext staff and temp labour with any of the HR an