FF.au3 (V0.6.0.1b-10)

679 posts in this topic

#1 ·  Posted (edited)

UDF to control FireFox via MozRepl:

Edit-> Please see new FF.au3 Thread for updates past V0.6.0.1b-10.

FF.au3 (V0.6.0.1b-10)
Changelog

Changes since V0.6.0.0b:

V0.6.0.1b-10
	- Added: __IsIP: IPV6 Support (IVP6, HexCompressed, 6Hex4Dec, Hex4DecCompressed)

V0.6.0.1b-9
	- Added: __FFStartProcess: 64bit support
	- Added: __FFIsURL: support for intranet
	- Changed: _FFQuit now closes FireFox with multiple windows
	- Fixed: Connection-limit to MozRepl

V0.6.0.1b-8 (by Danp2)
	- Changed: _FFTabExists to allow search by href
	- Changed: _FFTabSetSelected to allow selection by href
	- Changed: SelectWin to check individual tabs
	- Added: FFau3.SearchTabURL helper function
	- Fixed: __FFStartProcess
	- Fixed: _FFGetPosition

V0.6.0.1b-7
	- New: Internal function: __FFMultiDispatchEvent: Dispatches multiple events on one element
	- Added: _FFDisPatchEvent can now simulate MouseEvents: click, mousedown, mouseup, mouseover, mousemove, mouseout
	- Added: Global constants $_FF_Event_*
	- Changed: Removed connection-limit to MozRepl
	- Optimized: __FFFilterString
	- Optimized: __FFB2S (Bool to string)
	- Optimized: __FFIsIP

V0.6.0.1b-6
	- Added: Internal function __FFSetTopDocument()
	- Changed: Default values for _FFXpath: _FFXPath($sQuery, $sAttribute = "", $iReturnType = 9, $iFilter = 0)
	- Changed/Fixed: _FFSearch($sSearchString[, $bCaseSensitive = False[, $bWholeWord = False[, $bSearchInFrames = True]]])
	!!! Now you can use as $sSearchString RegExp, too!
	- Fixed:
		_FFAction
		_FFClick
		_FFFormSubmit
		_FFLoadWait
		_FFDisPatchEvent
		_FFOpenURL
		_FFTabAdd
		_FFTabClose
		_FFTabSetSelected
		now updating the FFau3.WCD-object (window.content.document)
	- Fixed: Different problems after _FFTabAdd
	- Fixed: Different problems after _FFOpenURL
	- Fixed: Error in _FFAu3Option()

V0.6.0.1b-4
	- Changed: Default values for _FFXpath: _FFXPath($sQuery, $sAttribute = "", $iReturnType = 9, $iFilter = 0)
	- Fixed: Different problems after _FFTabAdd
	- Fixed: Different problems after _FFOpenURL
	- Fixed: Errorin _FFAu3Option()

V0.6.0.1
	- Added: Option $_FF_SEARCH_MODE works now for:
		_FFLinkClick
		_FFImageClick
	- Added: _FFClick: Parameter $bLoadWait
	- Added: _FFLoadWait: Parameter $bStop = stops pageloading after timeout
		- Added: _FFAu3Option: "LoadWaitStop"
		- Added: Global var $_FF_LOADWAIT_STOP
	- Updated: _FFXPath: some optimizations (shorter command strings to send)
	- Optimized: _FFFormOptionSelect
	- Optimized: _FFLoadWait
	- Fixed: _FFGetPosition: Removed error if "MozillaContentWindowClass" is not found
	- Fixed: _FFSearch: Error with non-ASCII-chars
	- Fixed: _FFLinkClick: Error with non-ASCII-chars
	- Fixed: _FFImageClick: Error with non-ASCII-chars
	- Fixed: _FFAction("alert", ...): Error with non-ASCII-chars

For compatibily for older scripts and more functions, please use this UDF:
http://thorsten-willert.de/Themen/FFau3/FF.au3/FFEx.au3

Function list:
_FFAction
_FFClick
_FFCmd
_FFConnect
_FFDialogWait
_FFDisConnect
_FFDispatchEvent
_FFFormCheckBox
_FFFormGetElementsLength
_FFFormOptionSelect
_FFFormRadioButton
_FFFormReset
_FFFormSubmit
_FFFrameEnter
_FFFrameLeave
_FFGetLength
_FFGetObjectInfo
_FFGetPosition
_FFGetValue
_FFImageClick
_FFImageGetBySize
_FFImageMapClick
_FFIsConnected
_FFLinkClick
_FFLinksGetAll
_FFLoadWait
_FFLoadWaitTimeOut
_FFObj
_FFObjDelete
_FFObjGet
_FFObjNew
_FFOpenURL
_FFPrefGet
_FFPrefReset
_FFPrefSet
_FFQuit
_FFReadHTML
_FFReadText
_FFSearch
_FFSetValue
_FFStart
_FFTabAdd
_FFTabClose
_FFTabDuplicate
_FFTabExists
_FFTabGetSelected
_FFTabSetSelected
_FFTableWriteToArray
_FFWindowClose
_FFWindowGetHandle
_FFWindowOpen
_FFWindowSelect
_FFWriteHTML
_FFXPath

Requirement(s).:
Latest Version of FireFox and the AddOn MozRepl

!!!
Don't forget to start MozRepl.
FF-menu: Extras/Menu or check there "Activate on startup".


Documentation:
- English
- German
- Russian (by Valery)
- Englisch CHM, user-calltips ...

FF.au3 extensions:
- _FF_DM.au3 (UDF for the FireFox Download-Manager) [Forum]
- _FFEx.au3 (more functions and compatibly fixes for older scripts):
; _FFDisPatchKeyEvent
; _FFFormGetLength
; _FFGetValueById
; _FFGetValueByName
; _FFSetValueById
; _FFSetValueByName
; _FFTabCloseAll
; _FFTabGetLength
; _FFTableGetCell
; _FF_Call
; _FF_CookiesAllow
; _FF_CookiesDeny
; _FF_CookiesRemoveAll
; _FF_CookiesSetAccess
; _FF_EmptyCache
; _FF_EmptyCookies / _FF_CookiesRemoveAll
; _FF_EmptyHistory
; _FF_FormSetFileInput
; _FF_GetContentXY
; _FF_GetCurrentURL
; _FF_GetStatus
; _FF_GetTitle
; _FF_MozRepl_Detect
; _FF_ResetTitle
; _FF_TabGetAllTitles
; _FF_TabGetAllURLs
; _FF_TabReloadAll


UDFs for FireFox AddOns:
- _FF_FireFM [Forum]
- _FF_FoxBox.au3 [Forum]
- _FF_Screengrab.au3 [Forum]

Misc:
- _FF_AutoLogin [Forum]
- _FF_RecordForm [Forum]
- YouTube-API-Wrapper [Forum]


Known problems:
- The _FFTab* functions doesn't work, if you have the FF-AddOn TabMixPlus installed (this AddOn seems to override some internal FF-functions)

More examples and stuff are on my homepage.


Stilgar

Edited by Melba23
Fixed link
1 person likes this

Share this post


Link to post
Share on other sites



#2 ·  Posted

I take it for any response on FF.au3, you should post in this thread, not the one I started and Stilgar maintained.

Share this post


Link to post
Share on other sites

#3 ·  Posted

Great stuff! Is this likely to be in a future release like the IE library is?

This has massive potential!


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I know this method takes a different approach. But Authenticity posted a very nice link to automate FF like IE the other day... http://www.iol.ie/~locka/mozilla/control.htm

If you're interested, or maybe want to expand in areas you may not have with the current setup.

Edited by SmOke_N
ebonics

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#5 ·  Posted

I know this method takes a different approach. But Authenticity posted a very nice link to automate FF like IE the other day... http://www.iol.ie/~locka/mozilla/control.htm

If you're interested, or maybe want to expand in areas you may not have with the current setup.

Hello,

yes I know about it.

But this thing is only working with FF V1.5!

http://www.iol.ie/~locka/mozilla/mozilla.htm

http://kb.mozillazine.org/ActiveX

And it crashes FF V2.x. We have V3.x now ... :)

The only other thing I found was an

"An NPAPI based plugin for Firefox that enables the use of ActiveX controls":

http://code.google.com/p/ff-activex-host/

but I don't know if this the right thing and it has many limits, because of the security riscs by ActiveX.

Share this post


Link to post
Share on other sites

#6 ·  Posted

can this UDF to control FireFox be used for embedding FF into a GUI AutoIt Script..??

If not than whats the best way to do it then..??

Share this post


Link to post
Share on other sites

#7 ·  Posted

could these FF functions be used to control an embedded FF Mozilla ActiveX control that's mentioned here..??

#141301

Share this post


Link to post
Share on other sites

#8 ·  Posted

could these FF functions be used to control an embedded FF Mozilla ActiveX control that's mentioned here..??

#141301

Sorry, like I said two posts bevore, this thing is for FF V1.5, it doesn't work with the current versions.

And I have no other solution, yet.

Only a dirty hack:

_FF_CreateEmbedded.au3

Share this post


Link to post
Share on other sites

#9 ·  Posted

Thank you for the updated library, I'm using it and I like it. But I'd suggest changing the function __FFIsURL.

Look: now all URLs like "localhost" or IP-like (XXX.XXX.XXX.XXX) are rejected by this function, and i can't even open my forst FF window.

I'd suggest this one:

Func __FFIsURL(ByRef $URL)

Return (StringRegExp($URL, '^^((ht|f)tp(s?)\:\/\/|~/|/)([\w]+:\w+@)?([a-zA-Z]{1}([\w\-]+\.)+([\w]{2,5}))(:[\d]{1,5})?((/?\w+/)+|/?)(\w+\.[\w]{3,4})?((\?\w+=\w+)?(&\w+=\w+)*)?') Or _

StringRegExp($URL,'^((ht|f)tp(s?)://)?(\d{1,3}\.){3}\d{1,3}(:[\d]{1,5})?(/.*)?$') Or _

StringLeft($URL, 6) = "about:" Or _

StringLeft($URL, 7) = "chrome:" Or _

StringLeft($URL, 10) = "localhost:" Or _

StringLeft($URL, 8) = "file:///")

EndFunc ;==>__FFIsURL

What do you think?

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

@Elena:

Thank you for your suggestion, I would use it (or similar) in the next version.

Edited by Stilgar

Share this post


Link to post
Share on other sites

#14 ·  Posted

Hi Stilgar,

Do you support "frame in frame" handling? Please help me with automation of my page. Unfortunately I cannot get a link to it as it is in our network with VPN, but I'll describe it. The page contains of different set of frames with "frame in frame" architecture:

Frame "Main" is located in browser page;

Frame "DataEntry" is located in frame "Main";

Form "form1" is located in frame "DataEntry";

Drop-down "PID" and text edit box "sfname" are located in form "form1".

My code is:

$FFInstance = _FFStart($g_sDataEntryLink) 

$mainFrame = _FFFrameEnter("Main", "name")
$mainFrame = _FFFrameGetSelected("name")
MsgBox(0, "$mainFrame", $mainFrame)

$DataEntryFrame = _FFFrameEnter("DataEntry", "name")
$mainFrame = _FFFrameGetSelected("name")
MsgBox(0, "$DataEntryFrame", $DataEntryFrame)
    
Sleep (5000)
_FFFormOptionselect("PID", "name", "Custom HF Request", "name", "form1", "name")
    
$First_name = _FFGetValueByName("sfname", 3,0)
MsgBox(0, "$First_name", $First_name)

My script opens a page, then gives message box with "Main" (so it determines the first frame correctly). Second message box returns "-1", third one returns empty string (though I fill the sfname textbox while sleeping). "Custom HF Request" option is not set in a dropdown.

What I do wrongly?

Thanks in advance.

Share this post


Link to post
Share on other sites

#15 ·  Posted

@Elena

sorry currently not.

Known problems:

- The _FFTab* functions doesn't work, if you have the FF-AddOn TabMixPlus installed (this AddOn seems to override some internal FF-functions)

- Nested frames are not supported by the _FFFrame* functions yet, but you have access to them over DOM.

Access over DOM is a bit complicated in this case.

But you can load only the "inner" frame-set:

_FFFrameEnter('Main','name')
$url = _FFCmd('.location.href')
_FFFrameLeave()
_FFOpenURL($url)

_FFFrameEnter("DataEntry", "name")
$mainFrame = _FFFrameGetSelected("name")
MsgBox(0, "$DataEntryFrame", $DataEntryFrame)
...

Share this post


Link to post
Share on other sites

#16 ·  Posted

is anyone working/developing on embedding FF into a AutoIt GUI at all yet..??

Share this post


Link to post
Share on other sites

#17 ·  Posted

Hi Stilgar,

Thank you for your comment about nested frames, I can use it now!

I noticed a mistake in my - and, also yours, - code. Tried this (changed $mainFrame to $DataEntryFrame):

_FFFrameEnter('Main','name')
$url = _FFCmd('.location.href')
_FFFrameLeave()
_FFOpenURL($url)

_FFFrameEnter("DataEntry", "name")
$DataEntryFrame = _FFFrameGetSelected("name")
MsgBox(0, "$DataEntryFrame", $DataEntryFrame)

It works!

Are you working on nested frames handling for next FF.au3 versions? I worked with IE library and wrote a recursive function which searches named frames in chain of frames in a page. I will try to realize it for FF. Do you have some function now which returns a set of frames, like _IEFrameGetCollection?

Share this post


Link to post
Share on other sites

#18 ·  Posted

@Elena:

Hi,

no collections, but you just can use _FFGetLength("frames") and the frame-index in a loop,

or you use:

$aNames = _FFXpath("//frame","name",6)

$aNames = _FFXpath("//iframe","name",6) ; for iframes

that returns an array with the name of all frames.

Share this post


Link to post
Share on other sites

#19 ·  Posted

Hire is some feedback:

I have many tabs open + many addons installed including tabmix.

Im looking for a way to do _ie_navigate() / with firefox.

I have this: 1 active tab & i need to change the url constantly:

www...pool/show/001
www...pool/show/002
www...pool/show/003 etc...

I installed the addon & tried the _FFOpenURL sample. but it said cant connect to firefox. & nothing happened.

Is there a way to do this?


My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

Share this post


Link to post
Share on other sites

#20 ·  Posted

I installed the addon & tried the _FFOpenURL sample. but it said cant connect to firefox. & nothing happened.

Hello,

have you started MozRepl?

FF-menu: Extras/MozRepl

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