Skip to main content
1-Visitor
December 15, 2010
Question

Simple Search

  • December 15, 2010
  • 1 reply
  • 2255 views

Hi,

I am struggling to perform what would appear to be a simple operation. I have scoured the 'Macro Language Reference' without any success!

I am wanting to search the current activeDoc and remove all the text elements that contain the letter 'x'.

All the examlpes I can find involve generating something from new and assigning to a variable:

MACRO globalsTest
gText = "Hi, I'm a global."
MESSAGE gText
END MACRO

In this case I dont know to make anything from new - I want to access pre-existing elements put them into a variable and modify/delete them as needed - I am getting really frustrated at not being able to find this info - maybe I have been looking at too much code recently and I am just not seeing it!

Can anyone help?

Thanks in advance

Alan

Message was edited by: Alan Porter

    1 reply

    acs_alan1-VisitorAuthor
    1-Visitor
    December 15, 2010

    Ok for those, like myself that may have struggled with something similar, this is the solution (SELECT IF):

    Macro Search

    SELECT IF TEXT CONTAINS "x"

    End Macro

    In this example all TEXT elements will be selected IF it CONTAINS the letter "x".

    In the Macro Language Reference go to 'Page 64' their are various other filters you can apply. Pretty neat command.

    Hope this helps others.

    Alan

    P.S

    I decided to go one step further to make this script more efficient:

    Macro Find_Text

    DEFINE userInput AS string

    userInput = GET STRING "Please enter the text you wish to search for"

    SELECT IF TEXT CONTAINS userInput

    End Macro