Sign in to follow this  
Followers 0
CharlesStamp

Basic MozLab/FF.au3 question

12 posts in this topic

#1 ·  Posted (edited)

Hi. I've been trying this for about a week and found it easy enough to get to grips with, but I'm having real problems getting the FF.au3 UDF to work with MozRepl.

I'm running FireFox 2.0.2 with Mozlab, and I've put FF.au3 in my Includes folder. I've checked that MozRepl is running on port 4242, but the only command that seems to work is _FFStart.

When I try running the script below, I just get the message "Disconnected from FireFox" after a few seconds.

#Include <FF.au3>

; trying to connect to a running FireFox with MozRepl on
If _FFConnect(Default, Default, 3000) Then
; open a page
    _FFOpenURL("http://ff-au3-example.thorsten-willert.de/")
    Sleep(3000)
; disconnect from FireFox
    If _FFDisConnect() Then MsgBox(64, "", "Disconnected from FireFox!")
Else
    MsgBox(64, "", "Can't connect to FireFox!")
EndIf

and the one next one just opens a new FireFox window.

#Include <FF.au3>

_FFStart()

If _FFIsConnected() Then
; add a new tab with an URL
    _FFTabAdd("http://ff-au3-example.thorsten-willert.de/")
    sleep(3000)
; add a new blank tab and bring it to front
    _FFTabAdd(default,true)
    Sleep(3000)
; select the tab with "FF" in the label
    _FFTabGetSelected("FF","label")
; shows the number of tabs
    MsgBox(64,"Number of tabs:",_FFTabGetLength())
; closing all tabs except the current
    _FFTabCloseAll()
    Sleep(3000)
; closes FireFox
    _FFQuit()
EndIf

So if anyone has any ideas, I'd be grateful.

Edited by CharlesStamp

Share this post


Link to post
Share on other sites



What did you expect with the first script to happen?

It seems to me you do a FFDisconnect() after 3 seconds and get on a successful disconnect that MsgBox().


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Wrong syntax, you need to ref to the socket...

#Include <FF.au3>
$MozRepl_Port = 4242
$Socket = _FFConnect("127.0.0.1", $MozRepl_Port, 500)

If $Socket = -1 Then
    MsgBox(0,"Error", "Error connecting to Firefox!")
Else
    _FFOpenURL($Socket, "http://ff-au3-example.thorsten-willert.de/", True)
    Sleep(3000)
    If _FFDisConnect($Socket) Then MsgBox(64, "", "Disconnected from FireFox!")
endif

Share this post


Link to post
Share on other sites

Wrong syntax, you need to ref to the socket...

#Include <FF.au3>
$MozRepl_Port = 4242
$Socket = _FFConnect("127.0.0.1", $MozRepl_Port, 500)

If $Socket = -1 Then
    MsgBox(0,"Error", "Error connecting to Firefox!")
Else
    _FFOpenURL($Socket, "http://ff-au3-example.thorsten-willert.de/", True)
    Sleep(3000)
    If _FFDisConnect($Socket) Then MsgBox(64, "", "Disconnected from FireFox!")
endif
I've removed all socket-parameters in V0.5.0.0.

@CharlesStamp:

What's the output in your editor console/output ?

Share this post


Link to post
Share on other sites

@ Stilgar

Running this...

#Include <FF.au3>

; trying to connect to a running FireFox with MozRepl on
If _FFConnect(Default, Default, 3000) Then
; open a page
    _FFOpenURL("http://ff-au3-example.thorsten-willert.de/")
    Sleep(3000)
; disconnect from FireFox
    If _FFDisConnect() Then MsgBox(64, "", "Disconnected from FireFox!")
Else
    MsgBox(64, "", "Can't connect to FireFox!")
EndIf

just shows the "disconnected.." message, and the editor output is shown below.

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Program Files\AutoIt3\Examples\isffconnected.au3" 
_FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3
_FFConnect: AutoIt: 3.3.0.0
_FFConnect: FF.au3: 0.5.3.0b-9
_FFConnect: IP: 127.0.0.1
_FFConnect: Port:   4242
_FFConnect: Delay:  2ms
_FFConnect: Socket:     1688
_FFConnect: Browser:    !!! Trying to load a non-local URI.
_FFSendJavascripts: Sending functions to FireFox ........... done
_FFOpenURL: http://ff-au3-example.thorsten-willert.de/
__FFSend: try{window.content.frames["top"].document.location.href="http://ff-au3-example.thorsten-willert.de/";}catch(e){'_FFCmd_Err';};
__FFRecv: !!! Trying to load a non-local URI.
_FFOpenURL ==> No match: http://ff-au3-example.thorsten-willert.de/
_FFDisConnect: disconnected
>Exit code: 0   Time: 6.995

Not sure what the output means, but I expected it to go to your site in Firefox which was already running.

Thanks for taking a look at this Stilgar.

Share this post


Link to post
Share on other sites

@ Stilgar

Running this...

#Include <FF.au3>

; trying to connect to a running FireFox with MozRepl on
If _FFConnect(Default, Default, 3000) Then
; open a page
    _FFOpenURL("http://ff-au3-example.thorsten-willert.de/")
    Sleep(3000)
; disconnect from FireFox
    If _FFDisConnect() Then MsgBox(64, "", "Disconnected from FireFox!")
Else
    MsgBox(64, "", "Can't connect to FireFox!")
EndIf

just shows the "disconnected.." message, and the editor output is shown below.

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Program Files\AutoIt3\Examples\isffconnected.au3" 
_FFConnect: OS: WIN_XP WIN32_NT 2600 Service Pack 3
_FFConnect: AutoIt: 3.3.0.0
_FFConnect: FF.au3: 0.5.3.0b-9
_FFConnect: IP: 127.0.0.1
_FFConnect: Port:   4242
_FFConnect: Delay:  2ms
_FFConnect: Socket:     1688
_FFConnect: Browser:    !!! Trying to load a non-local URI.
_FFSendJavascripts: Sending functions to FireFox ........... done
_FFOpenURL: http://ff-au3-example.thorsten-willert.de/
__FFSend: try{window.content.frames["top"].document.location.href="http://ff-au3-example.thorsten-willert.de/";}catch(e){'_FFCmd_Err';};
__FFRecv: !!! Trying to load a non-local URI.
_FFOpenURL ==> No match: http://ff-au3-example.thorsten-willert.de/
_FFDisConnect: disconnected
>Exit code: 0   Time: 6.995

Not sure what the output means, but I expected it to go to your site in Firefox which was already running.

Thanks for taking a look at this Stilgar.

The problem seems to be there:

"!!! Trying to load a non-local URI."

this error appears in FireFox (if you search the web) with some AddOns (Megaupload, Chickenfoot ...).

Can you use FireFox normaly?

Have you any AddOns installed?

Can you try it with a new FF profile only with MozRepl installed, please?

Share this post


Link to post
Share on other sites

Can you try it with a new FF profile only with MozRepl installed, please?

I've just tried it and the result is the same. There's a pause, then "Disconnected from Firefox". This was on a new profile with only the standard add-ons and MozLab installed and running. I'll try it later today with a completely fresh FF install.

Also, can anybody confirm whether MozLab requires a US Localized version of FF? I think I read that somewhere, but I'm not sure. Thanks again.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

...

Also, can anybody confirm whether MozLab requires a US Localized version of FF? I think I read that somewhere, but I'm not sure. Thanks again.

I've never read this anywhere.

I know that it works with the german, us and french version.

But look at the project-page: http://hyperstruct.net/projects/mozlab

For the other error:

Have you the Addon for Megaupload installed?

Edited by Stilgar

Share this post


Link to post
Share on other sites

No, I've never installed the Megaupload add-on, and the only ones I had were the default Firefox ones. I've also erased FF and reinstalled FF2, but no success. I don't think MozLab works with the latest version of FF3 otherwise I'd try that.

To add to that, running the same script on a different PC (FF2, Skype and screengrab extensions installed, but both disabled) results in the message "can't connect to Firefox" and included the following output

_FFConnect ==> General Error: Tried to connect to a non browser-window

I don't mean to complicate things by discussing two separate issues on two different installations, but I thought it might help shed some light on the problem.

Share this post


Link to post
Share on other sites

No, I've never installed the Megaupload add-on, and the only ones I had were the default Firefox ones. I've also erased FF and reinstalled FF2, but no success. I don't think MozLab works with the latest version of FF3 otherwise I'd try that.

To add to that, running the same script on a different PC (FF2, Skype and screengrab extensions installed, but both disabled) results in the message "can't connect to Firefox" and included the following output

_FFConnect ==> General Error: Tried to connect to a non browser-window

I don't mean to complicate things by discussing two separate issues on two different installations, but I thought it might help shed some light on the problem.

Oh, I see.

I don't know if this combination works with FF2.

For FF3 you need MozRepl.

Share this post


Link to post
Share on other sites

I thought it might be a noobish error ^_^

I've got MozRepl for FF3 and it works perfectly. Thanks for your help Stilgar, and everybody else. Sorry for wasting your time, but hopefully I'll come up with some good scripts to make up for it.

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