Community
    • Login

    Makro oder Programm für wiederkehrende Änderung.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    8 Posts 3 Posters 1.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Steve HaedeS
      Steve Haede
      last edited by

      Hallo zusammen,

      ich habe folgendes Problem! Bei der Ausgaben von einem G-Code (NC-Code) kommt in vielen Sätzen ein unterschiedlicher F=Vorschubwert heraus.
      Z. B. N010 X=1000 F1410; N015 X=1100 F1415; usw
      Da ich händisch ca. bis zum fünfhundert solche Sätze ändern müsste, würde ich dies über ein Makro machen lassen.
      Ändere alle Werte von F1400 - F1500 in z.b. F1450 oder so ähnlich. Wie kann ich dies lösen.
      Danke
      Gruß-Stephan

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP
        PeterJones @Steve Haede
        last edited by

        @Steve-Haede ,

        Please use English as the primary language in this forum. If you want to double-post with both English and German, that is fine. (Bitte verwenden Sie Englisch als Hauptsprache in diesem Forum. Wenn Sie sowohl auf Englisch als auch auf Deutsch doppelt posten möchten, ist das in Ordnung. )

        If you have a simple condition like change everything from 1400 to 1500, that’s doable. If you want an arbitrary range, like everything from 1427 to 1503, that will be a lot harder. I will show you the simple, and direct you to a plugin for the complicated.

        • Data =
          F1399
          F1410
          F1415
          F1500
          F1517
          
        • FIND = F(1500|14\d\d)
        • REPLACE = F1450
        • Search Mode = Regular Expression

        You can actually get more complicated than that, but changing the range if you are changing your mind each time you run this replacement is not easy.

        If you have a complicated range, it’s probably better expressed in low <= match <= high, in which case, regex alone isn’t enough. However, the PythonScript plugin (which you can install using Plugins > Plugins Admin) will allow you to run a python function on every match and determine the replacement based on arbitrary programming. If you need to go down that route, you can search this forum for add_1, which is the name of an example search callback function described in the PythonScript documentation; it will give the right concept for how to do the search, and in general what the function will look like; you will just have to change the function to only replace the data if the math comparisons work out. If you want to go this route, but need some help, let us know.

        Alan KilbornA 1 Reply Last reply Reply Quote 3
        • Steve HaedeS
          Steve Haede
          last edited by

          Hallo,
          vorab erst einmal vielen Dank, das du dich dem Thema angenommen hast.
          Leider bekomme ich über (suchen und ersetzen) keinen Treffer und somit auch keine neue Belegung der F-Werts.
          Vielleicht mache ich aber auch was falsch!?
          MfG-Stephan

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • PeterJonesP
            PeterJones @Steve Haede
            last edited by

            @Steve-Haede ,

            Did you remember to enable Search Mode = Regular Expression?

            Without regular expression mode
            849a697b-a511-437c-82dd-f40b4a8c175b-image.png

            With regular expression mode
            e6a89785-6d8b-48b4-9b44-3a1228120179-image.png

            Either that, or you data doesn’t actually look like what you presented to us.

            1 Reply Last reply Reply Quote 0
            • Steve HaedeS
              Steve Haede
              last edited by

              Danke, wer lesen kann ist klar im Vorteil.
              Kann man das irgendwo nachlesen, welche Sachen ich eingeben muss, um wie im Beispiel was verändern möchte?
              Es gibt noch andere Dinge ich mal ausprobieren würden.
              Danke und ein schönen Wochenende
              Gruß-Stephan

              PeterJonesP 1 Reply Last reply Reply Quote 0
              • PeterJonesP
                PeterJones @Steve Haede
                last edited by

                @Steve-Haede

                My recent screenshot was just to show you that it matches when Regular Expression was turned on, it would find three matches, whereas with Normal search mode turned on, it finds 0 matches, showing you how important the Regular Expression toggle is for this search. To do that, I needed a dialog that had a Count button, which the Search dialog has, but the Replace dialog does not. The Replace only gives a count if you use Replace All (which would have changed my example text, so you wouldn’t have seen what was matched).

                But to do Replace, you use the Replace menu. I am sorry that I thought that was obvious, and didn’t need to be stated.

                This is an English-language forum. I am sorry if that makes it harder for you to understand. I will attempt to switch my Notepad++ to Deutsch and navigate the menus/dialogs in both English and Deutsch.

                1. Search > Replace… = Suchen > Ersetzen
                2. Search Mode = regular expression = Suchmodus = Reguläre Ausdrüke
                3. Find what = Suchen nach = F(1500|14\d\d)
                4. Replace with = Ersetzen durch = F1450
                5. Find Next = Weiter suchen will highlight the F1410
                  34bc5ba9-8c5c-4a4b-bbf3-633d8ec16226-image.png
                6. Replace = Ersertzen will replace the F1410 with F1450
                  d5226cc2-6cc4-4bcd-9161-b5d2020e8aca-image.png
                7. Replace All = Alle ersetzen will replace all of F1410, F1415, and F1500 with F1450.
                  c6a97319-cad3-45be-913d-8a09e6e43282-image.png

                Notice that when I started, I had

                F1399
                F1410
                F1415
                F1500
                F1517
                

                and when done I had

                F1399
                F1450
                F1450
                F1450
                F1517
                

                The replacement is done through the Replace (Ersetzen) menu and dialog.

                1 Reply Last reply Reply Quote 1
                • Alan KilbornA
                  Alan Kilborn @PeterJones
                  last edited by Alan Kilborn

                  @PeterJones said in Makro oder Programm für wiederkehrende Änderung.:

                  Please use English as the primary language in this forum.

                  I guess this was ignored. :-(
                  It’s easy enough for the reader to “Translate to English”, but I still think the onus is on the poster to post in English.
                  I for one won’t be doing any translating on the reading end in order to answer non-English posts.

                  Steve HaedeS 1 Reply Last reply Reply Quote 0
                  • Steve HaedeS
                    Steve Haede @Alan Kilborn
                    last edited by

                    @Alan-Kilborn said in Makro oder Programm für wiederkehrende Änderung.:

                    @PeterJones said in Makro oder Programm für wiederkehrende Änderung.:

                    Please use English as the primary language in this forum.

                    I guess this was ignored. :-(
                    It’s easy enough for the reader to “Translate to English”, but I still think the onus is on the poster to post in English.
                    I for one won’t be doing any translating on the reading end in order to answer non-English posts.

                    Hello Alan, es gibt bestimmt mehr Menschen die Chinesischs sprechen und schreiben.
                    Also sollte man alles ins Chinesiche Übersetzen, aber Achtung, dann könnt ihr gleich den Block schließen, weil ihr(du) tausende ausgrenzt.
                    Der Link aus meinen Notepad++ geht hier in.
                    Probleme sind das!!!

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    The Community of users of the Notepad++ text editor.
                    Powered by NodeBB | Contributors