Stilgar Posted March 28, 2009 Posted March 28, 2009 (edited) Here's an UDF to control the FireFox Download-Manager (not the download-window):_FF_DM.au3Current functions:; _FF_DM_CleanUp; _FF_DM_DownloadPause; _FF_DM_DownloadRemove; _FF_DM_DownloadResume; _FF_DM_DownloadCancel; _FF_DM_DownloadRetry; _FF_DM_GetActiveDownloadsIDs; _FF_DM_GetActiveDownloadsCount; _FF_DM_GetDownloadInfo; _FF_DM_GetDownloadState; _FF_DM_IsDownloadingRequirement(s).: FF.au3 >= 0.5.3.0 / MozReplExample (to try this, start at first to download a bigger file);#Region Includes #include <Array.au3> #include <_FF_DM.au3> #EndRegion Includes If _FFConnect() Then If _FF_DM_IsDownloading() Then ; IDs of the current downloads $aIDs = _FF_DM_GetActiveDownloadsIDs() _ArrayDisplay($aIDs) If UBound($aIDs) > 1 Then ; Informations about the first download $aInfo = _FF_DM_GetDownloadInfo($aIDs[1]) _ArrayDisplay($aInfo) ; Pausing the first download _FF_DM_DownloadPause($aIDs[1]) If _FF_DM_GetDownloadState($aIDs[1]) = 4 Then MsgBox(64,"Download paused:",$aInfo[6]) sleep(5000) ; Resume the first download _FF_DM_DownloadResume($aIDs[1]) If _FF_DM_GetDownloadState($aIDs[1]) = 0 Then MsgBox(64,"Download is active:",$aInfo[6]) EndIf EndIf EndIf Exit Edited April 28, 2009 by Stilgar jEdit4AutoIt PlanMaker_UDF
dmob Posted March 29, 2009 Posted March 29, 2009 (edited) Thank you, Stilgar; I have much use for this in my internet cafe. You are the man! Edited March 29, 2009 by dmob
Stilgar Posted April 6, 2009 Author Posted April 6, 2009 Thanks! Good to hear that someone can use this jEdit4AutoIt PlanMaker_UDF
Stilgar Posted April 28, 2009 Author Posted April 28, 2009 Updated to FF.au3 > V0.5.3.0. jEdit4AutoIt PlanMaker_UDF
Valuater Posted April 28, 2009 Posted April 28, 2009 I wonder about some of this...like.. Func __FF_DM_Action($sAction, $iID = -1, $sAttr = "") Local $sState = "" If $iID > -1 Then $iID = '(' & $iID & ')' Else $iID = "" EndIf Local $RetVal = _FFCmd('try{FFau3.obj = Components.classes["@mozilla.org/download-manager;1"].getService(Components.interfaces.nsIDownloadManager).' & $sAction & $iID & $sAttr & ';}catch(e){-3;};') SetError(@error) Return $RetVal EndFunc ;==>__FF_DM_ActionoÝ÷ ÚÈhºW[y«¢+ÙÕ¹}}}5}Ñ¥½¸ ÀÌØíÍÑ¥½¸°ÀÌØí¥%ôÅÕ½ÐìÅÕ½Ðì°ÀÌØíÍÑÑÈôÅÕ½ÐìÅÕ½Ðì¤(%%ÀÌØí¥%±ÐìÐìÅÕ½ÐìÅÕ½ÐìQ¡¸ÀÌØí¥%ôÌäì ÌäìµÀìÀÌØí¥%µÀìÌäì¤Ìäì(%1½°ÀÌØíIÑY°ô} µ ÌäíÑÉåíÔ̹½¨ô ½µÁ½¹¹Ñ̹±ÍÍÍlÅÕ½Ðíµ½é¥±±¹½É½½Ý¹±½µµ¹ÈìÄÅÕ½Ðít¹ÑMÉÙ¥¡ ½µÁ½¹¹Ñ̹¥¹ÑÉ̹¹Í%½Ý¹±½5¹È¤¸ÌäìµÀìÀÌØíÍÑ¥½¸µÀìÀÌØí¥%µÀìÀÌØíÍÑÑȵÀìÌäìíõÑ ¡¥ì´ÌíôìÌäì¤(%IÑÕɸMÑÉɽȡÉɽȰÅÕ½ÐìÅÕ½Ðì°ÀÌØíIÑY°¤)¹Õ¹ìôôÐí}}}5}Ñ¥½¸ Thanks for sharing your work!!! 8)
Stilgar Posted April 29, 2009 Author Posted April 29, 2009 (edited) ... Func __FF_DM_Action($sAction, $iID = "", $sAttr = "") If $iID <> "" Then $iID = '(' & $iID & ')' Local $RetVal = _FFCmd('try{FFau3.obj = Components.classes["@mozilla.org/download-manager;1"].getService(Components.interfaces.nsIDownloadManager).' & $sAction & $iID & $sAttr & ';}catch(e){-3;};') Return SetError(@error, "", $RetVal) EndFunc ;==>__FF_DM_Action Yes that's right. On my first tries with this interface I received sometimes a -1 ID (from an other function) and I forget to change this Edited April 29, 2009 by Stilgar jEdit4AutoIt PlanMaker_UDF
TheSaint Posted April 29, 2009 Posted April 29, 2009 Thanks for sharing! Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)
6105 Posted September 6, 2009 Posted September 6, 2009 (((( what i can do? [center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]
Stilgar Posted September 7, 2009 Author Posted September 7, 2009 (((( what i can do? What have you tried to do? I can't reproduce this error. jEdit4AutoIt PlanMaker_UDF
6105 Posted September 7, 2009 Posted September 7, 2009 What have you tried to do? I can't reproduce this error. i have this error for all ur examples.. like this: #Region Includes #include <Array.au3> #include <_FF_DM.au3> #EndRegion Includes If _FFConnect() Then If _FF_DM_IsDownloading() Then ; IDs of the current downloads $aIDs = _FF_DM_GetActiveDownloadsIDs() _ArrayDisplay($aIDs) If UBound($aIDs) > 1 Then ; Informations about the first download $aInfo = _FF_DM_GetDownloadInfo($aIDs[1]) _ArrayDisplay($aInfo) ; Pausing the first download _FF_DM_DownloadPause($aIDs[1]) If _FF_DM_GetDownloadState($aIDs[1]) = 4 Then MsgBox(64,"Download paused:",$aInfo[6]) sleep(5000) ; Resume the first download _FF_DM_DownloadResume($aIDs[1]) If _FF_DM_GetDownloadState($aIDs[1]) = 0 Then MsgBox(64,"Download is active:",$aInfo[6]) EndIf EndIf EndIf Exit i runs more 10 examples.. and all give this error i have latest version of all FF scripts and MozRelp [center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]
Stilgar Posted September 7, 2009 Author Posted September 7, 2009 This example works here, too. It looks like an error in the FF.au3, because of the unkown function name. Have you tried to download it again? jEdit4AutoIt PlanMaker_UDF
6105 Posted September 8, 2009 Posted September 8, 2009 This example works here, too.It looks like an error in the FF.au3, because of the unkown function name. Have you tried to download it again?yes, ohh now is new error.. now that script can't run _FF_DM.au3line 3 "#include <_FF_DM.au3>" i updated that file(( but that error is again(( ohhhhh... [center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Don't utter a single word[/font][/center][center][font=courier new,courier,monospace]Die die die my darling[/font][/center][center][font=courier new,courier,monospace]Just shut your pretty mouth[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you again[/font][/center][center][font=courier new,courier,monospace]I'll be seeing you[/font][/center][center][font=courier new,courier,monospace]In hell[/font][/center]
hagaizenberg Posted November 3, 2009 Posted November 3, 2009 (edited) Hi all, I was wondering if there's a way to start a download from autoit using the FireFox scripts... I see that the download manager only help keeping track of the downloads, but is there a way I can start a download from the script of a image file for example? instead of opening it in firefox and doing a "saveas" ? btw - i know i can use InetGet but i'm trying to download something that requires me to log-in, so the website recognizes InetGet is not logged in and it doesn't work and i must do it from the browser... 10x. Edited November 3, 2009 by hagaizenberg
Stilgar Posted November 4, 2009 Author Posted November 4, 2009 Hi all, I was wondering if there's a way to start a download from autoit using the FireFox scripts... I see that the download manager only help keeping track of the downloads, but is there a way I can start a download from the script of a image file for example? instead of opening it in firefox and doing a "saveas" ? btw - i know i can use InetGet but i'm trying to download something that requires me to log-in, so the website recognizes InetGet is not logged in and it doesn't work and i must do it from the browser... 10x. You can use this function: ; example _FF_DownloadFile("https://developer.mozilla.org/skins/mozilla/Fox3/img/mdc-logo.png", "c:\\") ; ============================================================================== Func _FF_DownloadFile($sURL, $sDir = "") If $sDir = "" Then $sDir = _FFPrefGet("browser.download.defaultFolder") If $sDir = "" Then $sDir = @DesktopDir & "\" Else If Not StringInStr(FileGetAttrib($sDir), "D") Then SetError(1) Return 0 EndIf EndIf Local $sFile = StringMid($sURL, StringInStr($sURL, "/", 2, -1) + 1) $sFile = $sDir & $sFile $sFile = StringReplace($sFile, "\", "\\") Local $sJavascript = 'var Ci=Components.interfaces;var Cc=Components.classes;' $sJavascript &= 'var oSrc=Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService).newURI("' & $sURL & '", null, null);' $sJavascript &= 'var oDst=Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);' $sJavascript &= 'oDst.initWithPath("' & $sFile & '");if(!oDst.exists()){oDst.create(0x00,0644);}' $sJavascript &= 'var nsIWBP=Cc["@mozilla.org/embedding/browser/nsWebBrowserPersist;1"].createInstance(Ci.nsIWebBrowserPersist);' $sJavascript &= 'nsIWBP.saveURI(oSrc,null,null,null,null,oDst);' If _FFCmd($sJavascript) <> "_FFCmd_Err" And FileExists($sFile) Then Return 1 SetError(1) Return 0 EndFunc ;==>_FFDownloadFile It only downloads they file, but currently it don't add it to the download-manager. Or if you have the AddOn "DownThemAll" installed, you can do this: ; example: _FF_DTA_SaveSingleLink("http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe") ;============================================================= Func _FF_DTA_SaveSingleLink($sURL, $sReferrer = "") If $sReferrer = "" Then $sReferrer = _FFCmd(".location.href") _FFCmd(StringFormat("DTA_AddingFunctions.saveSingleLink(true,'%s', '%s')", $sURL, $sReferrer)) EndFunc jEdit4AutoIt PlanMaker_UDF
Sandro Alvares Posted January 24, 2010 Posted January 24, 2010 I not found manual helper on FF_DM ... i need monitor download of firefox without add-ons! Have idea? how to make for autoit? I see a interessant of add-ons Auto-Shutdown is show download square 1 files/ 2 files (i need how to make show files 1,2,3,4....) http://inbasic.mozdev.org/root/ext2/home/index.htm Please me help.. thanks Programmer PHP, ASP, CGI, Perl, Delphi, JScript, ......... :)
dmob Posted January 25, 2010 Posted January 25, 2010 I not found manual helper on FF_DM ... i need monitor download of firefox without add-ons! Have idea? how to make for autoit?I see a interessant of add-ons Auto-Shutdown is show download square 1 files/ 2 files (i need how to make show files 1,2,3,4....)http://inbasic.mozdev.org/root/ext2/home/index.htmPlease me help.. thanksYou can use Stilgar's _FF_DM UDF or monitor the Firefox download list located in the Profiles folder (think its "@AppDataDir & "\Mozilla\Firefox\Profiles\" & Current User Profile & "\downloads.sqlite")I used to use the download list until Stilgar produced his beautiful UDF. I did a quick and dirty upgrade and ended up with a combination of both.
Iczer Posted August 17, 2013 Posted August 17, 2013 I need some help with : Func _FF_DownloadFile($sURL, $sDir = "") can someone help me modify this function, so it actually add download to the download-manager ? or maybe make : Func _FF_DTA_SaveSingleLink ($sURL) accept destination directory ?
frank10 Posted August 5, 2014 Posted August 5, 2014 I use FF30 and it seems the FF_DM doesn't work anymore. I get __FFRecv: -3 with _FF_DM_GetActiveDownloadsIDs() _FF_DM_IsDownloading() _FF_DM_GetActiveDownloadsCount() So it's broken. I use autoit 3.3.13.0
DeadMan99 Posted July 5, 2016 Posted July 5, 2016 Hi The link seem to be broken for this UDF. can anyone re-upload it ? for i can find it nowhere else.
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