Welcome Guest.   Make a donation to an author on the site November 01, 2014, 06:58:58 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2013! Download dozens of custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: Prev 1 [2]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: SelectoSurf v1.1.0 - Jan 25,2008 - AutoHotkey script to open plaintext URLs  (Read 32529 times)
Contro
Participant
*
Posts: 2,171

View Profile Give some DonationCredits to this forum member
« Reply #25 on: February 05, 2014, 06:55:45 AM »

mouser

I try "this word". Wonderful !!!!
Logged
IainB
Supporting Member
**
Posts: 4,811


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #26 on: February 05, 2014, 09:40:15 PM »

@mouser: I had seen neither this discussion thread nor this NANY AHK app before, so I downloaded the app and cribbed the AHK code, inserting it into my main AHK file (maintaining references to the source).
I made a change to the code because my default search engine is DuckDuckGo, so, where the code had:
Formatted for Autohotkey with the GeSHI Syntax Highlighter [copy or print]
  1. theurl = http://www.google.com/search?hl=en&q=`%22%theurl%`%22
- I put:
Formatted for Autohotkey with the GeSHI Syntax Highlighter [copy or print]
  1. ;theurl = http://www.google.com/search?hl=en&q=`%22%theurl%`%22
  2. theurl = http://duckduckgo.com/?q=`%22%theurl%`%22
(i.e., commenting out the Google search.)

Also, where you had written in the code comments:
Formatted for Autohotkey with the GeSHI Syntax Highlighter [copy or print]
  1. ; otherwise a google (or other) search will be confucted with the phrase.
- by "confucted"did you mean "conflated"?    tellme

I have for a long time now been wanting to automate this URL/search string process, as it is something that I frequently need to do and it is tedious (manually repetitive) and inefficient.
Using the code you provide could potentially save me accumulated hundreds of hours in the future, so thankyou very much.

By the way, whilst I was playing about with the code, I compared using the code to search for a string with Google and then with DuckGo, there was an interesting difference (see below). The text I selected for the search was "SelectoSurf":

Google gave 4 results:




DuckGo gave 1 summary result:




I'd say the DuckGo output was the more efficiently organised.
« Last Edit: February 05, 2014, 09:49:35 PM by IainB » Logged
Contro
Participant
*
Posts: 2,171

View Profile Give some DonationCredits to this forum member
« Reply #27 on: February 05, 2014, 10:30:44 PM »

 Grin

Since Skwire made the wonderful ControTextTool I use duckduck for reasonable reasons !!!!!!!
I specially like the only page browsing method to select all about the string searched.
Sometimes I don't feel confortable because of the reasons given by IainB, but at the present time I am 75% DDG and 25% Google or other search engines.

A few days ago I found Yandex that seems to be in the backyard of DDG. And the Yandex browser seem very familiar with Google Chrome....

Since last year I was trying to download the Oscar Ceremony Awards 2012 from everywhere : emule, torrents, etc. with no success until finally i get a copy in russian.
Here in Spain is very difficult to obtain a copy of those events. Even two or more years ago. Now seems easy with torrents. I am not talking about see that ceremony a month after the celebration. I am talking about see the ceremony of the oscars 2012 now, and the oscars 2013 next year.....

Even I obtain my first yandex account. Just because more and more russians come to canary islands and is interesant to learn russian or at least have an account from russian specially now they translate to english everything.

In my opinion there is a total globalization with impredictible results. Not obviously in the knowledge of people or feel more near. I refer to this race where seems only a winner must stay.

And the winner seems to be google......

 tongue





Logged
IainB
Supporting Member
**
Posts: 4,811


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #28 on: February 06, 2014, 05:11:40 PM »

@Contro: Ah, I begin to see why you would be interested in searches.
I am not sure whether you know it, but there are also some rather good search aids in @mouser's FARR - the built-in search aliases:



The default is the first one - Google. If you wanted to change the order and make another one the default, you could do that, but you'd presumably need to ask @mouser to change it as those aliases are apparently locked (read-only). Similarly, if you wanted to add a new search engine - e.g., (say) Yandex - then you'd need to ask @mouser to make a change for that too.
(I suppose it might be better if the FARR search alases were preset as now, but editable, with a "Restore to default" button for if the user had made a mess of things or just wanted to get whatever were the current FARR version's search alias defaults/presets.)
Logged
IainB
Supporting Member
**
Posts: 4,811


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #29 on: July 27, 2014, 01:22:51 AM »

Posted at: Re: hotkey to launch google search in a new firefox tab
@mouser provided a rather nifty bit of code for AutoHotKey use (called Selectosurf) to do what you seem to want. You just select the text or URL that you want to search for, press the hotkeys Ctrl+Space (this can be changed), and the search engine of your choice (see lines 88, 89 in the code window below), and your browser opens a search result panel/window.
If you search on the DC Forum for Selectosurf, you will come up with these discussion threads:

I use it as per below, to invoke a duckduckgo search. It's rather fast. It puts the search string as a specific literal inside double quotes though, which you might want to change or vary.

Formatted for Autohotkey with the GeSHI Syntax Highlighter [copy or print]
  1. SelectoSurf: ;Sends selected plaintext url or other string and opens it in a browser or search.
  2. ;  Based on SelectoSurf by mouser@donationcoder.com
  3. ;  see http://www.donationcoder.com/Forums/bb/index.php?topic=6714.0
  4. ; v 1.1.0, Jan 25, 2008 - improved browser option, added split-line reconstruction, added about box
  5. ; v 1.0.2, Nov 10, 2006 - initial release
  6. ;
  7. ; Select plaintext in any program and hit the hotkey (ctrl+space)
  8. ; If the text looks like a url or website name (like donationcoder.com), it will be opened
  9. ;  otherwise a google (or other) search will be confucted with the phrase.
  10. ;------------------------------------------------------------------
  11. ; ATTN, OPTIONAL: configure a specific browser overide, to bypass using default
  12. ;browserexe = iexplore.exe
  13. ;browserexe = C:\Program Files\Mozilla Firefox\firefox.exe
  14. ;------------------------------------------------------------------
  15. temp = %clipboard% ; grab old clipboard
  16. Send, ^c ; send ctrl+C to copy new text to clipboard
  17. Sleep 100 ; sleep a tiny bit to give a chance for clipboard to propage
  18. theurl = %clipboard% ; *potential* url
  19. ;
  20. ; merge split lines
  21. StringReplace, theurl, theurl, `r`n,, All
  22. StringReplace, theurl, theurl, `r,, All
  23. StringReplace, theurl, theurl, `n,, All
  24. ;
  25. ; clean spaces
  26. StringReplace, theurl, theurl, %A_Space%,`%20, All
  27. ;
  28. ; Lets do some other common replacements
  29. StringReplace, theurl, theurl, hxxp:,http:, All
  30. StringReplace, theurl, theurl, hxxps:,http:, All
  31. StringReplace, theurl, theurl, h??p:,http:, All
  32. StringReplace, theurl, theurl, h??ps:,http:, All
  33. ;
  34. ; remove any leading or trailing () [] . " '
  35. theurl := RegExReplace(theurl, "^[\.\(\)\'\[\]""]+")
  36. theurl := RegExReplace(theurl, "[\.\(\)\'\[\]""]+$")
  37. ;--------------------------
  38. ; is it a full url
  39. isaurl = 0
  40. IfInString, theurl, http:
  41. {
  42. isaurl = 1
  43. }
  44. else IfInString, theurl, https:
  45. {
  46. isaurl = 1
  47. }
  48. else IfInString, theurl, mailto
  49. {
  50. isaurl = 1
  51. }
  52. else IfInString, theurl, ftp:
  53. {
  54. isaurl = 1
  55. }
  56. else IfInString, theurl, www.
  57. {
  58. isaurl = 1
  59. }
  60. else IfInString, theurl, .com
  61. {
  62. isaurl = 1
  63. theurl = www.%theurl%
  64. }
  65. else IfInString, theurl, .net
  66. {
  67. isaurl = 1
  68. theurl = www.%theurl%
  69. }
  70. else IfInString, theurl, .org
  71. {
  72. isaurl = 1
  73. theurl = www.%theurl%
  74. }
  75. {
  76. ; @sign with no spaces is an email
  77. ; ATTN: toddo
  78. if (0==1)
  79. {
  80. ; add a mailto
  81. theurl = mailto:%theurl%
  82. isaurl = 1
  83. }
  84. {
  85. ; search for the string - note this makes isaurl true always, which is what we want.
  86. ;theurl = http://www.google.com/search?hl=en&q=`%22%theurl%`%22
  87. theurl = http://duckduckgo.com/?q=`%22%theurl%`%22
  88. isaurl = 1
  89. }
  90. }
  91. ;--------------------------
  92. ; launch it?
  93. if (isaurl = 1)
  94. {
  95. ; beep?
  96. ; SoundBeep
  97.  
  98. ; launch explorer with url
  99. if (browserexe != "")
  100. {
  101. Run, %browserexe% %theurl%
  102. }
  103. {
  104. Run %theurl%
  105. }
  106. }
  107. ;--------------------------
  108. ; restore clipboard
  109. clipboard = %temp%
  110. ;--------------------------
  111. ; all done
  112. ;--------------------------
Logged
IainB
Supporting Member
**
Posts: 4,811


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #30 on: July 27, 2014, 01:26:01 AM »

Posted at: Re: hotkey to launch google search in a new firefox tab
Thanks a ton IaianB!
Riding on your script from Mouser, I made an ahk script to find Firefox, create a new tab, and open the search results:
...
_______________________________

I'm very pleased to see that it was of use/help.
I see that your nice and short script uses the AHK InputBox, and is browser-specific.

I am always interested in trying out scripts and proggies to test them to see whether they do what they were intended/designed for, and what makes them fail, and what they do when they fail or are presented with input that was not necessarily intended in their design - for example, what they might do when things cause them to fail in some manner.

Testing a script under different conditions is useful, because the good/effective or bad things about a script might not always be immediately apparent. In the case of Selectosurf some interesting points/features/possibilities are:
  • 1. Housekeeping: The script makes a copy of the Clipboard current state before sending a copy command to capture the text highlighted by the user. At the end of the script, the saved clipboard state is replaced, overwriting any changes that the script may have made to the clipboard whilst the script was running. So you won't see the copied text in (for example) the CHS (Clipboard Help and Spell) list of recently copied text (it's called the "QuickPaste" list in CHS). It is good practice for a script to do some tidy up housekeeping after itself like this. But you might not want that. You might want to (say) keep any text you searched for, retained in QuickText. You can modify the script to do that by commenting out the housekeeping bits.

  • 2. Browser: You can get it to use either the system default browser, or a specific browser which might not be the system default browser. This allows flexibility under the user's control.

  • 3. Search engine: You have to specify the search engine in the parameters sent to the browser. This allows flexibility/choice under the user's control. However, you could modify this to just passing the assembled search text to the browser address bar ("awesome bar"), which could have been already set to apply that browser's default search engine to whatever was put in the address bar. More user choice.

  • 4. Failure state: (Potentially very useful.) If the user does not select any text and presses the hotkeys to activate Selectosurf anyway, then the script does not fail (it makes a null copy capture) but picks up the last thing you happened to copy into the clipboard - could be an image or text, for example.
    If you happen to be setting about collecting lots of material and references to search, then knowing this enables you to turn the combination of Selectosurf and CHS' QuickPaste (or whatever other Clipboard manager you might be using) into an incredibly useful. time-saving combination tool. You could go around copying the chunks of text - which may be either specific strings of text that you want to research or which may include some such specific strings in disconnected form. You can then select (click on) each item in turn from the CHS QuickPaste list and invoke Selectosurf in the usual way, for that item (ensure your mouse is not selecting any text at the time).
    This works because selecting the item from the QuickPaste list pushes it into the Clipboard as "the last copied item", which is what Selectosurf falls back on when it makes a null copy capture (as above).
    Before you do that though, if the item is a larger lump of text containing some text that would be irrelevant for a required search, then you can quickly edit it in CHS to reduce it to just that specific text string that you want to search for, and that goes into the QuickPaste list.
    General note: You probably need to be mindful of whether you want the script to constrain the string to be an explicit literal field (inside double quotes):
    e.g. something like:
    •          
Formatted for Autohotkey with the GeSHI Syntax Highlighter [copy or print]
  1. theurl = http://duckduckgo.com/?q=`%22%theurl%`%22
or approximate (without quotes):
  •          
Formatted for Autohotkey with the GeSHI Syntax Highlighter [copy or print]
  1. theurl = http://duckduckgo.com/?q=%theurl%
    - when it is sent/put into the search box, as this will necessarily govern the outcome - i.e., the search result.
    (After some experiment, I think I find the latter more useful.)

    [/li]
    [li]5. Autocopy: If you have Firefox, you can use the AutoCopy extension:
    Quote
    Select text on any web page and it will be automatically copied to the clipboard. It works in much the same way as does Trillian or mIrc.
    Paste on middle click into textboxes, the url bar, and the search bar.
    _______________________________________________
    For capturing text strings containing more than one word, you have to select them all using the mouse, whereupon they are copied to the Clipboard.
    For capturing text strings containing just one word, double-clicking on the single word selects and copies that single word to the Clipboard.
    As above in point 4, if using (say) CHS:
    Quote
    You can then select (click on) each item in turn from the CHS QuickPaste list and invoke Selectosurf in the usual way, for that item. This works because selecting the item from the QuickPaste list pushes it into the Clipboard as "the last copied item".  Before you do that though, if the item is a larger lump of text containing some text that would be irrelevant for a required search, then you can quickly edit it in CHS to reduce it to just that specific text string that you want to search for, and that goes into the QuickPaste list.
    _____________________
    With a clipboard manager such as (say) CHS, this can be very handy/speedy when gathering reference strings, as it puts them into the "latest captures" list - the QuickPaste list. If you select a string, using the mouse, and then invoke Selectosurf, the selected item goes into the Clipboard (and thus the CHS QuickPaste list) before Selectosurf saves the Clipboard state and makes its own copy of the selected item (which copy is later expunged when the script exits).
    The degree of control possible over CHS puts the user in full control of using things like the QuickPaste list and even the content and order/sequence of items on it, making it an ideal tool for this sort of repetitive collection-and-research process.
    [/li]

I mention these points/features/possibilities because you describe your nice and short script as being derived from ("Riding on") the Selectosurf script, and your script uses the AHK InputBox, and is browser-specific.
The InputBox could be an area for potential process improvement, by eliminating it altogether when/if it is redundant.
It thus occurred to me that you might be unaware of the above Selectosurf points/features/possibilities. I imagined you manually typing each search string (text item) into the InputBox, and wondered how many times that might be repeated with different/new strings and how many hours that might consume over a researcher's lifetime, when one could perhaps easily automate the data capture aspect to a major extent, thus avoiding most/all of the manual input, and leaving you at liberty to use the freed up cognitive surplus for something more interesting/enjoyable.

So, just some thoughts. Hope they are not too jumbled.

I abhor using manual processes where automation can be more usefully applied, and I am often appalled when I come across some unnecessary and repetitive tedium that we have unwittingly imposed upon ourselves or others.

All kudos to @mouser and his Selectosurf and CHS.
Logged
IainB
Supporting Member
**
Posts: 4,811


Slartibartfarst

see users location on a map View Profile Give some DonationCredits to this forum member
« Reply #31 on: July 27, 2014, 01:58:04 AM »

After making the above posts, I commented out the "housekeeping" lines 15 and 112 in my SelectoSurf script (above), so now CHS and the QuickPaste menu also contain any recent search strings passed to SelectoSurf (they would previously have been expunged).
My view is that this is collecting potentially useful clipboard detritus which I can always delete later if I don't need it for anything.
Logged
Contro
Participant
*
Posts: 2,171

View Profile Give some DonationCredits to this forum member
« Reply #32 on: July 28, 2014, 09:02:46 AM »

Running to see  Grin
Best Regards
Logged
Pages: Prev 1 [2]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.142s | Server load: 0.21 ]