Jump to content

FF.au3 (V0.6.0.1b-10)


Stilgar
 Share

Recommended Posts

I'm trying to read and save as file the source of a webpage that contains Cyrillic characters but i'm not able to get them right. I get the English ones write, but the Cyrillic are just some kind of garbage. Here is the source with an example of yandex.ru (popular russian search engine). Am I doing something wrong or FF.au3 doesn't support Cyrillic alphabet?

#Include <FF.au3>

If _FFStart("yandex.ru") Then
    $sHTML = _FFReadHTML()
    If Not @error Then FileWrite ("text.html", $sHTML )

    ; filtered source-code
    $sHTML = _FFReadHTML("html",7)
        FileWrite ("text2.html", $sHTML )
EndIf
Link to comment
Share on other sites

It works for me:

#Include <FF.au3>

If _FFStart() Then
    _FFOpenURL("www.ya.ru")
    ;filter HTML tags from body
    $sHTML = _FFReadHTML("body",8)
    If Not @error Then 
     $File = FileOpen("text.txt",2)
     FileWrite ($File, $sHTML )
     FileClose($File)
    endif
    ;get innerHTML from html
    $sHTML = _FFReadHTML("html")
    If Not @error Then 
     $File = FileOpen("text.html",2)
     FileWrite ($File, $sHTML )
     FileClose($File)
    endif
EndIf

The point of world view

Link to comment
Share on other sites

Still NOT working for me :( It's getting me results like * !45;0BL AB0@B>2>9 * >9B8 2 ?>GBC /=45:A. I'm out of any ideas, I've been looking for workarounds for 8 hours

You should read this page. Yandex page has page charset as windows-1251. The FF thinks that it is UTF-8. You have to get binary content of page.

Javascript can't get it. This .responseBody has IE's object Msxml2.XMLHTTP or XMLHttpRequest, only.

Yes. It is small problem with full binary content of page, I think.

>_<

The point of world view

Link to comment
Share on other sites

Workaround to find the position of the content area:

$a = ControlGetPos(_FFCmd(".title"), "", "[CLASS:MozillaContentWindowClass]")
_ArrayDisplay($a)

https://wiki.mozilla.org/Accessibility/AT-Windows-API#How_to_Find_the_Content_Window_and_Load_the_Document

Excellent, I don't know if I ever would have managed to find that. I already wrote a workaround, but that is much less ugly than what I came up with. Thanks.
Link to comment
Share on other sites

Even you added Opt("TCPTimeOut", $_FF_CON_DELAY) but it still have that TCP 10053 error, and seem to be more often.

More often? The complete line is:

If $_FF_CON_DELAY > 100 Then Opt("TCPTimeout", $_FF_CON_DELAY)

so I don't think you can have more timeouts then before.

I can only try some things, because I can't reproduce this error.

-------

New in the latest test-version:

_FFDispatchEvent($sElement, $sEventType = "change")

$sElement = Element or object from _FFXpath /_FFObj*

$sEventType = change|select|focus|blur|resize

http://thorsten-willert.de/Themen/FFau3/Testversion/FF.au3

Link to comment
Share on other sites

More often? The complete line is:

If $_FF_CON_DELAY > 100 Then Opt("TCPTimeout", $_FF_CON_DELAY)

so I don't think you can have more timeouts then before.

I can only try some things, because I can't reproduce this error.

-------

New in the latest test-version:

_FFDispatchEvent($sElement, $sEventType = "change")

$sElement = Element or object from _FFXpath /_FFObj*

$sEventType = change|select|focus|blur|resize

http://thorsten-willert.de/Themen/FFau3/Testversion/FF.au3

Hi, Stilgar

Actually I don't know where this error come from. It's really strange but I used your previous version this error happened when I compiled the script only if I ran from the editor it didn't happen. But this version it happens even I run from the editor >_<

I will send you my script, please check it if you have free time.

Have a nice day.

Edited by trinitrotoluen
Link to comment
Share on other sites

I'm trying to read and save as file the source of a webpage that contains Cyrillic characters but i'm not able to get them right. I get the English ones write, but the Cyrillic are just some kind of garbage. Here is the source with an example of yandex.ru (popular russian search engine). Am I doing something wrong or FF.au3 doesn't support Cyrillic alphabet?

[ code='text' ] ( Popup )

See AFireFox_Full - v.1.2. here

Added two buttons:

Execute - call javascript functions from content current page

Source - get page source of current URL (incl. UTF-8)

It works fine with Russian page content, too.

The point of world view

Link to comment
Share on other sites

You can do it by editing the "mimeTypes.rdf" in your profile-dir, or do you wanna change it while FF is running?

I want to change it at the beginning of a session and after restore it at the end of the session

I correct a problem in _MozRepl_Detect

The location of firefox when several installation has been made would be correct like this

If $bInstall Then

Local $sHKLM = "HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Desktop"

Local $sFFExe = RegRead($sHKLM , "SOFTWARE\Clients\StartMenuInternet\FIREFOX.EXE\shell\open\command")

EndIf

Edited by LOULOU
Link to comment
Share on other sites

I want to change it at the beginning of a session and after restore it at the end of the session

It' a bit complicated to made this while FF is running, I'm searching for a solution.

I correct a problem in _MozRepl_Detect

The location of firefox when several installation has been made would be correct like this

Are you sure, that you have "corrected" it?

I have never seen a key like "HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Desktop" anywhere. So the _MozRepl_Detect doesn't work here anymore.

I've used the registry descripted e.g. on this page:

https://developer.mozilla.org/en/Gecko_Plugin_API_Reference/Plug-in_Development_Overview

(near the bottom of the page "Plug-in Installation and the Windows Registry" - search for "PathToExe")

Link to comment
Share on other sites

It' a bit complicated to made this while FF is running, I'm searching for a solution.

Are you sure, that you have "corrected" it?

I have never seen a key like "HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Desktop" anywhere. So the _MozRepl_Detect doesn't work here anymore.

I've used the registry descripted e.g. on this page:

https://developer.mozilla.org/en/Gecko_P...I_Reference/Plug-in_Development_Overview

(near the bottom of the page "Plug-in Installation and the Windows Registry" - search for "PathToExe")

So IN french XP pack SP3

Your Key is in HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox\3.5.2 (fr)\Main

and subkey Pathtoexe The return is C:\Program Files\Mozilla Firefox\firefox.exe

This key is dependant from the version of Firefox installed

Always IN Xp3 the following key

HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Desktop

subkey

SOFTWARE\Clients\StartMenuInternet\FIREFOX.EXE\shell\open\command

return the same thing "C:\Program Files\Mozilla Firefox\firefox.exe" but seems no to be dependant off version

This is only avalaible on French system , i can't try it on another foreign language

Can some one confirm or not this is the same problem in an XP English Version with Firefox 3.2

Thanks

Link to comment
Share on other sites

how to add in include folder FF.au3?? i added in folder but script says, i dont have FF.au3 :D

[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]

Link to comment
Share on other sites

Error when accessing a table By id

_FFTABLEWritetoarray("tabListeDetail", "id", "text", True)

Here is the error message

__FFSend: try{window.content.wrappedJSObject.frames["top"].document.getElementsByTagName('table').length;}catch(e){'_FFCmd_Err';};

__FFRecv: 9

__FFSend: try{content.document.tabListeDetail}catch(e){'_FFCmd_Err';};

__FFRecv:

__FFSend: try{content.document.tabListeDetail.getElementsByTagName('tr').length}catch(e){'_FFCmd_Err';};

__FFRecv: _FFCmd_Err

_FFCmd ==> Error return value: _FFCmd_Err

FF.au3 (2830) : ==> Array variable subscript badly formatted.:

Local $a_TableCells[$i_cols][$trs]

Local $a_TableCells[^ ERROR

->18:00:35 AutoIT3.exe ended.rc:1

+>18:00:37 AutoIt3Wrapper Finished

Link to comment
Share on other sites

@toader:

Do you have saved it as FF.au3 in your include-dir? e.g.:

c:\program files\autoit\include

@LOULOU:

I try to fix this in the next update.

For simple tables (no merged cells, no line breaks in cells) you can try something like this:

Global $aTable[1][1]
$a = _FFXpath("//table[@id='tabListeDetail']//tr",default,6)
$a[1] = StringStripWS($a[1],3)
$aRow = StringSplit($a[1],@crlf)
ReDim $aTable[$a[0]][UBound($aRow)-1]

For $i = 1 To $a[0]
    $a[$i] = StringStripWS($a[$i],3)
    $aRow = StringSplit($a[$i],@crlf)
    For $j = 0 To $aRow[0]-1
        $aTable[$i-1][$j] = StringStripWS($aRow[$j+1],3)
    Next
Next
_ArrayDisplay($aTable)

or this:

For $i = 1 To 100000
    $a = _FFXpath("//table[@id='tabListeDetail']//tr[" & $i & "]//td",default,6)
    If $a[0] = 0 Then ExitLoop
    _ArrayDisplay($a) ; do something with $a
Next
Edited by Stilgar
Link to comment
Share on other sites

@toader:

Do you have saved it as FF.au3 in your include-dir? e.g.:

c:\program files\autoit\include

@LOULOU:

I try to fix this in the next update.

For simple tables (no merged cells, no line breaks in cells) you can try something like this:

Global $aTable[1][1]
$a = _FFXpath("//table[@id='tabListeDetail']//tr",default,6)
$a[1] = StringStripWS($a[1],3)
$aRow = StringSplit($a[1],@crlf)
ReDim $aTable[$a[0]][UBound($aRow)-1]

For $i = 1 To $a[0]
$a[$i] = StringStripWS($a[$i],3)
$aRow = StringSplit($a[$i],@crlf)
For $j = 0 To $aRow[0]-1
$aTable[$i-1][$j] = StringStripWS($aRow[$j+1],3)
Next
Next
_ArrayDisplay($aTable)

or this:

For $i = 1 To 100000
$a = _FFXpath("//table[@id='tabListeDetail']//tr[" & $i & "]//td",default,6)
If $a[0] = 0 Then ExitLoop
_ArrayDisplay($a) ; do something with $a
Next

Hi stligar,

Thanks for answering, I will correct in documentation _FFGetlength /// Tables option is forgotten

Link to comment
Share on other sites

@toader:

Do you have saved it as FF.au3 in your include-dir? e.g.:

c:\program files\autoit\include

yes is in .../autoit/include

now all is good.. but have new problem in FF - Page Analyzer.. can understand how to add page :D can u say me? i pushed all butons.. but that dont help((

and somebody know how i can do controlclick, controlsend in FFwindow?

Edited by toader

[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]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...