Jump to content

CharlesStamp

Members
  • Posts

    17
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

CharlesStamp's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Oh I see. That'll be where I was going wrong then. Thanks a lot for the example. It should come in handy in helping me make sense of that function.
  2. $_FF_AU3VERSION = "0.6.0.1b-15"
  3. Thanks. I thought that might've been an issue so I've modified the example to use a different site. The last one couldn't properly replicate the problem I've been facing as all the text box elements had unique names (hence using "type" as they're all distinct), but on this one they don't. Note I'm now using "id" instead of "type". I've added the error checking, but get no errors #Include <FF.au3> #include <MsgBoxConstants.au3> If _FFStart("http://www.gamefaqs.com/search/index.html?platform=120&game=&contrib=0&rating=0&genre=0&region=0&date=0&developer=&publisher=&dist=0&sort=0&link=0&res=0&title=0", "default", 0) Then ; Enter keywords into search bar $sInput = _FFObjGet("searchtextbox", "id", 1) ; returns a string - no object! If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "ObjGet Error") Sleep (3) _FFObj($sInput, "value", "anything") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Input Error") EndIfThere are two search boxes with id "searchtextbox" and regardless of which position I specify (in this case, 1, but I've also tried 0, 2 and 5) it always fills in the same box at the top. And I haven't modified FF.au3 at all, so I'm stumped.
  4. Based on the documentation and tutorials I've read, I expected the following script to go to the page and enter "anything" into the second text box from the top ("Nachname", where the first is "Vorname"). But it doesn't and I'm not sure why. #Include <FF.au3> If _FFStart("http://ff-au3-example.thorsten-willert.de/", "default", 0) Then ; Enter keywords into search bar $sInput = _FFObjGet("text", "type", 1) Sleep (3) _FFObj($sInput, "value", "anything") EndIfI realize that in this example I could use _FFObject("lname", "name") but I've had problems before getting the correct element using _FFClick as well, where there are several on the page with the same tag. I guess I'm making a really basic error, but I'd appreciate some advice on where I'm going wrong.
  5. ​The script I posted was a stripped-down version of the one I'm using. So although in this case it's only getting one string from the page and transferring it into Excel (making $aArray1D an unnecessary extra step), I actually need it to get several strings. The one I'm using looks like Global $aArray2D[1][9] = [[$sCopied1[0], $sCopied2[0], $sCopied3[0], $sCopied4[0], $sCopied5[0], sCopied6[0], $sCopied7[0], $sCopied8[0], $sCopied9[0]]]   _Excel_RangeWrite($oWorkbookEnd, $oWorkbookEnd.Activesheet, $aArray2D, "A" & $listPosition) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)The other variables $sCopied1 to $sCopied8 are under 200 characters and work fine. But if $sCopied9 is over 263 characters, it only copies blank cells to Excel for every variable that time round. I'm now using Word to get the string that was causing a problem. But I'll try the above script again (without $aArray1D and with $bForceFunc True) and let you know what happens. EDIT: Looks like my syntax was off for the array, but I think I've got the hang of it now. Thanks again.
  6. I've just tried changing those lines to set $bForceFunc to True but unfortunately it still doesn't work. It returns the message "1D array successfully written" as it did before, but the cell's still empty.
  7. Thanks. Is there any alternative, such as copying that variable from the clipboard or using OpenOffice Calc instead? When I try to view that thread it says: Sorry, there is a problem You do not have permission to view this content. Error code: 2F173/H
  8. Hi. I've been putting a script together but have encountered a problem and haven't been able to find a solution. The script should copy some text in a webpage and output it to Excel. As long as the text it copies is no more than around 260 characters, it's fine. But anything longer than that and it just leaves Excel blank. This one works: #include <Array.au3> #include <Excel.au3> #include <MsgBoxConstants.au3> #include <String.au3> #include <FF.au3> #include <FFex.au3> ; Start Firefox If _FFStart("http://ff-au3-example.thorsten-willert.de/") Then Global $oAppl = _Excel_Open() ; Connect to Excel Global $oWorkbookEnd = _Excel_BookOpen($oAppl, @ScriptDir & "\endDB.xlsx") ; Get page source $sHTML = _FFReadHTML() If Not @error Then ClipPut($sHTML) EndIf Sleep(2000) Sleep(2000) If _FFIsConnected() Then $sCheckWord = "Sample Page" Sleep(2000) If _FFSearch($sCheckWord) Then Sleep(2000) Global $sCopied = _StringBetween($sHTML, "<H1>FF.au3 ", "static") Else Sleep(2000) Global $sCopied = _StringBetween($sHTML, "<type=""", "/css") EndIf EndIf Sleep(2000) ; Write a 1D array to the active sheet in the active workbook Global $aArray1D = [$sCopied] _Excel_RangeWrite($oWorkbookEnd, $oWorkbookEnd.Activesheet, $aArray1D, "A1") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "1D array successfully written.") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example", "Error opening workbook '" & @ScriptDir & "\endDB.xlsx'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oAppl) Exit EndIf But the next one doesn't. The only difference between them is that the second one is capturing a string of about 300 characters, and the first one captures a string of around 80. #include <Array.au3> #include <Excel.au3> #include <MsgBoxConstants.au3> #include <String.au3> #include <FF.au3> #include <FFex.au3> ; Start Firefox If _FFStart("http://ff-au3-example.thorsten-willert.de/") Then Global $oAppl = _Excel_Open() ; Connect to Excel Global $oWorkbookEnd = _Excel_BookOpen($oAppl, @ScriptDir & "\endDB.xlsx") ; Get page source $sHTML = _FFReadHTML() If Not @error Then ClipPut($sHTML) EndIf Sleep(2000) Sleep(2000) If _FFIsConnected() Then $sCheckWord = "Sample Page" Sleep(2000) If _FFSearch($sCheckWord) Then Sleep(2000) Global $sCopied = _StringBetween($sHTML, "<H1>FF.au3 ", "Dokumentation") Else Sleep(2000) Global $sCopied = _StringBetween($sHTML, "<type=""", "/css") EndIf EndIf Sleep(2000) ; Write a 1D array to the active sheet in the active workbook Global $aArray1D = [$sCopied] _Excel_RangeWrite($oWorkbookEnd, $oWorkbookEnd.Activesheet, $aArray1D, "A1") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "1D array successfully written.") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example", "Error opening workbook '" & @ScriptDir & "\endDB.xlsx'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oAppl) Exit EndIf I'm not sure if it's an issue with Autoit or Excel. Can anyone suggest a way around it?
  9. I haven't heard about maps before now, but I tried making the change you suggested and the problem now is that it copies $sWordOne to both cels. Again, I get a similar problem when I just display the array, so the issue doesn't seem to be related to Excel or its UDF. It seems to be a problem with how _StringBetween variables are managed.
  10. They do, but that doesn't seem to be the issue. If I use a string, integer or combination of them for the variables it passes them to Excel. It also seems to work fine with just one variable, too. But if there's more than one they just go blank. As far as I can tell it should work, but I don't have much experience with this. I had a similar problem displaying them in arrays, too.
  11. Hi. I've managed to piece this script together from tutorials and examples I've found, but I've hit a dead-end and could use a little help. I'm trying to create a script that will transfer text from a specific page onto an Excel worksheet. According to what I've read, it should enter 'pizza' into cel A3 of an Excel worksheet, and 'developer' into cel A4. #include <Array.au3> #include <Excel.au3> #Include <FF.au3> #include <String.au3> ; Go to page and copy the source to clipboard. If _FFStart("http://ff-au3-example.thorsten-willert.de/") Then $sHTML = _FFReadHTML() If Not @error Then ClipPut($sHTML) EndIf Example() Func Example() ; Declare variables and set to the words surrounding "pizza" and "developer". Local $sWordOne = _StringBetween($sHTML, "hlen Sie eine ", ":</legend>") Local $sWordTwo = _StringBetween($sHTML, "Mozilla ", " center") ; Create application object and create a new workbook Local $oAppl = _Excel_Open() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $oWorkbook = _Excel_BookNew($oAppl) If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the new workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oAppl) Exit EndIf ; ***************************************************************************** ; Write a 1D array to the active sheet in the active workbook ; ***************************************************************************** Global $aArray1D = [$sWordOne, $sWordTwo] _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $aArray1D, "A3") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "1D array successfully written.") EndFunc ;==>ExampleBut for some reason, the values of variables $sWordOne and $sWordTwo seem to get deleted before it reaches the Excel page, so the cels just wind up blank. I've double (and triple) checked that the _StringBetween variables are correct when used on their own. I've also found that if I change the variables to integers, it copies them to Excel as it should. I've spent a few hours looking at this and getting nowhere. Am I doing something obviously wrong?
  12. 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.
  13. 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.
  14. 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.
×
×
  • Create New...