Sign in to follow this  
Followers 0
Read

InetGet

23 posts in this topic

InetGet("http://www.mirrorservice.org/sites/releases.mozilla.org/pub/mozilla.org//firefox/releases/3.6.10/win32/en-US/Firefox%20Setup%203.6.10.exe", @DesktopCommonDir & "\Firefox3.6.10.exe")

If coming new version Firefox 3.6.11 and how do make URL, its always downloading new version?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Here is a great way to get the latest beta at Autoit. ( Renewed )

You can use this same system for your needs, just change the script a little

http://www.autoitscript.com/forum/index.php?showtopic=21359&view=findpost&p=147685

Good Luck!!

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Try this

#include <Array.au3>
#include <IE.au3>

$oIE = _IECreate ( 'http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/win32/' & _SwitchLang ( ), 0, 0 )
_IELoadWait ( $oIE )
$oLinks = _IELinkGetCollection ($oIE)
For $oLink In $oLinks
    If StringInStr ( $oLink.href, '.exe' ) <> 0 And StringInStr ( $oLink.href, '.asc' ) = 0 Then 
        ConsoleWrite ( "Link Inf : " & $oLink.innertext & ' : ' & $oLink.href & @Crlf )
        $_LastReleaseLink = $oLink.href
    EndIf
Next

_IEQuit ( $oIE )
InetGet ( $_LastReleaseLink, @DesktopDir & '\' & StringReplace ( _GetFullNameByUrl ( $_LastReleaseLink ), '%20', ' ' ), 1 )

Exit 
 
Func _GetFullNameByUrl ( $_FileUrl )
    $_FileName = StringSplit ( $_FileUrl, '/' )
    If Not @error Then 
        Return $_FileName[$_FileName[0]]
    Else
        Return 0
    EndIf
EndFunc  ;==>  _GetFullNameByUrl ( )

Func _SwitchLang ( )
    Select
        Case StringInStr ( "0409", @OSLang )    
            Return 'en-US/' ; "English_United_States"
        Case StringInStr ( "0809 0c09 1009 1409 1809 1c09 2009 2409 2809 2c09 3009 3409", @OSLang )
            Return 'en-GB/' ; "English"
        Case StringInStr ( "040c 080c 0c0c 100c 140c 180c", @OSLang )
            Return 'fr/' ; "French"
        Case StringInStr ( "0407 0807 0c07 1007 1407", @OSLang )
            Return 'de/' ; "German"
        Case StringInStr ( "0410 0810", @OSLang )
            Return 'it/' ; "Italian"
        Case StringInStr ( "0415", @OSLang )
            Return 'pl/' ; "Polish"
        Case StringInStr ( "040a 080a 0c0a 100a 140a 180a 1c0a 200a 240a 280a 2c0a 300a 340a 380a 3c0a 400a 440a 480a 4c0a 500a", @OSLang )
            Return 'es-ES/' ; "Spanish"
        Case StringInStr ( "041d 081d", @OSLang )
            Return 'sv-SE/' ; "Swedish"
        Case Else
            Return "Other ( can't determine with @OSLang directly )"
    EndSelect
EndFunc
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Try this

#include <Array.au3>
#include <IE.au3>

$oIE = _IECreate ( 'http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/win32/' & _SwitchLang ( ), 0, 0 )
_IELoadWait ( $oIE )
$oLinks = _IELinkGetCollection ($oIE)
For $oLink In $oLinks
    If StringInStr ( $oLink.href, '.exe' ) <> 0 And StringInStr ( $oLink.href, '.asc' ) = 0 Then 
        ConsoleWrite ( "Link Inf : " & $oLink.innertext & ' : ' & $oLink.href & @Crlf )
        $_LastReleaseLink = $oLink.href
    EndIf
Next

_IEQuit ( $oIE )
InetGet ( $_LastReleaseLink, @DesktopDir & '\' & StringReplace ( _GetFullNameByUrl ( $_LastReleaseLink ), '%20', ' ' ), 1 )

Exit 
 
Func _GetFullNameByUrl ( $_FileUrl )
    $_FileName = StringSplit ( $_FileUrl, '/' )
    If Not @error Then 
        Return $_FileName[$_FileName[0]]
    Else
        Return 0
    EndIf
EndFunc  ;==>  _GetFullNameByUrl ( )

MsgBox ( 0, "Your OS Language:", _SwitchLang ( ) )

Func _SwitchLang ( )
    Select
        Case StringInStr ( "0409", @OSLang )    
            Return 'en-US/' ; "English_United_States"
        Case StringInStr ( "0809 0c09 1009 1409 1809 1c09 2009 2409 2809 2c09 3009 3409", @OSLang )
            Return 'en-GB/' ; "English"
        Case StringInStr ( "040c 080c 0c0c 100c 140c 180c", @OSLang )
            Return 'fr/' ; "French"
        Case StringInStr ( "0407 0807 0c07 1007 1407", @OSLang )
            Return 'de/' ; "German"
        Case StringInStr ( "0410 0810", @OSLang )
            Return 'it/' ; "Italian"
        Case StringInStr ( "0415", @OSLang )
            Return 'pl/' ; "Polish"
        Case StringInStr ( "040a 080a 0c0a 100a 140a 180a 1c0a 200a 240a 280a 2c0a 300a 340a 380a 3c0a 400a 440a 480a 4c0a 500a", @OSLang )
            Return 'es-ES/' ; "Spanish"
        Case StringInStr ( "041d 081d", @OSLang )
            Return 'sv-SE/' ; "Swedish"
        Case Else
            Return "Other ( can't determine with @OSLang directly )"
    EndSelect
EndFunc

AutoIt Error

Line 7 ()

For $oLink In "oLink

For $oLink In "oLink^ERROR

Error: Variable must be of type "object".

Edit:

Maybe the way. The easier , the better it is.

InetGet("http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/win32/et/" "GetURL*.exe" "Firefox.exe")
Edited by Read

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I 'm sorry i don't put all languages !

And it works well for me !

Try this with et/ lang.

#include <Array.au3>
#include <IE.au3>

$oIE = _IECreate ( 'http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/win32/et/', 0, 0 )
_IELoadWait ( $oIE )
$oLinks = _IELinkGetCollection ($oIE)
For $oLink In $oLinks
    If StringInStr ( $oLink.href, '.exe' ) <> 0 And StringInStr ( $oLink.href, '.asc' ) = 0 Then 
        ConsoleWrite ( "Link Inf : " & $oLink.innertext & ' : ' & $oLink.href & @Crlf )
        $_LastReleaseLink = $oLink.href
    EndIf
Next

_IEQuit ( $oIE )
InetGet ( $_LastReleaseLink, @DesktopDir & '\' & StringReplace ( _GetFullNameByUrl ( $_LastReleaseLink ), '%20', ' ' ), 1 )

Exit 
 
Func _GetFullNameByUrl ( $_FileUrl )
    $_FileName = StringSplit ( $_FileUrl, '/' )
    If Not @error Then 
        Return $_FileName[$_FileName[0]]
    Else
        Return 0
    EndIf
EndFunc  ;==>  _GetFullNameByUrl ( )
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

;Of topic but usefull script

#include-once

; #INDEX# =======================================================================================================================

; Title .........: MainDomain

; AutoIt Version : 3.0

; Language ......: English

; Description ...: Functions that assist with geting the main domain of a url domain.

; Author(s) .....: XTR

; ===============================================================================================================================

; #FUNCTION# ====================================================================================================================

; Name...........: MainDomain

; Description ...: Returns a string containing the domain name that belongs to a given URL.

; Syntax.........: MainDomain( $strUrl )

; Parameters ....: $strUrl - The URL of domain to get

; Return values .: Success - The name of the domain

; Failure - Blank string

; Author ........: XTR

; Remarks .......: 2010-09-27

; Samples .......: Next lines

; MsgBox(0,"MainDomain",MainDomain("http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"))

; MsgBox(0,"MainDomain",MainDomain("http://www.w3.org"))

; MsgBox(0,"MainDomain",MainDomain("www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"))

; MsgBox(0,"MainDomain",MainDomain("www.w3.org"))

; ===============================================================================================================================

Func MainDomain($strUrl)

If $strUrl = "" Then return ""

If StringInStr($strUrl,"/") Then

If StringInStr($strUrl, "://") Then $strUrl = StringMid($strUrl, StringInStr($strUrl, "://") + 3)

If StringInStr($strUrl, "/") Then $strUrl = StringLeft($strUrl, StringInStr($strUrl, "/") - 1)

EndIf

;# version 2006122601, last updated wed dec 27 09:07:02 2006 utc

Local $strKnownNetTop = ".ac.ad.ae.aero.af.ag.ai.al.am.an.ao.aq.ar.arpa.as.asia.at.au.aw.ax.az.ba.bb.bd.be.bf.bg.bh"

$strKnownNetTop &= ".bi.biz.bj.bl.bm.bn.bo.br.bs.bt.bv.bw.by.bz.ca.cat.cc.cd.cf.cg.ch.ci.ck"

$strKnownNetTop &= ".cl.cm.cn.co.com.coop.cr.cs.cu.cv.cx.cy.cz.de.dj.dk.dm.do.dz.ec.edu.ee.eg"

$strKnownNetTop &= ".eh.er.es.et.eu.fi.fj.fk.fm.fo.fr.fx.ga.gb.gd.ge.gf.gg.gh.gi.gl.gm.gn.gov"

$strKnownNetTop &= ".gp.gq.gr.gs.gt.gu.gw.gy.hk.hm.hn.hr.ht.hu.id.ie.il.im.in.info.int.io.iq"

$strKnownNetTop &= ".ir.is.it.je.jm.jo.jobs.jp.ke.kg.kh.ki.km.kn.kp.kr.kw.ky.kz.la.lb.lc.li.lk"

$strKnownNetTop &= ".lr.ls.lt.lu.lv.ly.ma.mc.md.me.mf.mg.mh.mil.mk.ml.mm.mn.mo.mobi.mp.mq.mr.ms"

$strKnownNetTop &= ".mt.mu.museum.mv.mw.mx.my.mz.na.name.nato.nc.ne.net.nf.ng.ni.nl.no.np.nr.nt"

$strKnownNetTop &= ".nu.nz.om.org.pa.pe.pf.pg.ph.pk.pl.pm.pn.pr.pro.ps.pt.pw.py.qa.re.ro.rs.ru"

$strKnownNetTop &= ".rw.s.sa.sb.sc.sd.se.sg.sh.si.sj.sk.sl.sm.sn.so.sr.st.su.sv.sy.sz.tc.td.tel"

$strKnownNetTop &= ".tf.tg.th.tj.tk.tl.tm.tn.to.tp.tr.travel.tt.tv.tw.tz.ua.ug.uk.um.us.uy.uz.va"

$strKnownNetTop &= ".vc.ve.vg.vi.vn.vu.wf.ws.ye.yt.yu.za.zm.zr.zw"

$strUrl = StringLower($strUrl)

If $strUrl = "www.al.com" Then $strUrl = "al"

If $strUrl = "ftp.it.ru" Then $strUrl = "it"

If StringRight($strUrl, 5) = "gu.ma" Then $strUrl = "gu"

If StringInStr($strUrl, ".") <> StringInStr($strUrl, ".", 0, -1) Then

If StringLeft(StringLeft($strUrl, StringInStr($strUrl, ".")), 1) = "w" Then

If StringInStr("w.0123456789", StringMid($strUrl, 2, 1)) And StringInStr("w.0123456789", StringMid($strUrl, 3, 1)) Then $strUrl = StringMid($strUrl, StringInStr($strUrl, ".") + 1)

EndIf

EndIf

While 1

If StringInStr($strUrl, ".") Then

If StringInStr($strKnownNetTop, StringMid($strUrl, StringInStr($strUrl, ".", 0, -1))) THEN

$strUrl = StringLeft($strUrl, StringInStr($strUrl, ".", 0, -1) - 1)

Else

ExitLoop

EndIf

Else

ExitLoop

EndIf

Wend

Local $strOrgUrl = $strUrl

If StringInStr($strUrl, ".") Then $strUrl = StringMid($strUrl, StringInStr($strUrl, ".", 0, 1) + 1)

If $strUrl = "con" Then

$strUrl = "con[0]"

$strOrgUrl = StringReplace($strOrgUrl, "con", "\")

EndIf

If $strUrl = "aux" Then

$strUrl = "aux[0]"

$strOrgUrl = StringReplace($strOrgUrl, "aux", "\")

EndIf

If $strUrl = "com1" Then

$strUrl = "com[1]"

$strOrgUrl = StringReplace($strOrgUrl, "com1", "\")

EndIf

If $strUrl = "com2" Then

$strUrl = "com[2]"

$strOrgUrl = StringReplace($strOrgUrl, "com2", "\")

EndIf

If $strUrl = "com3" Then

$strUrl = "com[3]"

$strOrgUrl = StringReplace($strOrgUrl, "com3", "\")

EndIf

If $strUrl = "com4" Then

$strUrl = "com[4]"

$strOrgUrl = StringReplace($strOrgUrl, "com4", "\")

EndIf

If $strUrl = "lpt1" Then

$strUrl = "lpt[1]"

$strOrgUrl = StringReplace($strOrgUrl, "lpt1", "\")

EndIf

If $strUrl = "lpt2" Then

$strUrl = "lpt[2]"

$strOrgUrl = StringReplace($strOrgUrl, "lpt2", "\")

EndIf

If $strUrl = "lpt3" Then

$strUrl = "lpt[3]"

$strOrgUrl = StringReplace($strOrgUrl, "lpt3", "\")

EndIf

If $strUrl = "prn" Then

$strUrl = "prn[0]"

$strOrgUrl = StringReplace($strOrgUrl, "prn", "\")

EndIf

If $strUrl = "nul" Then

$strUrl = "nul[1]"

$strOrgUrl = StringReplace($strOrgUrl, "nul", "\")

EndIf

While StringInStr($strOrgUrl, ".") <> 0

$strOrgUrl = StringReplace($strOrgUrl, ".", "\")

Wend

While StringInStr($strOrgUrl, $strUrl) <> 0

$strOrgUrl = StringReplace($strOrgUrl, $strUrl, "\")

Wend

While StringInStr($strOrgUrl, "\\") <> 0

$strOrgUrl = StringReplace($strOrgUrl, "\\", "\")

Wend

If $strOrgUrl <> "\" OR $strOrgUrl <> "\\" OR $strOrgUrl <> "" Then

$strUrl = $strUrl & "\" & $strOrgUrl

EndIf

While StringInStr($strUrl, "\\") <> 0

$strUrl = StringReplace($strUrl, "\\", "\")

Wend

While StringLeft($strUrl, 1) = "\"

$strUrl = StringMid($strUrl, 2)

Wend

While StringRight($strUrl, 1) = "\"

$strUrl = StringLeft($strUrl, StringLen($strUrl) - 1)

Wend

return $strUrl

EndFunc

MainDomain.au3

Share this post


Link to post
Share on other sites

Not work!

Some Error:

Line 7 ()

For $oLink In "oLink

For $oLink In "oLink^ERROR

Error: Variable must be of type "object".

I see, you have #include files: #include <Array.au3> and#include <IE.au3>

But i do not have them ;)

I use AutoIT Beta.

I 'm sorry i don't put all languages !

And it works well for me !

Try this with et/ lang.

#include <Array.au3>
#include <IE.au3>

$oIE = _IECreate ( 'http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/win32/et/', 0, 0 )
_IELoadWait ( $oIE )
$oLinks = _IELinkGetCollection ($oIE)
For $oLink In $oLinks
    If StringInStr ( $oLink.href, '.exe' ) <> 0 And StringInStr ( $oLink.href, '.asc' ) = 0 Then 
        ConsoleWrite ( "Link Inf : " & $oLink.innertext & ' : ' & $oLink.href & @Crlf )
        $_LastReleaseLink = $oLink.href
    EndIf
Next

_IEQuit ( $oIE )
InetGet ( $_LastReleaseLink, @DesktopDir & '\' & StringReplace ( _GetFullNameByUrl ( $_LastReleaseLink ), '%20', ' ' ), 1 )

Exit 
 
Func _GetFullNameByUrl ( $_FileUrl )
    $_FileName = StringSplit ( $_FileUrl, '/' )
    If Not @error Then 
        Return $_FileName[$_FileName[0]]
    Else
        Return 0
    EndIf
EndFunc  ;==>  _GetFullNameByUrl ( )

Share this post


Link to post
Share on other sites

Are you sure that IE is installed on your PC ? Posted Image

when you try this, what's happen ?

#include <IE.au3>

$oIE = _IECreate ( 'http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/win32/et/' )
_IELoadWait ( $oIE )

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Nothing! Console is black ;)

Starts and closes after a while.

Edit:IE is here: C:\Program Files\AutoIt3\Beta\Include\IE.au3

Are you sure that IE is installed on your PC ? Posted Image

when you try this, what's happen ?

#include <IE.au3>

$oIE = _IECreate ( 'http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/win32/et/' )
_IELoadWait ( $oIE )

Edited by Read

Share this post


Link to post
Share on other sites

Nothing! Console is black ;)

Starts and closes after a while.

It's not normal ! Posted Image

internet explorer is installed or not ?


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

wtf :) Sry

I use Firefox and i tried to open internet explorer and whats this, not work. I try fix ;)

It's not normal ! Posted Image

internet explorer is installed or not ?

Share this post


Link to post
Share on other sites

Script worked! Thanks

But...

Now i want to make auto install.

How can i start Firefox Setup 3.6.10.exe?

Something like this???

Run(@DesktopDir & " /c Start " & $_FileName")

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Script worked! Thanks

But...

Now i want to make auto install.

How can i start Firefox Setup 3.6.10.exe?

Something like this???

Run(@DesktopDir & " /c Start " & $_FileName")

Try :

RunWait ( @Desktop & '\Firefox Setup 3.6.10.exe /S' )

What was the problem with Internet Explorer ?

Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Try :

RunWait ( @Desktop & '\Firefox Setup 3.6.10.exe /S' )

What was the problem with Internet Explorer ?

If the new version , it does not work anymore. Right?

Share this post


Link to post
Share on other sites

If the new version , it does not work anymore. Right?

I don't know !

I just wanted to know how you resolve this strange problem with your IE...Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

I don't know !

I just wanted to know how you resolve this strange problem with your IE...Posted Image

Reinstall ;)

But code: Example

InetGet("http://xxx.xx/Firefox Setup 3.6.10.exe","Firefox.exe",1,0)

And Run("Firefox.exe")

Possible?

Share this post


Link to post
Share on other sites

Reinstall ;)

But code: Example

InetGet("http://xxx.xx/Firefox Setup 3.6.10.exe","Firefox.exe",1,0)

And Run("Firefox.exe")

Possible?

InetGet("http://xxx.xx/Firefox Setup 3.6.10.exe","Firefox.exe",1,0) <=== "Firefox.exe" is not a path, it's a filename !

where your download will arrive ?

So, You must set a path like @TempDir & '\Firefox.exe' if you don't want to see it on desktop.

And after you can RunWait ( @TempDir & '\Firefox.exe /S' )

ok ?Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

No!

My english is not good but i will try to explain.

Now is version Firefox 3.6.10.

Tomorrow may already be 3.6.11

Use Rename!

Firefox 3.6.10 Rename Firefox.exe

New file available Firefox Setup 3.6.11.exe Rename Firefox.exe

Run("Firefox.exe") <- It always works

crazy stuff ;)

#include <Array.au3>
#include <IE.au3>

$oIE = _IECreate ( 'http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/win32/et/', 0, 0 )
_IELoadWait ( $oIE )
$oLinks = _IELinkGetCollection ($oIE)
For $oLink In $oLinks
    If StringInStr ( $oLink.href, '.exe' ) <> 0 And StringInStr ( $oLink.href, '.asc' ) = 0 Then 
        ConsoleWrite ( "Link Inf : " & $oLink.innertext & ' : ' & $oLink.href & @Crlf )
        $_LastReleaseLink = $oLink.href
    EndIf
Next

_IEQuit ( $oIE )
InetGet ( $_LastReleaseLink, @DesktopDir & '\' & StringReplace ( _GetFullNameByUrl ( $_LastReleaseLink ), '%20', ' ' ), 1 )

Exit 
 
Func _GetFullNameByUrl ( $_FileUrl )
    $_FileName = StringSplit ( $_FileUrl, '/' )
    If Not @error Then 
        Return $_FileName[$_FileName[0]]
    Else
        Return 0
    EndIf
EndFunc  ;==>  _GetFullNameByUrl ( )

Share this post


Link to post
Share on other sites

If it's just a rename yes, there is no problem ! Posted Image


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


Link to post
Share on other sites

Arghh

It's not work: RunWait ( @ScriptDir & '\Firefox Setup 3.6.10.exe /S' )

Do hard to me ;)

If coming new version Firefox, then it does not work anymore "Auto Install" becose file has been changed.

Arghh

#include <Array.au3>
#include <IE.au3>

$oIE = _IECreate ( 'http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/win32/et/', 0, 0 )
_IELoadWait ( $oIE )
$oLinks = _IELinkGetCollection ($oIE)
For $oLink In $oLinks
    If StringInStr ( $oLink.href, '.exe' ) <> 0 And StringInStr ( $oLink.href, '.asc' ) = 0 Then 
        ConsoleWrite ( "Link Inf : " & $oLink.innertext & ' : ' & $oLink.href & @Crlf )
        $_LastReleaseLink = $oLink.href
    EndIf
Next

_IEQuit ( $oIE )
InetGet ( $_LastReleaseLink, @ScriptDir & '\' & StringReplace ( _GetFullNameByUrl ( $_LastReleaseLink ), '%20', ' ' ), 1 )

Exit 
 
Func _GetFullNameByUrl ( $_FileUrl )
    $_FileName = StringSplit ( $_FileUrl, '/' )
    If Not @error Then 
        Return $_FileName[$_FileName[0]]
        
    Else
        Return 0
    EndIf
EndFunc  ;==>  _GetFullNameByUrl ( )
RunWait ( @ScriptDir & '\Firefox Setup 3.6.10.exe /S' )

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0