Jump to content

FF.au3 (V0.6.0.1b-10)


Stilgar
 Share

Recommended Posts

I do not know if this is enough? These are the last 4 lines in SciTE.

__FFSend: try{FFau3.simulateEvent(FFau3.WCD.getElementById('file1'),'MouseEvents','click');}catch(e){'_FFCmd_Err';};
__FFRecv: 1
_FFLoadWait: . loaded in 10ms
[object HTMLDocument] - {location: {...}, querySelector: function() {...}, querySelectorAll: function() {...}, evaluate: function() {...}, createExpression: function() {...}, createNSResolver: function() {...}, addEventListener: function() {...}, ...}
Edited by foozoor
Link to comment
Share on other sites

Dear Danp2

Thank u very much!

How could i get the web Text( UTF-8 Code) use _FFReadText? I am in china. The result is unrecognizable .

#include <FF.au3>

Local $wait_seconds = 3

Local $sss

If _FFConnect() Then

_FFOpenURL('http://www.baidu.com/')

$sss=_FFReadtext(8)

MsgBox(0,"",$sss)

EndIf

Exit

=========================================

the text is what i want get

搜索设置|登录注册

新 闻 网 页 贴 吧 知 道 音 乐 图 片 视 频 地 图

百科 文库 hao123 | 更多>>

把百度设为主页把百度添加到桌面

加入百度推广 | 搜索风云榜 | 关于百度 | About Baidu

©2012 Baidu 使用百度前必读 京ICP证030173号

post-75892-0-59508200-1352796561_thumb.j

Edited by sleep365
Link to comment
Share on other sites

  • 1 month later...

Hello,

When ever I start an AU script that uses the FF.au2 UDF , it open the web page i tell it to go to as well as and error

page that tells me "Firefox cant establish a connection to server at port 4242. I have validated that Mozrepl is started.

Any Ideas what Im doing wrong ?

Script is real simple

#include <FF.au3>

_ffstart(http://google.com)

Link to comment
Share on other sites

ok, doing more digging and if I open a Mozilla Browser and sepcify in the autoit script to attach to an exiting session that works and the second page i was getting with the connection errors does not happen.

I need a clean way to start a mozilla browser session via autoit as i plan to have the whol session hidden so the user will no be able to interact with it.

Any Ideas what i should try ?

I have replciated the original issue on 2 differnt computers.

Link to comment
Share on other sites

  • 4 weeks later...

Hello,

I hjave run into another issue I have the Html below

Im trying to figure out how to click on the radio button next to User id .

I have tried ffclick with no luck.

Using the IE udf I use tagnamecollections to get to click the radio button.

Below is the IE udf code.

How would i replicate this using FF udf

$objINPUTtags = _IETagNameGetCollection($oIE2,"input")

;seelct userid radio button

For $objINPUTtag In $objINPUTtags

;$objINPUTtag.sourceIndex >0 and

If stringinstr($objINPUTtag.value,'uid') > 0 Then

_IEAction ( $objINPUTtag, "click")

exitloop

EndIf

Next

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

<head>

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>Customer Admin : User Search Results</title>

<link href="/css/main.css" type="text/css" rel="STYLESHEET">

<script SRC="/js/net/UserAgent.js" language="Javascript"></script><script SRC="/js/searches.js" language="Javascript1.2"></script><script SRC="/js/validation.js" language="Javascript1.2"></script><script SRC="/js/assignments.js" language="Javascript1.2"></script><script SRC="/js/Constants.js" language="Javascript1.2"></script><script SRC="/js//trigger.js" language="Javascript1.2"></script><script SRC="/js//searchOnEnter.js" language="Javascript1.2"></script>

</head>

<body onload="initSearch()" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#ffffff">

<form method="post">

<input name="searchMethod" type="hidden" value="search_selectuser"><input name="searchType" type="hidden" value="portaluserSelect"><input name="searchStyle" type="hidden" value="portaluserSelect"><input name="embedded" type="hidden" value="false"><input name="offset" type="hidden" value="0"><input name="increment" type="hidden" value="20"><input value="false" name="newwindow" type="hidden"><input name="searchFilter" type="hidden" value=""><input name="assignToElement" type="hidden" value="uid"><input name="popup" type="hidden" value="true">

<div class="content">

<h3>User Search Results</h3>

<em>** Remember, when using the User ID search, that this is an exact match search. If you do NOT know the User ID exactly, please use the Last Name search.</em>

<table class="searchTable">

<tr>

<th>Search By:</th><td><input onfocus="selectuserRB(this.form,'uid');clearSearchEmailAddr(this.form);clearSearchUserName(this.form)" value="uid" name="userRB" class="inputnoborder" type="radio"></td><td align="left">User ID:</td><td colspan="4"><input onfocus="selectuserRB(this.form,'uid');clearSearchUserName(this.form);clearSearchEmailAddr(this.form)" size="60" name="searchuid"></td>

</tr>

<tr>

<td>&nbsp;</td><td><input onfocus="selectuserRB(this.form,'emailaddr');clearSearchUID(this.form);clearSearchUserName(this.form)" value="emailaddr" name="userRB" class="inputnoborder" type="radio"></td><td align="left">Email Address:</td><td colspan="4"><input onfocus="selectuserRB(this.form,'emailaddr');clearSearchUID(this.form);clearSearchUserName(this.form)" size="60" name="mail"></td>

</tr>

<tr>

<td>&nbsp;</td><td><input onclick="clearSearchUID(this.form);clearSearchEmailAddr(this.form);" value="username" name="userRB" class="inputnoborder" type="radio" checked></td><td align="left">Last Name:</td><td><input onfocus="selectuserRB(this.form,'username');clearSearchUID(this.form);clearSearchEmailAddr(this.form);" size="20" name="sn"></td><td>&nbsp;</td><td align="right">First Name:</td><td><input onfocus="selectuserRB(this.form,'username');clearSearchUID(this.form);clearSearchEmailAddr(this.form);" size="20" name="givenname"></td>

</tr>

<tr>

<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td align="right"><em>exact match:&nbsp;</em><input class="inputnoborder" value="EMsn" name="EMsn" type="checkbox"></td><td>&nbsp;</td><td>&nbsp;</td><td align="right"><em>exact match:&nbsp;</em><input class="inputnoborder" value="EMgivenname" name="EMgivenname" type="checkbox"></td>

</tr>

</table>

<div class="actionsRow">

<a class="cssbutton" href="javascript:search(document.forms[0])">

Search

</a>

</div>

<table class="resultsTable">

<thead>

<tr>

<th>Select</th><th>User Name</th><th>User ID</th><th>Company</th><th>Status</th><th>Relationship</th>

</tr>

</thead>

<tbody></tbody>

</table>

</div>

</form>

</body>

</html>

Link to comment
Share on other sites

  • 3 weeks later...

Hi,

The funcions _FFFormCheckBox, _FFFormOptionselect and _FFFormRadioButton don't work for elements out of forms.

Try for example using FFFormOptionselect function with the following page:

http://www.tizag.com/htmlT/htmlselect.php

Use for example:

_FFFormOptionselect("selectionField","name","CO","value")

It won't work. This happens because the select element is defined out of any forms and those functions construct an XPath starting always by //form[%s]

I have added a couple of lines of code to check the value of the parameter $vForm, so you can use -1 for calling the functions when you want to refer to any element not defined inside a form. This code is for _FFFormCheckBox:

If IsInt($vForm) And $vForm == -1 Then
_FFXPath(StringFormat("//input[@type='%s' and %s]", $sType, $sCheckBox), $sCommand, 9)
Else
_FFXPath(StringFormat("//form[%s]//input[@type='%s' and %s]", $sForm, $sType, $sCheckBox), $sCommand, 9)
EndIf

Something similar can be added to _FFFormOptionselect. _FFFormRadioButton is just a wrapper for _FFFormCheckBox, so there is no need for changing it.

You can then use this to change the value of the select box:

_FFFormOptionselect("selectionField","name","CO","value",-1)

Regards

Link to comment
Share on other sites

  • 1 month later...

Hello!

Can some one help to property get StatusBAr information ? I tryed

_FFCmd("window.status")
_FFCmd("content.window.status")
_FFCmd("window.content.status")

This doesnt work, help please!!!

Edited by babullika
Link to comment
Share on other sites

First thing to do when something doesn't work as expected is error checking.

What's the return value of function _FFCmd and the value of @error?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Well, i do like this

_FFConnect(Default, Default, 3000)
sleep(3000)
_FFCmd("window.status")
_FFCmd("content.window.status")
_FFCmd("window.content.status")

sleep time helps me to put mouse on some link to see Status Bar message, but script cant read my StatusBar. In @error always 0.

_FFConnect: Browser: Mozilla/5.0 (Windows NT 6.1; rv:19.0) Gecko/20100101 Firefox/19.0

__FFSendJavascripts: Sending functions to FireFox .......... done

__FFSend: try{window.status}catch(e){'_FFCmd_Err';};

__FFRecv:

__FFSend: try{content.window.status}catch(e){'_FFCmd_Err';};

__FFRecv:

__FFSend: try{window.content.status}catch(e){'_FFCmd_Err';};

__FFRecv:

>Exit code: 0 Time: 4.095

Edited by babullika
Link to comment
Share on other sites

Have you searched the forum? This suggests to use

$Socket = _FFStart("[url="http://www.google.it"]http://www.google.it"[/url])
$sStatusText = _FFGetValue($Socket ,"window.content.status")

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Well where are no more function _FFGetValue(), it was replaced by _FFCmd(). I used search =)

Well tryed your example and -

_FFGetValue ==> Invalid value: (elements|id|name|class|tag) $sMode: window.content.status

Maybe some1 who use this StatusBar information, tell me your FF version and code, maybe i use new version and it is unsupported..

Edited by babullika
Link to comment
Share on other sites

(Crossposting from )

I'm trying to script commands to a command line for a text-based MUD that runs in a firefox window. I can get text to appear in the text box, but I can't get it to submit. It's weird because I'm able to get text to submit when I insert _FFFormSubmit in the _FFObj documented example.

I'm getting this error:

_FFFormSubmit ==> No match: No Elements found in form: getElementById('input')

Here is my code:

#include <FF.au3>

If _FFConnect(Default, Default, 10000) Then
$sInput = _FFObjGet("input", "id")
_FFObj($sInput, "value", "hello")
_FFFormSubmit("input", "id")
Else
MsgBox(64, "", "Can't connect to FireFox!")
EndIf

Here is my source code (The code for the text box is a few lines up from the bottom):

<?xml version="1.0"?>
<window id="main-window"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="onMainLoad();" onunload="onunload();"
style="width:760px; height:480px;"
orient="vertical" persist="width height" windowtype="skotos:zealotry">
<script type="application/x-javascript" src="chrome://zealotry/content/browser-compat.js"/>
<script type="application/x-javascript" src="chrome://zealotry/content/my-world.js"/>
<script type="application/x-javascript" src="chrome://zealotry/content/init.js"/>

<script type="application/x-javascript" src="chrome://zealotry/content/jslib.js"/>
<script type="application/x-javascript" src="chrome://zealotry/content/filesystem.js"/>
<script type="application/x-javascript" src="chrome://zealotry/content/file.js"/>

<script type="application/x-javascript" src="chrome://zealotry/content/utils.js"/>
<script type="application/x-javascript" src="chrome://zealotry/content/md5.js"/>
<script type="application/x-javascript" src="chrome://zealotry/content/connection-xpcom.js"/>
<script type="application/x-javascript" src="chrome://zealotry/content/network.js"/>
<script type="application/x-javascript" src="chrome://zealotry/content/client.js"/>
<script type="application/x-javascript" src="chrome://zealotry/content/macro.js"/>

<script type="application/x-javascript" src="chrome://zealotry/content/zealotry.js"/>

<hbox style="-moz-box-flex: 1">
<iframe name="left-frame" id="left-frame" type="content"
     style="-moz-box-flex: 0; width: 145px; height: 100%; overflow: hidden"
     src="about:blank"/>

<keyset>
     <key id="dict-key" keycode="VK_F2" oncommand="helpMenuInit('dictionary');"/>
</keyset>
<vbox style="-moz-box-flex: 1">
     <toolbox>
<menubar id="sample-menubar">
     <menu id="file-menu" label="File" accesskey="F">
<menupopup id="file-popup" onpopupshowing="fileMenuInit();">
     <menuitem id="menuitem_logging" type="checkbox" accesskey="L"
label="Logging..." oncommand="onToggleLogging(event);"/>
     <menuitem id="menuitem_autolog" type="checkbox" accesskey="A"
label="AutoLog..." oncommand="onToggleAutoLog(event);"/>
     <menuseparator/>
     <menuitem label="Exit" oncommand="window.close();" keycode="VK_F4"/>
</menupopup>
     </menu>
     <menu id="edit-menu" label="Edit" accesskey="E">
<menupopup id="edit-popup" onpopupshowing="editMenuInit();">
     <menuitem id="menuitem_copy" label="Copy" oncommand="oncopy();" accesskey="C"/>
     <menuitem id="menuitem_paste" label="Paste" oncommand="onpaste();" accesskey="P"/>
     <!-- menuseparator/>
     <menuitem label="Load Macros" accesskey="O" oncommand="window.myMacros.processMacroCommand('LOAD');"/>
     <menuitem label="Save Macros" accesskey="A" oncommand="window.myMacros.processMacroCommand('STORE');"/>
     <menuseparator/>
     <menuitem label="Load Config" accesskey="L" oncommand="readConfigurationFile('menu');"/>
     <menuitem label="Save Config" accesskey="S" oncommand="writeConfigurationFile();"/ -->
</menupopup>
     </menu>
     <menu id="font-and-size" label="Options" accesskey="O">
<menupopup id="fonts-and-sizes-menu" onpopupshowing="optionMenuInit();">
     <menuitem label="Preferences" oncommand="doPrefs();"/>
</menupopup>
     </menu>
     <menu id="help" label="Help" accesskey="H">
<menupopup id="help-popup">
     <menuitem label="Help Contents" oncommand="helpMenuInit('content');" accesskey="H"/>
     <menuitem label="Changelog Notes" oncommand="helpMenuInit('changelog');" accesskey="C"/>
     <menuitem label="Whats New?" oncommand="helpMenuInit('new');" accesskey="N"/>
     <menuseparator/>
     <menuitem label="About Zealotry" oncommand="helpMenuInit('about');" accesskey="A"/>
</menupopup>
     </menu>
</menubar>
     </toolbox>
     <!-- iframe
name="scrollback"
id="scrollback"
type="content"
style="min-height: 70%; max-height: 70%"
src="about:blank"/>
     <splitter id="scroll_splitter" state="collapsed" collapse="before">
     <grippy/>
     </splitter -->
     <iframe name="center-frame" id="center-frame" type="content" flex="1" src="about:blank"/>
     <splitter state="open" collapse="before"/>
     <textbox spellcheck="true" autostretch="true" style="margin: 0; padding: 0" onkeypress="onInput();" rows="2" multiline="true" id="input"/>
</vbox>
<iframe name="right-frame" id="right-frame" type="content"
     style="-moz-box-flex: 0; width: 145px; height: 100%; overflow: hidden"
     src="about:blank"/>
</hbox>
</window>

Alternatively, if I can somehow use the _FFObj function to submit keys like {ENTER}, that would solve my problem, but I don't know how to do that either ... I see older versions of FF.au3 had a DispatchKeyEvent function that might help me, but it's no longer available. I opened FF and I noticed one hopeful thing:

_FFCmd('FFau3.simulateEvent=function simulateEvent(a,b,c){try{var d=document.createEvent(b);switch(b){case"MouseEvents":d.initMouseEvent(c,true,true,window,0,0,0,simulateEvent.arguments[4],simulateEvent.arguments[5],false,false,false,false,0,null);break;case"KeyboardEvent":d.initKeyEvent(c,true,true,null,false,false,false,false,simulateEvent.arguments[3],0);break;case"Event":d.initEvent(c,true,true);break}a.dispatchEvent(d);return 1}catch(e){return-3}return 0};')
It seems that _FFCmd can do key events. Anyone with more knowledge than me want to take a guess at how to setup the parameters to simulate an ENTER keystroke?
Link to comment
Share on other sites

Thank you very much, babullika!

Your second option worked for me. The first one didn't, and for science, I'll post the error message below. But I'm good now, thanks!

_FFConnect: OS: WIN_7 WIN32_NT 7601 Service Pack 1
_FFConnect: AutoIt: 3.3.8.1
_FFConnect: FF.au3: 0.6.0.1b-3
_FFConnect: IP: 127.0.0.1
_FFConnect: Port: 4242
_FFConnect: Delay: 2ms
_FFConnect: Socket: 612
_FFConnect: Browser: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0
__FFSendJavascripts: Sending functions to FireFox .......... done
__FFSend: try{window.content.top.document.getElementById('input')?1:0;}catch(e){'_FFCmd_Err';};
__FFRecv: 1
__FFSend: try{window.content.top.document.getElementById('input').hasAttribute('value')}catch(e){'_FFCmd_Err';};
__FFRecv: 0
__FFSend: try{window.content.top.document.getElementById('input').value='hello world'}catch(e){'_FFCmd_Err';};
__FFRecv: hello world
__FFSend: try{FFau3.simulateEvent(window.content.top.document.getElementById('input'),'KeyboardEvent','keypress',13);}catch(e){'_FFCmd_Err';};
__FFRecv: 1
Link to comment
Share on other sites

  • 4 weeks later...

Hi,

How can I implement this IE functions:

Local $oTable = _IETableGetCollection($oIE, 0)
Local $aTableData = _IETableWriteToArray($oTable, True)

$iIndex = _ArraySearch($aTableData, $strField, 0, 0, 0, 0, 1, 0)
$strValue = $aTableData[$iIndex][1]

with this FF include: FF V0.6.0.1b-8.au3

Thanks

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