3mustgetbeers Posted August 5, 2010 Share Posted August 5, 2010 (edited) Hi Guys, I want AutoIT to download FireFox if it doesn't already exist. I have the download part sorted, I just need the file check part; here is what I have so far: Local $hFirefox = InetGet("http://download.mozilla.org/?product=firefox-3.6.8&os=win&lang=en-GB", "C:\Firefox.exe", 1, 1) do sleep(500) Until InetGetInfo($hFirefox, 2) InetClose($hFirefox) FileMove("C:\Firefox.exe",$path & "\Tools\Firefox.exe", 9) sleep(100) ShellExecute($path & "\Tools\Firefox.exe") So I need to add something like: If FileDoesn'tExist (@ProgramFilesDir & "\Mozilla Firefox\firefox.exe") Then But not sure on the function - if there is one?? Oh, and just to make it neater any help on why I can't use InetGet to download direct to $path\tools would be great - no error, code processes, just file doesn't appear (anywhere on HDD - searched for it!) All help is much appreciated, Thanks Andy Edited August 5, 2010 by 3mustgetbeers Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 5, 2010 Share Posted August 5, 2010 Where did you declare $path? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
3mustgetbeers Posted August 5, 2010 Author Share Posted August 5, 2010 Just to add to that; the function is within a Case, so if there is a way to write If FileExsits (firefox) Then Crack on! Else (download FireFox) ?? Thanks again! Link to comment Share on other sites More sharing options...
3mustgetbeers Posted August 5, 2010 Author Share Posted August 5, 2010 PsaltyDS: The path is earlier in the script; $path = @ProgramFilesDir & "\Andys Little Tool\" Thanks Andy! Link to comment Share on other sites More sharing options...
3mustgetbeers Posted August 5, 2010 Author Share Posted August 5, 2010 Would this work?? If FileExists (@ProgramFilesDir & "\Mozilla Firefox\firefox.exe") Then Sleep(1) Else Local $hFirefox = InetGet("http://download.mozilla.org/?product=firefox-3.6.8&os=win&lang=en-GB", "C:\Firefox.exe", 1, 1) do sleep(500) Until InetGetInfo($hFirefox, 2) InetClose($hFirefox) FileMove("C:\Firefox.exe",$path & "\Tools\Firefox.exe", 9) sleep(100) ShellExecute($path & "\Tools\Firefox.exe") EndIf Thanks!! Link to comment Share on other sites More sharing options...
JohnOne Posted August 5, 2010 Share Posted August 5, 2010 There is one certain way to find out if it will work, and thats try it. ;your code... If Not FileExists($file) Then _DownloadFileFunc() EndIf ;the rest of your code AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
3mustgetbeers Posted August 5, 2010 Author Share Posted August 5, 2010 There is one certain way to find out if it will work, and thats try it. ;your code... If Not FileExists($file) Then _DownloadFileFunc() EndIf ;the rest of your code Ahhhhh! I didn't think about the NOT operator! Cheers mate, works a treat - and looks tidier than having it sleep. Thanks alot! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now