Using watched folder

Hi, I'm having problems with watched folder endpoint.<br /><br />I have a very simple process which consists of one activity - assign task and I want to start this process by copying a PDF to specified folder. I've added a watched folder endpoint for this process and it automatically created appropriate sub folders (input, result, failure etc.).<br /><br />The problem starts when I copy a PDF file to the input folder. LiveCycle picks up the file but the process doesn't start. PDF gets moved to the failure folder and the failure.log shows the reason:<br /><br />ALC-DSC-119-000: com.adobe.idp.dsc.util.InvalidCoercionException: Cannot coerce object: <document description here> of type: com.adobe.idp.Document to type: class com.adobe.idp.taskmanager.form.impl.xfa.XFARepositoryFormInstance<br /><br />What am I doing wrong?<br /><br />Thanks<br />Bartek

When you create your watch folder endpoint, you have to map some of the input variables for your process to a file pattern.
This will take the file matching the pattern and put it in that variable. Now the variable type needs to be the right type to receive the file.
From your error, it looks like you're trying to put a PDF file in a xfaForm variable, which wouldn't work. You need to put the PDF in a document variable.
So, make sure in your process that you have an input document variable. Then in your watch folder configuration, when you map your input varibale to a file pattern, make sure you select literal and a pattern like *.pdf
Jasmin

Similar Messages

  • InDesign automation using watch folder

    Hi InDesign experts,
    Can we use InDesign desktop version (CS5) for a remote batch processing work without any manual intervention?
    For example, a script automatically picksup the input file and create pages automatically using watch folder. Is this allowed in desktop license agreement.
    Thanks in advance.

    Marc,
    Power Switch is available for both platforms. Trial period is 30 days.
    Here are some topics I recommend you to read at start in the User Guide: JavaScript for applications,
    AppleScript for applications and Adobe InDesign. Here are some samples (see Javascripts for CS applications).
    If you, or somebody else is interested, I can post the script I wrote.
    Here are a few short tips to get you started:
    Don’t confuse Javascript/AppleScript for CS applications with Internal scripting in PowerSwitch (scripts written in SwitchScripter). You need the former: the script attached to an InDesign/Photoshop/Illustrator/Acrobat/Quark/etc configurator. You drop a configurator into the flow, attach In and Out folders and a script to it.
    You can add up to 5 arguments which are simple strings that can be passed from the Properties panel in PS to the script.
    Attach the script to Command property. Don't use Open and Save in the script -- PS handles them on its own (Open and Save as parameters)
    Use $doc in the script instead of activeDocument
    If you had any questions, I would gladly answer them. Probably we could even start a new thread on the Power Switch topic.
    Kasyan

  • Print PDFs using watched folder

    Hi,
    I am new to Adobe livecycle. I created webservice which generates PDFs in a folder. I want to set that folder as a watch folder and want to print PDFs generated in specific interval. Basically it should figure out if there are any new PDFs and print it to the network printer. I could able to figure out how to set up a watch folder using existing services as a endpoint for watch folder, but none of the exixting services serves exact purpose of printing PDFs from folder. So I am stuck. How should I proceed? Can I create my own process and register it and use it as a end point for watched folder? If yes then how?
    Can somebody help me?
    Thanks!

    Everything is a service in LiveCycle so, yes, generatePrintOuput is a service.
    You can create a new process with Workbench (e.g. TestPrint). Then add the generatePrintedOutput step and a print step (from the Output category). Then save and activate your new process. This will become a new service (TestPrint) which you can add an watchfolder endpoint to.
    Then drop the file in the watch folder for that new service (TestPrint) and the service will call generatePrintedOutput and print.
    Jasmin

  • Alerts on failure when using Watched Folder method of PDFG.

    how to send alerts if PDFG fails to create PDF file via the Watched Folder service

    When you create your watch folder endpoint, you have to map some of the input variables for your process to a file pattern.
    This will take the file matching the pattern and put it in that variable. Now the variable type needs to be the right type to receive the file.
    From your error, it looks like you're trying to put a PDF file in a xfaForm variable, which wouldn't work. You need to put the PDF in a document variable.
    So, make sure in your process that you have an input document variable. Then in your watch folder configuration, when you map your input varibale to a file pattern, make sure you select literal and a pattern like *.pdf
    Jasmin

  • Any Tutorial / Sample to create Single PDF from multiple source files using PDF assembler in a watched folder process.

    Any Tutorial / Sample to create Single PDF from multiple source files using PDF assembler in a watched folder process. I have a client application which will prepare number of source files and some meta data information (in .XML) which will be used in header/footer. Is it possible to put a run time generated DDX file in the watch folder and use it in Process. If possible how can I pass the file names in the DDX. Any sample Process will be very helpful.

    If possible, make use of Assembler API in your client application instead of doing this using watched folder. Here are the Assembler samples :  LiveCycle ES2.5 * Programming with LiveCycle ES2.5
    Watched folder can accept zip files (sample : Configuring a watched folder to handle multiple input files and write results to a single folder | Adobe LiveCycle Blog ). You can also use execute script to create the DDX at runtime : LiveCycle ES2 * Application Development Using LiveCycle Workbench ES2
    Thanks
    Wasil

  • Watch folder lost issue in Acrobat 7.0

    We have using Distiller 7.0 in Macintosh. Set the Watch folder in Distiller to assign folder path in Network. The watch folder is missing after disconnecting the network or Quit the Distiller and reopen it again. We didn't have this issue in Acrobat 5.0. Eventhough server disconnects and relaunch the Network the Watch folder assign accordingly. No need to create a watch folder every time like Distiller 7.0
    Going forward we are annoying to use Distiller 7.0 or later version because of the Watch folder issue. The Distiller watch folder doesn't recognize the path from Network. I have been facing a lot of issue in Acrobat Distiller 7.0. Kindly help me out.
    If we assign the path to Desktop by using watch folder in Acrobat 7.0. We couldn't have this issue.
    JohnArul

    Acro 7 is not compatible with Win 7. In your case there are no upgrades. You need to buy a full version of Acro XI. The minimum version to be eligible for upgrade pricing is Acro 8.
    Mylenium

  • Watch folder found a new file

    Watch folder found a new file and this is what my picture looks like in PSE13. It looks fine in my other photo programs but no image here. Just started doing this yesterday.

    Hi luv2digiscrap,
    It will be helpful if you answer following queries.
    - Is this happening with all files imported using Watch Folder since yesterday. or,
    - if it is happening with any specific file type what is that file format.
    Thanks,
    Raushan

  • How to invoke the running process via email or watch folder?

    Hi,
    I initial a process in workspace using a pdf form(xfaFrom type) variable.
    It's a simple process. Just one assign task node to transfer the initial form to process creater.
    The process works fine when submit in workspace.But I have some problem on offline submit.
    I initialed the form on workspace and saved it to local file to edit it.
    After editing the pdf form, how to let the local saved form go back to the process whith the correct data?
    Here is my variable setting in process:
    form type: xfaForm
    render service : render PDF form (in forms sample catagory)
    submit service : Submit PDF Form (in forms sample catagory)
    I've tried to use email endpoint.
    It will be back to the next step of the process, but the data will not be transfer to the form.
    Then I've tried to use watchFolder endpoint.
    And it did not work by some exceptions.
    Failure Time----Tue Mar 18 10:23:52 GMT+08:00 2008
    source location ---- Reason of failure is-----Cannot coerce object: <document state="active" senderVersion="3" persistent="false" senderPersistent="true" passivated="false" senderPassivated="true" deserialized="true" senderHostId="127.0.0.1/192.168.65.143" callbackId="0" senderCallbackId="0" callbackRef="null" isLocalizable="true" isTransactionBound="false" defaultDisposalTimeout="600" disposalTimeout="600" maxInlineSize="65536" defaultMaxInlineSize="65536" inlineSize="0" contentType="application/pdf" length="265731"><cacheId/><localBackendId/><globalBackendId/><senderLocalBackendId/><send erGlobalBackendId><DocumentFileID fileName="C:\Adobe\LiveCycle8\jboss\server\all\svcnative\DocumentStorage\docm120580620223 4\b680381b2f382c4aba702061e12876d6"/><senderGlobalBackendId/><inline/><senderPullServantJn diName>adobe/idp/DocumentPullServant/adobejb_server1</senderPullServantJndiName><attribute s file="C:\Adobe watch folder\offline\stage\Wxebcb14694b8ef1aee4b27261\off.pdf"/></document> of type: com.adobe.idp.Document to type: class com.adobe.idp.taskmanager.form.impl.binarycontent.BinaryContentFormInstance
    Cannot coerce object: <document state="active" senderVersion="3" persistent="false" senderPersistent="true" passivated="false" senderPassivated="true" deserialized="true" senderHostId="127.0.0.1/192.168.65.143" callbackId="0" senderCallbackId="0" callbackRef="null" isLocalizable="true" isTransactionBound="false" defaultDisposalTimeout="600" disposalTimeout="600" maxInlineSize="65536" defaultMaxInlineSize="65536" inlineSize="0" contentType="application/pdf" length="265731"><cacheId/><localBackendId/><globalBackendId/><senderLocalBackendId/><send erGlobalBackendId><DocumentFileID fileName="C:\Adobe\LiveCycle8\jboss\server\

    hi
    The problem is not completely solved.
    The solved part is countinue the process by Email and there is still need to be soloved by watch folder. Here are some steps.
    First, I set the email endpoint on "complete task" service(in process management catagory). Then configure the input parameter of the endpoint. The attachment parameter set to *.* and the mail from set to %SENDER%.
    Second, the xfa form variable of process must have process fields and use the default render. So the process field data which are required to counitnue the process will be keeped.
    Then it worked.
    But when I check the "complete task" component(process management --> task notification catagory) used in "complete task" process. Some input parameters(Sender, attachment map) are required and can't be found if using watch folder. So there is still a problem by using watch folder.
    Bking Chuang

  • Acrobat Distiller Watched Folder problem with OSX 10.9

    Probably not Adobe's problem but anyone else getting this?
    Just upgraded to Mavericks and now when I try to print to a watched folder from Quark it keeps wanting to save the postscript file onto the desktop rather than directly into the "In" folder of the Distiller watched folder. Got so used to just hitting command/alt/p and then return.
    Have recreated the watched folder just in case.
    Quark 8 (ok not officially supported for OSX 10.9) but this seems more of a directory issue.
    Preference is set to create postscript for later distilling and use watched folder.
    Acrobat/Distiller X 10.1.8.
    Am going to post this on Quark and Apple sites.
    Somebody's costing me an extra few keystrokes per job printed !!!
    Cheers.

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of the test is to determine whether the problem is caused by third-party software that loads automatically at startup or login, by a peripheral device, by a font conflict, or by corruption of the file system or of certain system caches.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards, if applicable. Start up in safe mode and log in to the account with the problem. You must hold down the shift key twice: once when you turn on the computer, and again when you log in.
    Note: If FileVault is enabled, or if a firmware password is set, or if the startup volume is a Fusion Drive or a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to start up and run than normal, with limited graphics performance, and some things won’t work at all, including sound output and Wi-Fi on certain models. The next normal startup may also be somewhat slow.
    The login screen appears even if you usually login automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Test while in safe mode. Same problem?
    After testing, restart as usual (not in safe mode) and verify that you still have the problem. Post the results of the test.

  • Invoking long lived process by watched folder?

    Hi,
    I have to build a long lived process that starts when xml data is dropped into a folder.
    Once the xml is received it should be populated in the form and assigned as a task in Process Management.
    Long lived process should be defined  with a task manager end point but when using watched folder to invoke process it is a watched folder..
    How can I define such a process?
    Thanks, Yan

    Hi Yan,
    actually, the process doesn't need to have a task manager end point. The task manager end point is only used if you want users to start the process from Workspace.
    For your process, use a watched folder end point. In the process, the first step is an Assing Task operation that uses the xml data that you dropped in the watched folder (assuming the xml is in the correct structure for the form you are using).
    scott

  • Conversion with settingsDocument using PDFG Watched folder

    Hi all,
    I am creating a PDF Conversion process.
    I want to convert ps to pdf with settingsDocument using DistillerService watched folders.
    I configured inputDocument in DistillerService Endpoint to Variable:*.ps and it works. I put a ps file to input folder, then the PDF file was created in the result folder.
    Then I configured settingsDocument to Variable:*.xml.
    I expected PDF Conversion with settingsDocument when I put a ps file and an xml file which I exported from PDFG to the input folder.
    But, the created PDF seemed to be the same file as the PDF created without settingsDocument configuration and the xml file remained in the input folder.
    I made a security setting named "Security" including password security and exported a configuration xml which includes this security setting.
    I put a ps and this xml to the input folder, but the created pdf opened without password.
    If I configure securitySettings to Literal:Security , it works. The created PDF is locked with password. I want to do this using setting xml.
    Any ideas?

    When you create your watch folder endpoint, you have to map some of the input variables for your process to a file pattern.
    This will take the file matching the pattern and put it in that variable. Now the variable type needs to be the right type to receive the file.
    From your error, it looks like you're trying to put a PDF file in a xfaForm variable, which wouldn't work. You need to put the PDF in a document variable.
    So, make sure in your process that you have an input document variable. Then in your watch folder configuration, when you map your input varibale to a file pattern, make sure you select literal and a pattern like *.pdf
    Jasmin

  • Lightroom locks up when using auto import / watch folder

    Hello All
    Has anyone ran into a problem with Lightroom locking up when you are using the auto import / watch folder feature. Everytime i try to even drop one file in the watched folder, I get a lightroom is not responding message. This really suck...........Everything else seems to be working so far.
    Thanks
    Bill

    I had the same problem. When i would auto import, it would stuck after one photo was imported. I have a separate partition on my harddisk for photo's (F:\) when i made an extra subdirectory (F:\Photo) and auto imported the photo's to that place the problem was solved. Why ? I don't know
    greetz J.

  • Why cant Itunes use a user specified watch folder

    The Zune (RIP) watch folders were extremely easy: tell the player where to look and the service will add all music from that location verbatim and automatically rescan, importing any new files added to the folder. Any music I purchased was saved to the watch folder.
    This worked long before ITunes (Apple) decided to add their own watch folder. To be honest I do not understand it. I moved my music from my primary music folder over to the "Automatically add to iTunes" folder. I guess the music was imported automatically as the name suggests however no music files remained, just empty artist folders. It seemed to just create more duplicates ( Although it seems duplicates are created whenever I mess with the folders.
    Im tired of reading responses to "how-to" forums suggesting that tracks need to added manually. Zune is not given much credit for doing it right the first (and only) time. My point is the inconvenient method is usually posted without reference to an alternative. This alternative should not require third party applications (which are still are not as automated as the processes in Zune).
    Sorry for the long post. I have already wrote about my ignorance on the "Automatically add to ITunes" folder. I would give anyone credit for providing any explanation in depth about that feature.

    I moved my music from my primary music folder over to the "Automatically add to iTunes" folder. I guess the music was imported automatically as the name suggests however no music files remained, just empty artist folders.
    Correct. iTunes only cares about the song files. It creates its own Artist/Album folders based on the ID3 tags in the song files.
    It moves (not copies) the files to /Music/iTunes/iTunes media/Music/ under the new /Artist/Album/ folders.
    It seemed to just create more duplicates ( Although it seems duplicates are created whenever I mess with the folders.
    You mean in iTunes, you now have duplicate songs?
    If the song was already in iTunes and you add it to this folder, it will add it  to iTunes again.
    You can delete the duplicates in iTunes (which will delete the duplicate file in the iTunes folder).
    See this -> http://support.apple.com/kb/ht2905

  • Find and replace with multiple files and with a watch folder

    I am trying to create a watch folder that uses red_menace script to:
    1. Have a folder that receives multiple xml files that run the script one by one.
    2. then move the files to an output folder.
    I tried modifying the set TheFIle to choose file -- the original text file to:
    with multiple selections allowed
    But that doesn't seem to work. I know i'm missing a step. Any help is much appreciated!
    Thanks!
    The way i'd like to setup things is having an input folder on the desktop (or just have the application on the desktop and I can drag the files onto it), and let it do it's thing. Once it's done have it export the xml files into an output folder.
    Here's what i got so far:
    on open
    set TheFIle to choose file -- the original text file
    set TheFolder to ("Macintosh HD:Users:user1:Desktop:out") -- the folder for the output file
    set TheName to (GetUniqueName for TheFIle from TheFolder) -- the name for the output file
    set TheText to read TheFIle -- get the text to edit
    set Originals to {"KPCALDATE", "KPCALEVENT", "KPCALDAY", "KPCALBODY", "obituaries name", "" & return & "</cstyle></pstyle>" & return & "<pstyle name=\"obituaries text\"><cstyle>", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\" font=\"ADV AGBook-Medium 2\">", "<pstyle name=\"Recipe Ingredients\"><cstyle>", " .com", " .net", " .org", " .edu", "www .", "www. ", "Ho- nolulu", "<pstyle name=\"kicker 12\"><cstyle allcaps=\"1\">fashion news</cstyle><cstyle allcaps=\"1\">" & return & "</cstyle></pstyle>" & return & "", "<component name=\"Headline 1\" type=\"Headline\">" & return & "<header>" & return & "<field name=\"Component name\" type=\"string\" value=\"Headline 1\"/>" & return & "<field name=\"Component type\" type=\"popup\" value=\"Headline\"/>" & return & "</header>" & return & "<body>" & return & "<pstyle name=\"hed STANDARD 36\"><cstyle>", "<pstyle name=\"obituaries text\"><cstyle allcaps=\"1\">", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\">", "<pstyle name=\"tagline\"><cstyle>-", "-", "
    Per serving:", "<pstyle name=\"Titlebar - mini, red\"><cstyle allcaps=\"1\">NATION & World </cstyle><cstyle allcaps=\"1\">Report</cstyle><cstyle allcaps=\"1\">" & return & "</cstyle></pstyle>" & return & "", "</cstyle></pstyle>"} -- the terms that can be replaced
    set Replacements to {"subhed", "subhed", "subhed", "Normal", "obituaries text", ", ", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\" font=\"ADV AGBook-Medium 2\">", "<pstyle name=\"Recipe Ingredients\"><cstyle>
    ", ".com", ".net", ".org", ".edu", "www.", "www.", "Honolulu", "", "<component name=\"Headline1\" type=\"Headline\">" & return & "<header>" & return & "<field name=\"Component name\" type=\"string\" value=\"Headline1\"/>" & return & "<field name=\"Component type\" type=\"popup\" value=\"Headline\"/>" & return & "</header>" & return & "<body>" & return & "<pstyle name=\"hed STANDARD 27\"><cstyle>", "<pstyle name=\"obituaries text\"><cstyle allcaps=\"1\">", "<pstyle name=\"obituaries text\"><cstyle name=\"Graphics Bold leadin\">", "<pstyle name=\"tagline\"><cstyle>—", " —", "
    Per serving:", "","" & return & "</cstyle></pstyle>"} -- the replacement terms
    repeat with AnItem from 1 to count Originals
    set TheText to (replaceText of TheText from (item AnItem of Originals) to (item AnItem of Replacements))
    end repeat
    try -- write a new output file
    tell application "Finder" to make new file at TheFolder with properties {name:TheName}
    set OpenFile to open for access (result as alias) with write permission
    write TheText to OpenFile starting at eof
    close access OpenFile
    on error errmess
    try
    log errmess
    close access OpenFile
    end try
    end try
    end open
    to GetUniqueName for SomeFile from SomeFolder
    check if SomeFile exists in SomeFolder, creating a new unique name if needed
    parameters - SomeFile [mixed]: a source file path
    SomeFolder [mixed]: a folder to check
    returns [text]: a unique file name and extension
    set {Counter, Divider} to {"00", "_"}
    -- get the name and extension
    set {name:TheName, name extension:TheExtension} to info for file (SomeFile as text)
    if TheExtension is missing value then set TheExtension to ""
    set TheName to text 1 thru -((count TheExtension) + 2) of TheName
    set NewName to TheName & "." & TheExtension
    tell application "System Events" to tell (get name of files of folder (SomeFolder as text))
    repeat while it contains NewName
    set Counter to text 2 thru -1 of ((100 + Counter + 1) as text) -- leading zero
    set NewName to TheName & Divider & Counter & "." & TheExtension
    end repeat
    end tell
    return NewName
    end GetUniqueName
    to EditItems of SomeItems given Title:TheTitle, Prompt:ThePrompt
    displays a dialog for multiple item edit (note that a return is used between each edit item)
    for each of the items in SomeItems, a line containing it's text is placed in the edit box
    the number of items returned are padded or truncated to match the number of items in SomeItems
    parameters - SomeItems [list]: a list of text items to edit
    TheTitle [boolean/text]: use a default or the given dialog title
    ThePrompt [boolean/text]: use a default or the given prompt text
    returns [list]: a list of the edited items, or {} if error
    set {TheItems, TheInput, TheCount} to {{}, {}, (count SomeItems)}
    if TheCount is less than 1 then return {} -- error
    if ThePrompt is in {true, false} then -- "with" or "without" Prompt
    if ThePrompt then
    set ThePrompt to "Edit the following items:" & return -- default
    else
    set ThePrompt to ""
    end if
    else -- fix up the given prompt a little
    set ThePrompt to ThePrompt & return
    end if
    if TheTitle is in {true, false} then if TheTitle then -- "with" or "without" Title
    set TheTitle to "Multiple Edit Dialog" -- default
    else
    set TheTitle to ""
    end if
    set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
    set {SomeItems, AppleScript's text item delimiters} to {SomeItems as text, TempTID}
    set TheInput to paragraphs of text returned of (display dialog ThePrompt with title TheTitle default answer SomeItems)
    repeat with AnItem from 1 to TheCount -- pad/truncate entered items
    try
    set the end of TheItems to (item AnItem of TheInput)
    on error
    set the end of TheItems to ""
    end try
    end repeat
    return TheItems
    end EditItems
    to replaceText of SomeText from OldItem to NewItem
    replace all occurances of OldItem with NewItem
    parameters - SomeText [text]: the text containing the item(s) to change
    OldItem [text]: the item to be replaced
    NewItem [text]: the item to replace with
    returns [text]: the text with the item(s) replaced
    set SomeText to SomeText as Unicode text -- TID's are case insensitive with Unicode text
    set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, OldItem}
    set {ItemList, AppleScript's text item delimiters} to {text items of SomeText, NewItem}
    set {SomeText, AppleScript's text item delimiters} to {ItemList as text, TempTID}
    return SomeText
    end replaceText
    Message was edited by: gamebreakers

    When you use the open or adding folder items to handlers, you need to add the parameters for the file items passed to them.
    I'll go ahead and post the applet/droplet version of my original script from the previous topic for reference:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #FFEE80;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    -- search and replace multiple items applet/droplet/folder action
    -- the terms to replace - edit as needed
    property EditableItems : {¬
    "one", ¬
    "two", ¬
    "three", ¬
    "four", ¬
    "five", ¬
    "six", ¬
    "seven", ¬
    "eight", ¬
    "nine", ¬
    "ten", ¬
    "eleven", ¬
    "twelve", ¬
    "thirteen", ¬
    "fourteen", ¬
    "fifteen", ¬
    "sixteen", ¬
    "seventeen", ¬
    "eighteen", ¬
    "nineteen", ¬
    "twenty"}
    -- the folder for the output file(s) - change as needed
    property TheFolder : (path to desktop)
    property LastEditItems : EditableItems
    on run
    the applet/droplet was double-clicked
    open (choose file with multiple selections allowed)
    end run
    on open TheItems
    items were dropped onto the applet/droplet
    parameters - TheItems [list]: a list of the items (aliases) dropped
    returns nothing
    repeat with AnItem in TheItems
    ReplaceMultipleItems from AnItem
    end repeat
    end open
    on adding folder items to this_folder after receiving these_items
    folder action - items were added to a folder
    parameters - this_folder [alias]: the folder added to
    these_items [list]: a list if items (aliases) added
    returns nothing
    repeat with AnItem in these_items
    ReplaceMultipleItems from AnItem
    end repeat
    end adding folder items to
    to ReplaceMultipleItems from SomeFile
    replace multiple text items in SomeFile
    parameters - SomeFile [alias]: the file to replace items in
    returns nothing
    set TheName to (GetUniqueName for SomeFile from TheFolder) -- the name for the output file
    set TheText to read SomeFile -- get the text to edit
    set Originals to (choose from list EditableItems default items LastEditItems with prompt "Select the terms to replace:" with multiple selections allowed) -- the specific terms to replace
    set LastEditItems to Originals
    set Replacements to (EditItems of Originals with Title given Prompt:"Edit the following replacement terms:") -- the replacement terms
    repeat with AnItem from 1 to count Originals
    set TheText to (ReplaceText of TheText from (item AnItem of Originals) to (item AnItem of Replacements))
    end repeat
    try -- write a new output file
    tell application "Finder" to make new file at TheFolder with properties {name:TheName}
    set OpenFile to open for access (result as alias) with write permission
    write TheText to OpenFile starting at eof
    close access OpenFile
    on error errmess
    try
    log errmess
    close access OpenFile
    end try
    end try
    end ReplaceMultipleItems
    to GetUniqueName for SomeFile from SomeFolder
    check if SomeFile exists in SomeFolder, creating a new unique name if needed
    parameters - SomeFile [mixed]: a source file path
    SomeFolder [mixed]: a folder to check
    returns [text]: a unique file name and extension
    set {Counter, Divider} to {"00", "_"}
    -- get the name and extension
    set {name:TheName, name extension:TheExtension} to info for file (SomeFile as text)
    if TheExtension is in {missing value, ""} then
    set TheExtension to ""
    else
    set TheExtension to "." & TheExtension
    end if
    set {NewName, TheExtension} to {TheName, (ChangeCase of TheExtension to "upper")}
    set TheName to text 1 thru -((count TheExtension) + 1) of TheName
    tell application "System Events" to tell (get name of files of folder (SomeFolder as text))
    repeat while it contains NewName
    set Counter to text 2 thru -1 of ((100 + Counter + 1) as text) -- leading zero
    set NewName to TheName & Divider & Counter & TheExtension
    end repeat
    end tell
    return NewName
    end GetUniqueName
    to EditItems of SomeItems given Title:TheTitle, Prompt:ThePrompt
    displays a dialog for multiple item edit (note that a return is used between each edit item)
      for each of the items in SomeItems, a line containing it's text is placed in the edit box
        the number of items returned are padded or truncated to match the number of items in SomeItems
    parameters - SomeItems [list]: a list of text items to edit
    TheTitle [boolean/text]: use a default or the given dialog title
    ThePrompt [boolean/text]: use a default or the given prompt text
    returns [list]: a list of the edited items, or {} if error
    set {TheItems, TheInput, TheCount} to {{}, {}, (count SomeItems)}
    if TheCount is less than 1 then return {} -- error
    if ThePrompt is in {true, false} then -- "with" or "without" Prompt
    if ThePrompt then
    set ThePrompt to "Edit the following items:" & return -- default
    else
    set ThePrompt to ""
    end if
    else -- fix up the given prompt a little
    set ThePrompt to ThePrompt & return
    end if
    if TheTitle is in {true, false} then if TheTitle then -- "with" or "without" Title
    set TheTitle to "Multiple Edit Dialog" -- default
    else
    set TheTitle to ""
    end if
    set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
    set {SomeItems, AppleScript's text item delimiters} to {SomeItems as text, TempTID}
    set TheInput to paragraphs of text returned of (display dialog ThePrompt with title TheTitle default answer SomeItems)
    repeat with AnItem from 1 to TheCount -- pad/truncate entered items
    try
    set the end of TheItems to (item AnItem of TheInput)
    on error
    set the end of TheItems to ""
    end try
    end repeat
    return TheItems
    end EditItems
    to ReplaceText of SomeText from OldItem to NewItem
    replace all occurances of OldItem with NewItem
    parameters - SomeText [text]: the text containing the item(s) to change
    OldItem [text]: the item to be replaced
    NewItem [text]: the item to replace with
    returns [text]: the text with the item(s) replaced
    set SomeText to SomeText as text
    if SomeText contains OldItem then
    set {TempTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, OldItem}
    try
    set {ItemList, AppleScript's text item delimiters} to {text items of SomeText, NewItem}
    set {SomeText, AppleScript's text item delimiters} to {ItemList as text, TempTID}
    on error ErrorMessage number ErrorNumber -- oops
    set AppleScript's text item delimiters to TempTID
    error ErrorMessage number ErrorNumber
    end try
    end if
    return SomeText
    end ReplaceText
    to ChangeCase of SomeText to CaseType
    changes the case or capitalization of SomeText to the specified CaseType using Python
    parameters - SomeText [text]: the text to change
    CaseType [text]: the type of case desired:
    "upper" = all uppercase text
    "lower" = all lowercase text
    "title" = uppercase character at start of each word, otherwise lowercase
    "capitalize" = capitalize the first character of the text, otherwise lowercase
    returns [text]: the changed text 
    set SomeText to SomeText as text
    if CaseType is not in {"upper", "lower", "title", "capitalize"} then return SomeText
    return (do shell script "/usr/bin/python -c \"import sys; print unicode(sys.argv[1], 'utf8')." & CaseType & "().encode('utf8')\" " & quoted form of SomeText)
    end ChangeCase
    </pre>
    Edit: how does the choose from list dialog handle those big strings? I'm guessing not very well - is that why you avoided using them?
    Message was edited by: red_menace

  • Excel save as pdf hangs when launched through a watch folder

    Hi there,
    I've configured a watch folder to launch a batch file which launch a .exe file I've written in C++
    In this application I launch Excel which open a .XLS document which contains macros.
    At the end of the computations there is a macro which save as pdf.
    At this point everything hangs and I have to cancel the job I've created for the watch folder.
    If I disable the watch folder and I place the starting file inside the watch folder
    and I manually launch the .bat file (which usually is launched by the watch folder) everything works perfectly.
    I really really hope there will be someone here coming with a solution for me.
    By the way on the windows forum I've got a very disappointing answer where they stated it was probably a fault of my application.
    Well fortunately that was not the problem because
    I can reproduce the problem even removing my application from the equation so now we have cleared
    the issue is not casued by my application.
    So if you want to try it yourself just follow the steps below:
    1) create an excel document so that after you open it it automatically run a save as pdf operation and close excel. (let's call this document "PRINT_TEST.xls")
    2) create a batch file named "Excel_launcher.bat" and write the command
    ""C:\Program Files\Microsoft Office 15\root\office15\EXCEL.EXE" "C:\teststampapdf\PRINT_TEST.xls""
    3) Now create a watch folder job that execute that batch file.
    something like "C:\watchfolderX\Excel_launcher.bat"
    4) now create a watch folder that uses that job and for file filter use "*.txt" enable it and start it
    5) now launch manually the batch file and you'll see that it print the pdf and closes itself
    6) drop a txt file inside the watch folder you've created and you'll see it hangs at the save as pdf operation.
    This is something that have to be fixed and it's due to excel.
    I can launch and save documents with all the application I want but excel so that's the problem.
    Please take a look and keep me updated I badly need to find a solution for this issue.
    THANK YOU in advance,
    Davide

    Hi Davide,
    This is no the right forum for your issue. I think you can consult this issue on some Excel end-user related forum.
    Best regards,
    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for