Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • September 26, 2016, 09:00:06 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: coded needed launch url's  (Read 4594 times)

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,564
    • View Profile
    • Donate to Member
coded needed launch url's
« on: February 04, 2014, 01:07:06 PM »
I need to adapt this code to launch urls instead of search strings in google with IE.

Code: Autohotkey [Select]
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. #Warn  ; Recommended for catching common errors.pongo ; inicial por error al compilar sobre esta línea.
  3. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5. URL = http://www.google.com/search?q=
  6. navOpenInNewWindow = 1
  7. navOpenInNewTab = 2048
  8. navOpenInBackgroundTab = 4096
  9. navOpenNewForegroundTab = 65536
  10.  
  11. FileSelectFile, filepath
  12. wb := ComObjCreate("InternetExplorer.Application") ; create IE
  13. wb.Visible := true ; 'false' to not show IE
  14. loop, Read, %filepath%
  15. {
  16. if (A_index = 1)
  17.         wb.Navigate2(URL . A_LoopReadLine, navOpenNewForegroundTab) ; Navigate
  18. else
  19.         wb.Navigate2(URL . A_LoopReadLine, navOpenInBackgroundTab) ; Navigate
  20. sleep 100
  21. }
  22. return

How can i do that ?

 :-*


MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,158
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: coded needed launch url's
« Reply #1 on: February 04, 2014, 01:28:52 PM »
In the navigate calls delete the "URL . " from the font and just use  A_LoopReadLine

The file should have a URL per line instead of a search string


Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,564
    • View Profile
    • Donate to Member
Re: coded needed launch url's
« Reply #2 on: February 04, 2014, 04:28:40 PM »
thanks very much Miles
Goes like the angels.

 :-*

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,564
    • View Profile
    • Donate to Member
Re: coded needed launch url's
« Reply #3 on: February 04, 2014, 09:15:17 PM »
Miles the difficult point seems to be the same script for Firefox and other browsers. Exists or is a pending task ?


Best Regards

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,158
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: coded needed launch url's
« Reply #4 on: February 05, 2014, 06:43:37 AM »
Miles the difficult point seems to be the same script for Firefox and other browsers. Exists or is a pending task ?


Best Regards


IE based browsers have an ActiveX engine hat can be programed.  That's why BrowserBunch ignores it.  It's a different animal than Firefox/Opera/chrome.

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,564
    • View Profile
    • Donate to Member
Re: coded needed launch url's
« Reply #5 on: February 05, 2014, 07:27:59 AM »
Miles the difficult point seems to be the same script for Firefox and other browsers. Exists or is a pending task ?


Best Regards


IE based browsers have an ActiveX engine hat can be programed.  That's why BrowserBunch ignores it.  It's a different animal than Firefox/Opera/chrome.

I don't understand. What is an engine hat ?. What sort of animal is Firefox , or chrome, or opera ?
What are the similar scripts for these animals ?
have you a rabbit in your hat ?
 :-[

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,564
    • View Profile
    • Donate to Member
Re: coded needed launch url's
« Reply #6 on: February 05, 2014, 07:28:54 AM »
AutoIt has a UDF to automate Firefox.

What is the animal prepared for this in AHK ?

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,398
    • View Profile
    • Donate to Member
Re: coded needed launch url's
« Reply #7 on: February 05, 2014, 06:52:23 PM »
You're opening a set of URLs, there's no need to automate Firefox - just call Firefox with the URL as an argument, (Firefox' commandline args).

Code: AutoIt [Select]
  1. Run(@comspec & ' /c path\to\firefox.exe "www.thisisatest.org"', '.', @SW_HIDE)

You can probably call Chrome the same way.

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,564
    • View Profile
    • Donate to Member
Re: coded needed launch url's
« Reply #8 on: February 05, 2014, 08:46:39 PM »
You're opening a set of URLs, there's no need to automate Firefox - just call Firefox with the URL as an argument, (Firefox' commandline args).

Code: AutoIt [Select]
  1. Run(@comspec & ' /c path\to\firefox.exe "www.thisisatest.org"', '.', @SW_HIDE)

You can probably call Chrome the same way.

Running to try.

But how can we automate Firefox with AHK ?

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,398
    • View Profile
    • Donate to Member
Re: coded needed launch url's
« Reply #9 on: February 05, 2014, 09:07:50 PM »

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,564
    • View Profile
    • Donate to Member
Re: coded needed launch url's
« Reply #10 on: February 05, 2014, 09:16:04 PM »

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,564
    • View Profile
    • Donate to Member
Re: coded needed launch url's
« Reply #11 on: February 05, 2014, 09:17:25 PM »
Perhaps the question is bad expressed.

How to automate internet when using firefox browser ?

 :-*

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,398
    • View Profile
    • Donate to Member
Re: coded needed launch url's
« Reply #12 on: February 05, 2014, 10:20:12 PM »
Your original question was that you wanted to open a list of URLs in Firefox, have you tried it?

firefox.exe -new-tab URL1
firefox.exe -new-tab URL2
etc
etc
etc

Do you want to open a list of URLs as per your original question or do something completely different?
« Last Edit: February 05, 2014, 11:55:50 PM by 4wd, Reason: GFU »

Contro

  • Participant
  • Joined in 2007
  • *
  • Posts: 2,564
    • View Profile
    • Donate to Member
Re: coded needed launch url's
« Reply #13 on: February 06, 2014, 09:42:18 AM »
Your original question was that you wanted to open a list of URLs in Firefox, have you tried it?

firefox.exe -new-tab URL1
firefox.exe -new-tab URL2
etc
etc
etc

Do you want to open a list of URLs as per your original question or do something completely different?

gnnnnngggnnnnn gnnngg arrrrrrgggghahhhhhhhhhhhhhhhh

 >:(

Sure is possible, but then I will need to adapt to every url's list i have. Not confortable.

At this point of the "movie" I think must be alternatives ways to automate firefox, chrome, safari, yandex, etc with AHK.

But not with a UDF like with autoit.
I begin to understand alternatives, like que development scripting o something each browser have.....

 :tellme:

Vurbal

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 633
  • Mostly harmless
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: coded needed launch url's
« Reply #14 on: February 06, 2014, 05:26:56 PM »
Your original question was that you wanted to open a list of URLs in Firefox, have you tried it?

firefox.exe -new-tab URL1
firefox.exe -new-tab URL2
etc
etc
etc

Do you want to open a list of URLs as per your original question or do something completely different?

gnnnnngggnnnnn gnnngg arrrrrrgggghahhhhhhhhhhhhhhhh

 >:(

Sure is possible, but then I will need to adapt to every url's list i have. Not confortable.

At this point of the "movie" I think must be alternatives ways to automate firefox, chrome, safari, yandex, etc with AHK.

But not with a UDF like with autoit.
I begin to understand alternatives, like que development scripting o something each browser have.....

 :tellme:

If you have to reformat them to work with the command line 4wd posted they must not be URLs. The U in URL stands for uniform in reference to the fact they are always in the same standard format. Anything not in that format is not a URL.
I learned to say the pledge of allegiance
Before they beat me bloody down at the station
They haven't got a word out of me since
I got a billion years probation
- The MC5

Follow the path of the unsafe, independent thinker. Expose your ideas to the danger of controversy. Speak your mind and fear less the label of ''crackpot'' than the stigma of conformity.
- Thomas J. Watson, Sr

It's not rocket surgery.
- Me


I recommend reading through my Bio before responding to any of my posts. It could save both of us a lot of time and frustration.

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 4,398
    • View Profile
    • Donate to Member
Re: coded needed launch url's
« Reply #15 on: February 06, 2014, 09:10:53 PM »
I honestly despair at moments like this.

1) Read a URL from the text file
2) Execute Firefox, (or Chrome), with it as an argument.
3) Go to step 1

Exactly how is this any different from what you are doing for IE?

ie. Replace this:

Code: Autohotkey [Select]
  1. if (A_index = 1)
  2.   wb.Navigate2(URL . A_LoopReadLine, navOpenNewForegroundTab) ; Navigate
  3. else
  4.   wb.Navigate2(URL . A_LoopReadLine, navOpenInBackgroundTab) ; Navigate

with this:

Code: Autohotkey [Select]
  1. Run, Firefox.exe -new-tab A_LoopReadLine, C:\Program Files\Mozilla\Firefox

NOTE: Because I don't use AHK, YOU may have to tweak that line.

I don't use AHK
Code: Autohotkey [Select]
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. #Warn  ; Recommended for catching common errors.pongo ; inicial por error al compilar sobre esta línea.
  3. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5.      
  6. FileSelectFile, filepath
  7. loop, Read, %filepath%
  8. {
  9. Run, Firefox.exe -new-tab A_LoopReadLine, C:\Program Files\Mozilla\Firefox
  10. sleep 100
  11. }
  12. return


MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,158
    • View Profile
    • Miles Ahead Software
    • Donate to Member
Re: coded needed launch url's
« Reply #16 on: February 07, 2014, 09:39:43 AM »
@4wd what you posted is what BrowserBunch does with a few additional options.  I haven't tried IE in awhile, but I don't support it because the last time I tested it, I could not get it to open URLs in a new tab. I set the setting that's supposed to get it to open URLs in a new tab.  But I found many complaints the setting did not work on the web.  In any case for IE based browsers they can use the ActiveX approach.

There may be a way to automate other browsers from the inside, using an AddOn or JavaScript or something.  But I think it would require customization for each.  That's exactly what I tried to avoid in BrowserBunch.  Just a simple launcher that would work with any browser that accepted multiple URLs on the command line, and could be set to open new pages in a new tab.

Why BrowserBunch will not be updated
Unfortunately I lost all my include files.  Most of the utilities I've written in AutoIt3 used multiple includes.  Since AHK is much more powerful for hotkeys, I'm just going to let the AU3 stuff whither on the vine.  It's just too much work to try to regenerate the sources.