Search and replace with IDE script?

  1. 8 months ago

    Beatrix W

    10 Feb 2019 Pre-Release Testers, Third Party Store Europe (Germany)
    Edited 8 months ago

    Can I do a global search and replace with an IDE script? My Mime Parser is as good as done. It has some extra checks that belong to my app and not in the code I want to sell. A couple of replaces get rid of this code. As developer I want to automate. I had a look at the documentation but didn't find anything.

  2. Sascha S

    11 Feb 2019 Pre-Release Testers, Xojo Pro Germany, Lower Saxonary

    I think we discussed this in the past in the Forum and if i remember correct, it's not possible. But maybe Arbed can do it?

  3. Beatrix W

    11 Feb 2019 Pre-Release Testers, Third Party Store Europe (Germany)

    Good idea, I'll ask him if Arbed can do that.

  4. Jürg O

    11 Feb 2019 Pre-Release Testers, Xojo Pro

    @Beatrix W It has some extra checks that belong to my app and not in the code I want to sell.

    Then separate them.

    Idea 1:

    • create a Method performAdditionalChecks in your ParserClass (which doesn't do anything)
    • use a SubClass ParserClassMyApp in your App, which implements your app specific checks

    Idea 2:

    • use Events in your ParserClass
    • implement the Events only in your App
  5. Beatrix W

    11 Feb 2019 Pre-Release Testers, Third Party Store Europe (Germany)

    @Jürg Otter: my code is called with a simple

    dim s as myClass(some options)
    dim e as string = s.geterror

    So there is no chance for an event. Back to the drawing board.

  6. Jean-Yves P

    11 Feb 2019 Pre-Release Testers, Xojo Pro Europe (France, Besançon)

    externalize projects items
    make 2 projects
    one with the code, one without.
    changes in the items will be saved to the other projects
    only need to recompile the other project once in a while.

  7. Jürg O

    11 Feb 2019 Pre-Release Testers, Xojo Pro
    Edited 8 months ago

    @Beatrix W So there is no chance for an event.

    Why do you think so?
    If you add and implement the "app specific" Event as a Method in your App:

    dim s as New ParserClass2("test-options")
    AddHandler s.getErrorAppSpecific, AddressOf self.getErrorAppSpecific
    dim e as string = s.geterror
    RemoveHandler s.getErrorAppSpecific, AddressOf self.getErrorAppSpecific

    See this example project , where I've quickly tried the two ideas.

    • ParserClass1: the one you would release to the public, ParserClass1ForMyApp: the Subclass you would use in your app
    • ParserClass2: the one you would release to the public using Events, implemented in your own app using AddHandler

    I still think the best approach is to separate the "public Class" (which can be used in other projects, be sold, whatever) and the "only-myapp-related things". Maybe one of the two ideas works for your needs.

or Sign Up to reply!