Community
    • Login

    Want to change the google search to customer search.

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    35 Posts 7 Posters 14.2k 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.
    • PeterJonesP
      PeterJones
      last edited by

      Google translate usually generates passable English, but I thought I would be able to recognize text that had gone thru translator as compared to even a non-native trying to translate his language into English. I guess deepl is pretty convincing. :-)

      Don’t let my laziness of letting the xml-parser handle my malformed XML corrupt you into to taking shortcuts. I don’t use XML for more than editing config files here and elsewhere, and such applications often follow the adage “Be conservative in what you send, be liberal in what you accept” (Postel’s Law). If I were writing XML for a living, I’d be much more strict in any XML example I gave. It’s best to always use entities for those 5 characters in XML when you are writing XML.

      1 Reply Last reply Reply Quote 2
      • EkopalypseE
        Ekopalypse
        last edited by

        To be honest, I don’t know if I’m using it correctly at all because I let it translate from English into German
        and I’m changing it until the German translation makes sense to me.
        But it looks like it generates a much better English translation this way than the other way around.
        Which, of course, could mean, that I constantly produce English text with German grammar :-)

        With google translate I wasn’t able to get a proper result using it this way
        but have to admit that I haven’t used it for quite some time now.
        And if used in the normal way, it always made me feel that there is something wrong.
        But who knows, maybe it is much better nowadays.

        1 Reply Last reply Reply Quote 1
        • PeterJonesP
          PeterJones
          last edited by

          Back on topic:

          I was curious, so I followed these directions to create a fake URL protocol/scheme (“alert:xxx”), but I just passed it to cmd /c "echo %1 && pause". After refreshing my login, I then updated shortcuts.xml to add an Run > alert using Alt+F5:

              <Command name="alert" Ctrl="no" Alt="yes" Shift="no" Key="116">alert:$(CURRENT_WORD)</Command>
          

          When running that, with the text 123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x123456789x selected, it stops at 259 characters, including the alert: protocol prefix. I hadn’t realized that the 260-character limitation would apply to commands as well as filenames.

          I haven’t found anywhere where there’s a 260+/-1 hardcoded in Notepad++ source code that would influence this (one of the Lexers apparently hardcodes a 260-character limit in one of its buffers, but none others that appeared to deal with strings), so maybe it’s really in the libraries that NPP chose to handoff to windows, or something.

          Adding a command-based rather than URL-based:

              <Command name="alertcmd" Ctrl="no" Alt="yes" Shift="no" Key="118">cmd /c "echo $(CURRENT_WORD) && pause"</Command>
          

          I successfully passed that up to 2047 characters in $(CURRENT_WORD).

          With that in mind, and the launch in browser syntax, I created

               <Command name="cmdurl" Ctrl="no" Alt="yes" Shift="no" Key="119">chrome file:$(CURRENT_WORD)"</Command>
          

          which launches chrome with the given file: URL. I was able to pass it 2047 characters no problem

          So edit cmdurl to the @Cary-Korn’s original long-URL example, with proper &amp;-entities:

               <Command name="cmdurl" Ctrl="no" Alt="yes" Shift="no" Key="119">chrome https://test.my.testforce.com/_ui/search/ui/UnifiedSearchResults?searchType=2&amp;sen=a0T&amp;sen=0WO&amp;sen=a0W&amp;sen=ka&amp;sen=00O&amp;sen=00P&amp;sen=a0b&amp;sen=00T&amp;sen=015&amp;sen=00U&amp;sen=a4j&amp;sen=a1F&amp;sen=a0h&amp;sen=00a&amp;sen=a1S&amp;sen=0F9&amp;sen=a1U&amp;sen=08p&amp;sen=a1X&amp;sen=a3c&amp;sen=02s&amp;sen=001&amp;sen=068&amp;sen=003&amp;sen=500&amp;sen=005&amp;sen=501&amp;sen=006&amp;sen=a6M&amp;sen=a0L&amp;sen=a0M&amp;str=$(CURRENT_WORD)</Command>
          

          When I did that, it hit a limit of the ~260 characters again. (Though, this time, instead of clipping, it wrapped around and started the URL over for a few more characters; it was weird). I think that the way that command-line arguments are being sent to ShellExecute, and/or how ShellExecute is handling them, is limiting the argument to a command to be ~260 characters.

          1 Reply Last reply Reply Quote 3
          • PeterJonesP
            PeterJones
            last edited by PeterJones

            So, the end-result is: @Cary-Korn, try to pare down your URL to be able to be significantly less than 260 characters without the $(CURRENT_WORD) value, so that it will stay <260-characters with that value embedded in the URL. Or use some sort of URL-shrinking service that allows passing parameters, so you could use https://fake.url/shortener?str=$(CURRENT_WORD), where all the other parameters are internal to the url-shortener service.

            EkopalypseE 1 Reply Last reply Reply Quote 2
            • EkopalypseE
              Ekopalypse @PeterJones
              last edited by

              @PeterJones

              I guess you are on the right track. I assume the underlying create process is the culprit.
              As stated on msdn

              The maximum length of this string is 32,768 characters, including the Unicode terminating null character.
              If lpApplicationName is NULL, the module name portion of lpCommandLine is limited to MAX_PATH characters.

              1 Reply Last reply Reply Quote 2
              • Cary KornC
                Cary Korn
                last edited by

                Thanks for all the help. I have played with the url trying to shorten it but it seems to glitch the search. It keeps asking for the search to be more than 2 characters long. The url shorten might work just not sure of any service that can parse the search term to make it work. This might be something that is just not possible with this site.

                Meta ChuhM 1 Reply Last reply Reply Quote 2
                • Meta ChuhM
                  Meta Chuh moderator @Cary Korn
                  last edited by Meta Chuh

                  @Cary-Korn

                  just a thought, to get the line shorter within notepad++:

                  can you perform a search from a test.cmd batch file ?
                  if yes, you can try to call your_path_to\test.cmd $(CURRENT_WORD) or your_path_to\test.cmd "$(CURRENT_WORD)" inside shortcuts.xml, to keep the notepad++ executable line as short as possible.

                  shortcuts.xml example:

                  <Command name="test" Ctrl="no" Alt="no" Shift="no" Key="0">C:\Users\user\test.cmd $(CURRENT_WORD)</Command>
                  

                  inside the batch file $(CURRENT_WORD) will be reflected as %1

                  1 Reply Last reply Reply Quote 1
                  • cipher-1024C
                    cipher-1024
                    last edited by

                    Does NppExec suffer from the same character limitations? Seems like that would work or I’m sure you could use a python script.

                    1 Reply Last reply Reply Quote 2
                    • Cary KornC
                      Cary Korn
                      last edited by

                      Python is beyond my skill.

                      1 Reply Last reply Reply Quote 0
                      • Cary KornC
                        Cary Korn
                        last edited by

                        I tried the .bat option and it looks like it still cuts off the url. It will not take the highlight search term and parse it into the url. I though this was going to be an easy thing.

                        Meta ChuhM 1 Reply Last reply Reply Quote 1
                        • Meta ChuhM
                          Meta Chuh moderator @Cary Korn
                          last edited by

                          @Cary-Korn

                          if it does not even work from a .bat or .cmd with the length of your url, i suppose it is beyond of anything that can be started from a command line.

                          if this url is that long, you could try to run it through the windows explorer api, by creating a link shortcut (.lnk file) by right clicking on your desktop, and creating new > shortcut, with the parameters "path_to_your\browser.exe" "https://your_long_url"

                          if your url would work from a desktop shortcut (.lnk), you could use a script, or one of the available exe tools on the internet, to create a .lnk file programmatically.

                          1 Reply Last reply Reply Quote 1
                          • PeterJonesP
                            PeterJones
                            last edited by

                            @Cary-Korn said:

                            I tried the .bat option and it looks like it still cuts off the url. It will not take the highlight search term and parse it into the url. I though this was going to be an easy thing.

                            It would have been easy, except you’re dealing with the interface between an application and windows and another application; there are some things that are out of your control.

                            However, I think I found a .bat variant that will work.

                            Create a batchfile at a known location (I made mine as c:\usr\local\scripts\longurl.bat), containing the single line

                            "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "https://test.my.testforce.com/_ui/search/ui/UnifiedSearchResults?searchType=2&sen=a0T&sen=0WO&sen=a0W&sen=ka&sen=00O&sen=00P&sen=a0b&sen=00T&sen=015&sen=00U&sen=a4j&sen=a1F&sen=a0h&sen=00a&sen=a1S&sen=0F9&sen=a1U&sen=08p&sen=a1X&sen=a3c&sen=02s&sen=001&sen=068&sen=003&sen=500&sen=005&sen=501&sen=006&sen=a6M&sen=a0L&sen=a0M&str=%1"
                            

                            The first part is the full path to the chrome browser, in quotes (because of the spaces in the path); the second part is all of the long url, except the search term; use the %1 instead of the search term. (If you don’t want to use chrome, use the full path to your browser executable of choice.)

                            Second, edit shortcuts.xml and add

                                <Command name="longurl" Ctrl="no" Alt="yes" Shift="no" Key="116">c:\usr\local\scripts\longurl.bat $(CURRENT_WORD)</Command>
                            

                            (making sure to use your batchfile path, not mine.)

                            Save, exit Notepad++, reload. Highlight a word (I highlighted TestString) and hit Alt+F5 (which is the alias I used in the command above): this properly opened chrome with the full URL, including the search string; because it was a dummy URL, it didn’t go anywhere, but chrome displayed the full URL through the end of the TestString, which is something that hadn’t happened in my previous experiments.

                            1 Reply Last reply Reply Quote 3
                            • andrecool-68A
                              andrecool-68 @Cary Korn
                              last edited by

                              @PeterJones said:
                              On what site do you want to search from Notepad++?
                              This site does not exist "https://test.my.testforce.com/

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

                                @andrecool-68 ,

                                I was just using the OP’s dummy query, which was obfuscated to prevent us from knowing what site they were actually searching. (My guess is it is one of the services that provides cloud-based services for corporations, and the OP was trying to obscure which one.)

                                Given that the root cause of the problem was not the website, but the interface between Notepad++, Windows, and the browser, it doesn’t bother me that the OP used a dummy website (though really, using the .example top-level domain is a better choice than trying to fake a .com; you never know when creating a dummy URL with a legal-style domain will accidentally intersect with a real machine).

                                The fake URL given was sufficient to show us the problem; and using that fake URL, I was able to present a solution that would allow the entire more-than-260-character URL to be passed to the browser, so it was a reasonable choice.

                                andrecool-68A 1 Reply Last reply Reply Quote 1
                                • andrecool-68A
                                  andrecool-68 @PeterJones
                                  last edited by

                                  @PeterJones
                                  I did a search on the site from Notepad++, it is necessary to see how the search engine makes a request. Each machine has different requests. Here are my examples (my code does not insert, says it’s spam and I took a screenshot )

                                  Alan KilbornA 1 Reply Last reply Reply Quote 0
                                  • Alan KilbornA
                                    Alan Kilborn @andrecool-68
                                    last edited by

                                    @andrecool-68

                                    Maybe I’m dumb here, but why wouldn’t all sites do it differently? I mean, they could do it the same way (sometimes “standards” develop by imitation), but…

                                    1 Reply Last reply Reply Quote 1
                                    • PeterJonesP
                                      PeterJones
                                      last edited by

                                      @andrecool-68 ,

                                      Based on the thread as a whole, I am confident we have provided enough information for @Cary-Korn to know where in the URL the $(CURRENT_WORD) needs to go (ie, in the place of the “str=test” in the example dummy URL that @Cary-Korn provided), regardless of what search engine is used. If @Cary-Korn obfuscated the real URL being used, I am working under the assumption that there will be no difficulty un-obfuscating the URL back to something that is functional.

                                      The problem being asked about in this thread was not “what is the right URL for such-and-such a search engine?” The question was how to transmit said URL to the browser without the end being cut off. That’s the problem I attacked, and has worked in my tests of my solution.

                                      Meta ChuhM 1 Reply Last reply Reply Quote 1
                                      • Meta ChuhM
                                        Meta Chuh moderator @PeterJones
                                        last edited by Meta Chuh

                                        maybe QTranslate is not the perfect translator after all 😉

                                        @andrecool-68

                                        the url that the original poster needs is very long.
                                        it is so long, that it gets cut off and shortened.
                                        the resulting url is incomplete at his browser’s address bar.
                                        (his browser gets only a part of the complete url address that is necessary for the search to work.)

                                        now we just have to sit and wait, because the original poster has not yet replied to peter’s last suggestion on how he could work around this url string length restriction.

                                        1 Reply Last reply Reply Quote 0
                                        • andrecool-68A
                                          andrecool-68
                                          last edited by

                                          Gentlemen and comrades …I wanted to say that without knowing the real address of the site to find a solution to this problem can not be. And I didn’t want to insult anyone …I conduct correspondence through Google-translator

                                          Meta ChuhM 1 Reply Last reply Reply Quote 1
                                          • Meta ChuhM
                                            Meta Chuh moderator @andrecool-68
                                            last edited by

                                            @andrecool-68 said:

                                            I wanted to say that without knowing the real address of the site to find a solution to this problem can not be.

                                            yes i know, but somehow this topic has caught our interest.

                                            I didn’t want to insult anyone …

                                            don’t worry, i can not see anything insulting. google translator did not add any hidden insults to your text ;-)

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