Jump to content

Only works with Sleep(4000)..


Recommended Posts

Hi,

this is a part of my code:

$oIE = _IECreate(0)
        _IENavigate($oIE, 'http://localhost/~ OSS ~/search.php')
        $oIE.document.forms(0).elements(0).value = $y
        $oIE.document.forms(0).submit()
        Sleep(150)
        $source = _IEBodyReadHTML($oIE)
        _IEQuit($oIE)
        $busy2 = 'Bezig met verwerken van xD!'
        GUICtrlSetData($Status, $busy2)
        $filec = _FileCreate(@ScriptDir & "\" & $y & ".ws.txt")
        $file = FileOpen(@ScriptDir & "\" & $y & ".ws.txt", 1)    
        FileWrite($file, $source)
        MsgBox(0,"Gelukt!","Het ophalen is gelukt!")            
        Sleep(4000)
        $FilePath = @ScriptDir & "\" & $y & ".ws.txt"
        $Links = _SRE_Between($FilePath, '<TD><A href="java script:d\(', '\)">')
        $Names = _SRE_Between($FilePath, '\)">', '</A></TD>')               
        
        If IsArray($Links) And IsArray($Names) Then
            For $i = 0 To UBound($Links) - 1
        GUICtrlCreateListViewItem($Names[$i] & '|' & $Links[$i],$listview)
            Next
        EndIf

It puts the data in the $listview etc.

But if I remove the Sleep(4000), it doesn't put the data into the $listview, it needs Sleep with a minimum of 4000 ms. That are 4 seconds, isn't there a solution to make it go quicker?

cheers,

Andreas

Edited by Noobster24
Programs so far:Teh Serializer - Search for licenses for Nero - Windows - Office - Alcohol etc.
Link to comment
Share on other sites

  • Moderators

I'm not sure why you need the sleep, but I would change this:

$oIE = _IECreate(0)
        _IENavigate($oIE, 'http://localhost/~ OSS ~/search.php)
        $oIE.document.forms(0).elements(0).value = $y
        $oIE.document.forms(0).submit()
        Sleep(150)oÝ÷ Ù:-+ºÚ"µÍÌÍÛÒQHHÒQPÜX]H
    ][ÝÚËÛØØ[ÜÝßÔÔÈÜÙXÚ  ][ÝË
BÌÍÛÑÜHHÒQQÜQÙ]ÛÛXÝ[Û   ÌÍÛÒQK
BÌÍÛÑ[[Y[HÒQQÜQ[[Y[Ù]ÛÛXÝ[Û  ÌÍÛÒQK
BÒQQÜQ[[Y[Ù][YJ  ÌÍÛÒQK  ÌÍÞJ

You will need the latest version of IE.au3.

Link to comment
Share on other sites

I'm not sure why you need the sleep, but I would change this:

$oIE = _IECreate(0)
        _IENavigate($oIE, 'http://localhost/~ OSS ~/search.php)
        $oIE.document.forms(0).elements(0).value = $y
        $oIE.document.forms(0).submit()
        Sleep(150)oÝ÷ Ù:-+ºÚ"µÍÌÍÛÒQHHÒQPÜX]H
    ][ÝÚËÛØØ[ÜÝßÔÔÈÜÙXÚ  ][ÝË
BÌÍÛÑÜHHÒQQÜQÙ]ÛÛXÝ[Û   ÌÍÛÒQK
BÌÍÛÑ[[Y[HÒQQÜQ[[Y[Ù]ÛÛXÝ[Û  ÌÍÛÒQK
BÒQQÜQ[[Y[Ù][YJ  ÌÍÛÒQK  ÌÍÞJ

You will need the latest version of IE.au3.

Yes, i know about 2.0, but 1.0 works fine for me, it has got to do with the txt file, because when i look in the dir where the txt-file is placed, the txt-file is 0 kb, but it has data in it when i open it. When i refresh the dir, it has 5 kb..

It has got to do with that... not with the IE...

Programs so far:Teh Serializer - Search for licenses for Nero - Windows - Office - Alcohol etc.
Link to comment
Share on other sites

Yes, i know about 2.0, but 1.0 works fine for me, it has got to do with the txt file, because when i look in the dir where the txt-file is placed, the txt-file is 0 kb, but it has data in it when i open it. When i refresh the dir, it has 5 kb..

It has got to do with that... not with the IE...

Close the file with FileClose($filec) to force the write buffer to flush.

Dale

Edit: typo

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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