Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
get latest chrome .exe installer from sourceforge
#1
I want a macro that get's the URL of latest installer (highest version) from this page:
http://sourceforge.net/projects/portabl ... 20Versions

It must be done without using the browser:

Each .exe link contains the version number like this:

Code:
Copy      Help
...s/GoogleChromePortable_32.0.1700.76_online.paf.exe/download...
...s/GoogleChromePortable_31.0.1650.63_online.paf.exe/download...
...s/GoogleChromePortable_31.0.1650.48_online.paf.exe/download...
...s/GoogleChromePortable_30.0.1599.69_online.paf.exe/download...
...s/GoogleChromePortable_29.0.1547.76_online.paf.exe/download...

I created this and seems to work

Macro get_chrome
Code:
Copy      Help
str s
IntGetFile "http://sourceforge.net/projects/portableapps/files/Google%20Chrome%20Portable/Additional%20Versions" s
out
HtmlDoc d.InitFromText(s)
ARRAY(MSHTML.IHTMLElement) aLinks aImages
d.GetHtmlElements(aLinks "a")


ARRAY(str) all_paf_links

int i x
str tmp0 tmp1 tmp2 tmp3
str latest_chrome_url
for i 0 aLinks.len
,tmp0=aLinks[i].getAttribute("href" 2)     
,tmp1="http://sourceforge.net/projects/portableapps/files/Google%20Chrome%20Portable/Additional%20Versions/GoogleChromePortable_"
,x=find(tmp0 tmp1)
,if(x>=0)
,,all_paf_links[]=tmp0

all_paf_links.sort(9)
latest_chrome_url=all_paf_links[0]

out latest_chrome_url

My question:
I wanted to know if there might be a more robust way to do this through QM?

The method I used, "freezes/hangs" macro for about 20 seconds, the macro doesn't really freeze because it is processing in the background.
But I wanted to create an .exe from this so I can deploy this on more pc's, that's why the "freezing" might become confusing for other users.
(it's not a big problem, but if there is a more robust way to handle this than that would be very welcome).
#2
from what i can tell the main issue is the web page>It is very slow to load,hence why your macro takes so long.
just running this took between 12-15 seconds
str s
IntGetFile "http://sourceforge.net/projects/portableapps/files/Google%20Chrome%20Portable/Additional%20Versions" s
out s
#3
if you decided to use
http://portableapps.com/apps/internet/g ... e_portable

takes less than a second
not sure if they keep that up to date as fast as the other page though
but when i checked now it was up to date

Macro get_chrome2
Code:
Copy      Help
str s
IntGetFile "http://portableapps.com/apps/internet/google_chrome_portable" s
out
HtmlDoc d
d.SetOptions(1|2)
d.InitFromText(s)
ARRAY(MSHTML.IHTMLElement) aLinks aImages
d.GetHtmlElements(aLinks "a")
ARRAY(str) all_paf_links
int i x
str tmp0 tmp1 tmp2 tmp3
str latest_chrome_url
for i 0 aLinks.len
,tmp0=aLinks[i].getAttribute("href" 2)
,tmp1="http://sourceforge.net/projects/portableapps/files/Google%20Chrome%20Portable/Additional%20Versions/GoogleChromePortable_"
,x=find(tmp0 tmp1)
,if(x>=0)
,,all_paf_links[]=tmp0
all_paf_links.sort(9)
latest_chrome_url=all_paf_links[0]
out latest_chrome_url
#4
THANK YOU!!
That code works very fast!
I'll keep in mind that the 'sourceforge' page can be slow.


Forum Jump:


Users browsing this thread: 1 Guest(s)