Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

_FF_DM.au3 for FF.au3


  • Please log in to reply
18 replies to this topic

#1 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 28 March 2009 - 01:24 AM

Here's an UDF to control the FireFox Download-Manager (not the download-window):

_FF_DM.au3

Current 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_IsDownloading

Requirement(s).: FF.au3 >= 0.5.3.0 / MozRepl

Example (to try this, start at first to download a bigger file);

AutoIt         
#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 by Stilgar, 28 April 2009 - 08:26 PM.








#2 dmob

dmob

    Polymath

  • Active Members
  • PipPipPipPip
  • 237 posts

Posted 29 March 2009 - 01:53 PM

Thank you, Stilgar; I have much use for this in my internet cafe.

You are the man!

Edited by dmob, 29 March 2009 - 01:54 PM.


#3 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 06 April 2009 - 10:31 AM

Thanks!

Good to hear that someone can use this :D

#4 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 28 April 2009 - 08:27 PM

Updated to FF.au3 > V0.5.3.0.

#5 Valuater

Valuater

    www.PayFreeWireless.com

  • MVPs
  • 11,214 posts

Posted 28 April 2009 - 08:39 PM

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_Actionƒo݊÷ ÚÈhºW[y«­¢+ÙÕ¹Œ}}}5}Ñ¥½¸ ˜ŒÀÌØí͍ѥ½¸°€˜ŒÀÌØí¥%€ô€™ÅÕ½Ðì™ÅÕ½Ð찀˜ŒÀÌØíÍÑÑȀô€™ÅÕ½Ðì™ÅÕ½Ðì¤(%%˜€˜ŒÀÌØí¥%€™±Ð왝Ð쀙ÅÕ½Ðì™ÅÕ½ÐìQ¡•¸€˜ŒÀÌØí¥%€ô€˜ŒÌäì ˜ŒÌä쀙…µÀ쀘ŒÀÌØí¥%€™…µÀ쀘ŒÌä줘ŒÌäì(%1½…°€˜ŒÀÌØíI•ÑY…°€ô} µ ˜ŒÌäíÑÉåí…Ô̹½‰¨€ô ½µÁ½¹•¹Ñ̹±…Í͕Íl™ÅÕ½Ðíµ½é¥±±„¹½Éœ½‘½Ý¹±½…µµ…¹…•ÈìęÅÕ½Ðít¹•ÑM•ÉÙ¥”¡ ½µÁ½¹•¹Ñ̹¥¹Ñ•É™…•Ì¹¹Í%½Ý¹±½…‘5…¹…•È¤¸˜ŒÌä쀙…µÀ쀘ŒÀÌØí͍ѥ½¸€™…µÀ쀘ŒÀÌØí¥%€™…µÀ쀘ŒÀÌØíÍÑÑȀ™…µÀ쀘ŒÌäìíõ…э ¡”¥ì´Ìíô옌Ìäì¤(%I•ÑÕɸM•ÑÉɽȡ•ÉɽȰ€™ÅÕ½Ðì™ÅÕ½Ð찀˜ŒÀÌØíI•ÑY…°¤)¹‘Õ¹Œ€€€ìôô™Ðí}}}5}Ñ¥½¸


Thanks for sharing your work!!!

8)

Posted Image

Clic The Pic!!!


#6 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 29 April 2009 - 09:57 AM

...

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 by Stilgar, 29 April 2009 - 09:58 AM.


#7 TheSaint

TheSaint

    *** Knight Templar ***

  • MVPs
  • 5,656 posts

Posted 29 April 2009 - 01:47 PM

Thanks for sharing! ^_^

Make sure brain is in gear before opening mouth! Ignoring those who try to divert conversation with irrelevancies. If I put effort into communication, I expect you to read properly & fully, or just not comment. 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


#8 6105

6105

    Polymath

  • Active Members
  • PipPipPipPip
  • 232 posts

Posted 06 September 2009 - 05:39 PM

(((( Posted Image what i can do? :D

Die die die my darling

Don't utter a single word

Die die die my darling

Just shut your pretty mouth

I'll be seeing you again

I'll be seeing you

In hell


#9 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 07 September 2009 - 09:03 AM

(((( Posted Image what i can do? :D

What have you tried to do? I can't reproduce this error.

#10 6105

6105

    Polymath

  • Active Members
  • PipPipPipPip
  • 232 posts

Posted 07 September 2009 - 12:05 PM

What have you tried to do? I can't reproduce this error.


i have this error for all ur examples.. like this:

Plain Text         
#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 :D i have latest version of all FF scripts and MozRelp :D

Die die die my darling

Don't utter a single word

Die die die my darling

Just shut your pretty mouth

I'll be seeing you again

I'll be seeing you

In hell


#11 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 07 September 2009 - 12:31 PM

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?

#12 6105

6105

    Polymath

  • Active Members
  • PipPipPipPip
  • 232 posts

Posted 08 September 2009 - 09:00 AM

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.au3

line 3 "#include <_FF_DM.au3>" i updated that file(( but that error is again(( ohhhhh...

Die die die my darling

Don't utter a single word

Die die die my darling

Just shut your pretty mouth

I'll be seeing you again

I'll be seeing you

In hell


#13 hagaizenberg

hagaizenberg

    Seeker

  • Active Members
  • 20 posts

Posted 03 November 2009 - 06:56 AM

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 by hagaizenberg, 03 November 2009 - 07:06 AM.


#14 Stilgar

Stilgar

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 423 posts

Posted 04 November 2009 - 02:06 PM

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:
AutoIt         
; example _FF_DownloadFile("<a href='https://developer.mozilla.org/skins/mozilla/Fox3/img/mdc-logo.png' class='bbc_url' title='External link' rel='nofollow external'>https://developer.mozilla.org/skins/mozilla/Fox3/img/mdc-logo.png"</a>, "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("<a href='http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe' class='bbc_url' title=''>http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe"</a>) ;============================================================= Func _FF_DTA_SaveSingleLink($sURL, $sReferrer = "")     If $sReferrer = "" Then $sReferrer = _FFCmd(".location.href")     _FFCmd(StringFormat("DTA_AddingFunctions.saveSingleLink(true,'%s', '%s')", $sURL, $sReferrer)) EndFunc


#15 chrismrulz

chrismrulz

    Seeker

  • Normal Members
  • 1 posts

Posted 04 November 2009 - 06:07 PM

Thanks so much for this.

#16 Sandro Alvares

Sandro Alvares

    Wayfarer

  • Active Members
  • Pip
  • 54 posts

Posted 24 January 2010 - 03:14 PM

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, ......... :)

#17 dmob

dmob

    Polymath

  • Active Members
  • PipPipPipPip
  • 237 posts

Posted 25 January 2010 - 08:21 AM

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


You 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.

#18 Iczer

Iczer

    Prodigy

  • Active Members
  • PipPipPip
  • 169 posts

Posted 17 August 2013 - 10:47 AM

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 ?



#19 frank10

frank10

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 276 posts

Posted 05 August 2014 - 06:42 PM

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






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users