Set RegEx filters from script?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xeatopdk
    Visitor
    • Oct 2010
    • 7

    Set RegEx filters from script?

    Hi

    I´m using BC 3.0.15 (upgrade might not be an option, it´s a big company) and I need to make 16 different comparisons on different folders and the ignore filters (http://www.scootersoftware.com/suppo...mportantv3.php) are different each time. Is there a way to set (and delete) the filters in the script?

    Example of a filter: tools -> file formats -> grammar:
    Element name: IgnorableElement
    Category: basic
    Text matching: ^PLI......$
    Regular Expression: checked

    There will be 3-4 (different) filters for each comparison.

    Kind regards
    Kim
  • Michael Bulgrien
    Carpal Tunnel
    • Oct 2007
    • 1772

    #2
    The quick answer is to set up sessions in the GUI for each of the 16 different computers with the ignore filters set the way you want them then save each of the sessions. In your script, load each session by name to inherit the session settings you set up in the GUI.
    BC v4.0.7 build 19761
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

    Comment

    • Aaron
      Team Scooter
      • Oct 2007
      • 16000

      #3
      Hello,

      Just to clear up a bit of terminology, we generally use the word "filter" for either "file name filters," "misc filters" such as date or Attribute status, or "display filters" which are the buttons in the toolbar for showing only different files. The concept above in your example is the creation of a grammar element for a file format, which can then be marked as "Unimportant text" in the session settings, and ignored using the Ignore Unimportant Differences option.

      If you save a particular Folder Compare session, and want to have the files in it ignore specific Unimportant text, you can set this up. First, in the graphical interface, load your Folder Compare. Then double click on a file to open a child Text Compare session. Go to that child's Session Settings and set your Importance as you wish to ignore it and use the dropdown in the lower left to "Apply for all files in parent session." Then mark the toolbar to Ignore Unimportant Differences. Close the child comparison, mark the Folder Compare's Ignore Unimportant Differences, and re-save the parent Folder Compare.

      You can then repeat this process with a new Folder Compare parent session to save different child session settings. Script can only load Folder Compare sessions.

      The next step depends on what you would like to do next in script. For example, you can load this parent session in script with the load command, issue and expand all command, select files, and run text-reports to see text differences inside of the files. Then load the next folder compare session and repeat.

      How does this work for you? Please let us know if you have any questions. Also, please include or email your current script and we can help set it up. If you email us at [email protected] , please also include a link back to this forum post for reference.
      Aaron P Scooter Software

      Comment

      • xeatopdk
        Visitor
        • Oct 2010
        • 7

        #4
        Originally posted by Aaron
        Hello,
        If you save a particular Folder Compare session, and want to have the files in it ignore specific Unimportant text, you can set this up. First, in the graphical interface, load your Folder Compare. Then double click on a file to open a child Text Compare session. Go to that child's Session Settings and set your Importance as you wish to ignore it and use the dropdown in the lower left to "Apply for all files in parent session." Then mark the toolbar to Ignore Unimportant Differences. Close the child comparison, mark the Folder Compare's Ignore Unimportant Differences, and re-save the parent Folder Compare.
        I´ve tried to follow your suggestion, but it seems that I can´t save the selected file format setting.

        I´m testing with two pdf filters and two sessions at the moment, "do" and "fd". If I open the do session and in the file format settings change the pdf mask to the "do" filter, do all the things you wrote, then save it and do likewise with the "fd" session then when I select the "do" session again "fd" is checked in file format.

        Originally posted by Aaron
        You can then repeat this process with a new Folder Compare parent session to save different child session settings. Script can only load Folder Compare sessions.
        I´ve come to realize that know and that´s my approach

        Originally posted by Aaron
        For example, you can load this parent session in script with the load command, issue and expand all command, select files, and run text-reports to see text differences inside of the files. Then load the next folder compare session and repeat.
        That´s what I´m doin´(or trying to)

        Comment

        • xeatopdk
          Visitor
          • Oct 2010
          • 7

          #5
          Originally posted by Aaron
          Hello,
          ...and re-save the parent Folder Compare.
          By this you mean save the session, right?

          /Kim

          Comment

          • xeatopdk
            Visitor
            • Oct 2010
            • 7

            #6
            Solved?

            Okay, I´ve done some further testing. When I change the session (to "do")and look at tools -> file formats, the pdf mask is the same (for "fd"), but that might be a global setting, that is overruled by the session settings? Cause I did some more filtering and are getting the results I expect (and under session settings -> importance->edit grammar for the child the filters I expect is there (the ones for "do")

            Thanks for your help Arron.

            Kind regards
            Kim

            Edit 27/10-2010: hmm... Added a new rule to "do", but now this filter is not activated when running "do" session, instead it´s the "fd" filter (that seems to be default, in tools -> file format), so I still have the problem :-/
            Last edited by xeatopdk; 27-Oct-2010, 04:26 AM. Reason: problem reoccured

            Comment

            • Aaron
              Team Scooter
              • Oct 2007
              • 16000

              #7
              Hello,

              The File Formats dialog under the Tools menu is global, so changing that per session will change it globally. The Session Settings dialog is specific for each session.

              If you make a clone of your File Format (one for session do, and one for session fd), and you have BC3 Pro, there is a session setting in the Misc tab, where you can disable all file formats except a specific one. This way, you can control which is used on a session by session basis.
              http://www.scootersoftware.com/suppo...?zz=kb_evalpro

              Does this help clear up the behavior you are seeing? If you need different file formats for your specific sessions, you will need to create multiple formats. It is also possible you may be able to use a single format with properly defined grammar elements.

              Could you give more specific examples as to how you wish to use grammars and file formats with your files and sessions? You can email them to us at [email protected] to keep the conversation private. Please include a link back to this forum post in the email.
              Aaron P Scooter Software

              Comment

              • xeatopdk
                Visitor
                • Oct 2010
                • 7

                #8
                Originally posted by Aaron
                The File Formats dialog under the Tools menu is global, so changing that per session will change it globally. The Session Settings dialog is specific for each session.
                Changing session will not change it globally for me. "fd" pdf filter is selected, when I then select the "do" session the pdf filter is still "fd" in tools -> file formats, but when running the folder comparison the "do" filter is used for the "do" session. The most annoying thing now is that I have to aactive select the "do" filter when I wanna make a new rule to the "do" filter, cause "fd" filter is default selected in tools -> file formats

                Originally posted by Aaron
                If you make a clone of your File Format (one for session do, and one for session fd), and you have BC3 Pro, there is a session setting in the Misc tab, where you can disable all file formats except a specific one. This way, you can control which is used on a session by session basis.
                http://www.scootersoftware.com/suppo...?zz=kb_evalpro
                I guess we don´t have the pro version here, and it´s not possible to test the pro version on the company PC (It politics)

                Originally posted by Aaron
                Does this help clear up the behavior you are seeing? If you need different file formats for your specific sessions, you will need to create multiple formats. It is also possible you may be able to use a single format with properly defined grammar elements.
                I´ve created several different formats for the same pdf mask. The RegExs are too different and specific for each type of document so it´s not an option with only one filter (lines might be acceptable to ignore in one document, but not in anoter)

                Originally posted by Aaron
                Could you give more specific examples as to how you wish to use grammars and file formats with your files and sessions? You can email them to us at [email protected] to keep the conversation private. Please include a link back to this forum post in the email.
                I´ve mailed you an export of my settings, sessions and filters.

                Kind regards.
                Kim

                Comment

                • Aaron
                  Team Scooter
                  • Oct 2007
                  • 16000

                  #9
                  Originally posted by xeatopdk
                  Changing session will not change it globally for me. "fd" pdf filter is selected, when I then select the "do" session the pdf filter is still "fd" in tools -> file formats, but when running the folder comparison the "do" filter is used for the "do" session. The most annoying thing now is that I have to aactive select the "do" filter when I wanna make a new rule to the "do" filter, cause "fd" filter is default selected in tools -> file formats
                  Sorry for the confusion. To clarify, if you open a session, and then go to the Tools menu -> File Formats, you are entering a global settings area. Any changes here will affect the entire program, similar to going to the Tools menu -> Options and changing a difference color. It will be different for the current session, and any other sessions you may open later. The way a file format is selected by default is the topmost file format that matches based on extension is used automatically. To override this behavior requires a bit of pre-configuration and setup.

                  Filters (Name Filter and Other Filter, in the Session Settings dialog) are Session Settings, and will save based on the session you are loading or your default session settings when opening a new session.

                  What kind of sessions are you using? Folder Compare sessions with file comparisons run as child sessions or are you saving directly as a few different Text Compare sessions.

                  Looking through our [email protected] inbox, I do not see an email from you, and it does not appear it was blocked by our spam security. It may have been blocked on your end; please try sending us an email without an attachment first to see if that can get through. Please include a link back to this forum post in the email so we can link the two cases together.
                  Aaron P Scooter Software

                  Comment

                  • Aaron
                    Team Scooter
                    • Oct 2007
                    • 16000

                    #10
                    In addition, this video may help:
                    http://www.scootersoftware.com/videos/WN3Options.html
                    Aaron P Scooter Software

                    Comment

                    • Aaron
                      Team Scooter
                      • Oct 2007
                      • 16000

                      #11
                      Also, you may not need multiple file formats if all of your files are PDF. If you could go into more detail on how you are using the program, and what you would like to ignore, I believe we could setup a single file format for *.PDF, and then use the session settings Importance tab to control what is compared and what is ignored. If you could include screenshots or sample files in your 2nd email, that would be great.
                      Aaron P Scooter Software

                      Comment

                      • xeatopdk
                        Visitor
                        • Oct 2010
                        • 7

                        #12
                        Originally posted by Aaron
                        Sorry for the confusion. To clarify, if you open a session, and then go to the Tools menu -> File Formats, you are entering a global settings area. Any changes here will affect the entire program
                        Ok. I´m not changing anything in tools -> file formats, just checking if the selected filter has changed according to my session.

                        Originally posted by Aaron
                        Filters (Name Filter and Other Filter, in the Session Settings dialog) are Session Settings, and will save based on the session you are loading or your default session settings when opening a new session.
                        So if filter "do" in file format is selected and I load the "fd" session, then the comparison will use the "fd" filter? (when I´ve saved the session according to your previous post of course :-)

                        Originally posted by Aaron
                        What kind of sessions are you using? Folder Compare sessions with file comparisons run as child sessions or are you saving directly as a few different Text Compare sessions.
                        Folder comparison.

                        Originally posted by Aaron
                        Looking through our [email protected] inbox, I do not see an email from you, and it does not appear it was blocked by our spam security. It may have been blocked on your end; please try sending us an email without an attachment first to see if that can get through. Please include a link back to this forum post in the email so we can link the two cases together.
                        That could be in Our end... I´ve send the mail again, this time without an attachment.

                        Kind regards
                        Kim

                        Comment

                        • xeatopdk
                          Visitor
                          • Oct 2010
                          • 7

                          #13
                          Originally posted by Aaron
                          Also, you may not need multiple file formats if all of your files are PDF. If you could go into more detail on how you are using the program, and what you would like to ignore, I believe we could setup a single file format for *.PDF, and then use the session settings Importance tab to control what is compared and what is ignored.
                          I like to know how you do that. I´ve made several file format for the same pdf mask, cause in one document I need to ignore (this is just a thought example):

                          "BCN\s+\w+-$"
                          but that must not be ignored in another document.

                          Originally posted by Aaron
                          If you could include screenshots or sample files in your 2nd email, that would be great.
                          Did you ever get the first mail? The response indicate this ("thank you for the files and attachment")
                          What kind of screenshots would you like?

                          Kind regards
                          Kim

                          Comment

                          • Aaron
                            Team Scooter
                            • Oct 2007
                            • 16000

                            #14
                            Hello,

                            I replied to your email. Your settings look ok; the key is to make sure to double check the Misc tab in the Session Settings when it appears to "not be working". The Misc tab must be setup for that specific session (a new session or different session will behave differently) and it controls which File Format will be used for your PDF files. If you hit this again, please send in a screenshot of the miscompare and of your Misc tab. It may be you are running into something different.
                            Aaron P Scooter Software

                            Comment

                            Working...