Skip to main content
1-Visitor
March 31, 2010
Question

ACL find_pi Instruction and end of document hit

  • March 31, 2010
  • 1 reply
  • 2416 views
Hello , I have a small issue working with ACL and developing some app extension. Problem description: I need to go through a document and replace all Processing Instructions with a custom text extension. To locate the PI, I'm using the function find_pi. This works nice so far. The one problem is, that when find_pi hits the documents end, it sometimes asks the user if he wants to continue the search at the top of the document ( as no more pi's are found at the bottom ) . How can I disable this message ? Thanks for your help ! Greetings !

    1 reply

    1-Visitor
    March 31, 2010
    Try setting the "wrapscan" option to "off". If this succeeds in disabling the prompt (and the wrapping behavior), then you can use the option("wrapscan") function call at the start of your script to get the current value and save it to a variable so you can turn it off, then restore it before the end. -Brandon
    1-Visitor
    March 31, 2010
    Hi, well, tried it out. Setting wrapscan to off disables the previos message "go to start of document", but unfortunatly now gives me the (warning) message, that no elements have been found. And that brings me again to the problem of dealing with messages presented to the user. *douh* Isn't there maybe a way of catching the response of the call find_pi into a variable for a later evaluation ? Sometimes working with the epic extensions and ACL is a little confusing and not quite motivating . And I have a lot of other issues left to do... Thank you ! greetings, roland
    1-Visitor
    April 1, 2010
    Try this in your script: find::keep_silent(1) # ... find::keep_silent(0) Caveat: This is not exactly documented functionality, so there's probably not a lot of guarantee of it continuing to work from version to version (or that it will even work at all in the version you're using... don't know which that is). You may want to consider switching to a technique that uses the oid_*() functions provided by ACL, as they are meant for scripting, where the commands are more for direct use by human operators. You can probably find some tips on how to walk the document to find PIs in the libraries at adepters.org, or in the archives (10+ years of 'em, all searchable) of the Adepters list, which is hosted in the Forums section of ptcuser.org. -Brandon