Jump to content

Problem with a macro I did, stops at opening a IE window.


 Share

Recommended Posts

#include<IE.au3>
#include <File.au3>
#RequireAdmin
$Links="Links.txt"
$Subject="subject.txt"
$Description="description.txt"
_IELoadWaitTimeout(25000)
_IEErrorHandlerRegister()
$oIE=_IECreate("about:blank",1,1,1,-1)
For $r=1 to _FileCountLines($Subject)
For $i=1 to _FileCountLines($Links)
;$oIE=_IECreate(FileReadLine($Links,$i),0,1,1,-1)
    _IENavigate($oIE, FileReadLine($Links,$i))
    $oBBCode=_IEGetObjById($oIE,"bbcodemode")
    _IEAction($oBBCode,"click")
    $Title=_IEGetObjById($oIE,"subject")
    _IEFormElementSetValue($Title,FileReadLine($Subject,$r))
    $PostEdit=_IEGetObjById($oIE,"posteditor_textarea")
    _IEFormElementSetValue($PostEdit,FileReadLine($Description,$r))
    $oSubmit=_IEGetObjById($oIE,"postsubmit")
    _IEAction($oSubmit,"click")
    _IELoadWait($oIE,5000)
    _IEQuit($oIE)
Next
Next

Hi guys,

Having a problem with this code.

I have a description file and a subject file with 3 lines in each.

However, when I run this macro, it opens up a window and the macro ends there without doing anyhting.

Does anyone know why? I am on Vista but I have disabled UAC

My other macro is running fine when it has almost the same code: see below

#include<IE.au3>
#include <File.au3>
#RequireAdmin
$Links="Links.txt"
$loginid="loginid.txt"
_IELoadWaitTimeout(25000)
_IEErrorHandlerRegister()
$oIE=_IECreate("about:blank",1,1,1,-1)
For $i=1 to _FileCountLines($Links)
   ;$oIE=_IECreate(FileReadLine($Links,$i),0,1,1,-1)
    _IENavigate($oIE, FileReadLine($Links,$i))
    $username=_IEGetObjById($oIE,"username")
    _IEFormElementSetValue($username,FileReadLine($loginid,$i))
    $password=_IEGetObjById($oIE,"password")
    _IEFormElementSetValue($password,"123456")
    $oSubmit=_IEGetObjById($oIE,"loginsubmit")
        _IEAction($oSubmit,"click")
    _IELoadWait($oIE,5000)
   ;_IEQuit($oIE)
Next
Run('AutoIt3.exe discuzforumcurrent.au3')
Link to comment
Share on other sites

Suggest you turn on SciTe debug mode #AutoIt3Wrapper_run_debug_mode=Y and share the output.

Dale

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

!> Starting in DebugMode..
Line: @error-@extended: Line syntax
0001: 0-0: #include<IE.au3>
0002: 0-0: #include <File.au3>
0003: 0-0: #RequireAdmin
0004: 0-0: #AutoIt3Wrapper_run_debug_mode=Y
0005: 0-0: $Links="Links.txt"
0006: 0-0: $Subject="subject.txt"
0007: 0-0: $Description="description.txt"
0008: 0-0: _IELoadWaitTimeout(25000)
0009: 0-0: _IEErrorHandlerRegister()
0010: 0-0: $oIE=_IECreate("about:blank",1,1,1,-1)
--> IE.au3 V2.3-1 Warning from function _IEAttach, $_IEStatus_NoMatch
0011: 0-0: For $r=1 to _FileCountLines($Subject)
+>10:57:26 AutoIT3.exe ended.rc:0
+>10:57:27 AutoIt3Wrapper Finished
>Exit code: 0   Time: 2.801

IS this the correct way to do the debug mode?

These are the results I got.

Link to comment
Share on other sites

Yes, you did the debug correctly. Your next step should be to strip your code down to just the lines that cause you trouble - which looks like

#include <File.au3>
$Subject="subject.txt"
_FileCountLines($Subject)oÝ÷ Øâ¶+-ábæ®Ý@Ŷ­ÈZ¾)ය.nW²¢ç(ºWljeü­¢Øb±«­¢+Ù]¡¥±Ä(ÀÌØí±¥¹ô¥±I1¥¹ ÀÌØíÍթФ(%ÉɽÈô´ÄQ¡¸á¥Ñ1½½À(ì¼ÍÑÕ)]¹

Dale

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

#include<IE.au3>
#include <File.au3>
#RequireAdmin
$Links="Links.txt"
$Subject="subject.txt"
$Description="description.txt"
_IELoadWaitTimeout(25000)
_IEErrorHandlerRegister()
$oIE=_IECreate("about:blank",1,1,1,-1)
While 1
    $line = FileReadLine($subject)
    If @error = -1 Then ExitLoop
For $i=1 to _FileCountLines($Links)
;$oIE=_IECreate(FileReadLine($Links,$i),0,1,1,-1)
    _IENavigate($oIE, FileReadLine($Links,$i))
    $oBBCode=_IEGetObjById($oIE,"bbcodemode")
    _IEAction($oBBCode,"click")
    $Title=_IEGetObjById($oIE,"subject")
    _IEFormElementSetValue($Title,FileReadLine($Subject,$r))
    $PostEdit=_IEGetObjById($oIE,"posteditor_textarea")
    _IEFormElementSetValue($PostEdit,FileReadLine($Description,$r))
    $oSubmit=_IEGetObjById($oIE,"postsubmit")
    _IEAction($oSubmit,"click")
    _IELoadWait($oIE,5000)
    _IEQuit($oIE)
Next
Wend

So would the code be this way?

Thank you

Link to comment
Share on other sites

wats this macro actually suppose to do ?

cheers C.W

C.Wnew rules:1.dont use plz in a post or title use please instead2.always use help file as it is now muchly over rated3. dont think where not watching u4.please wait 24 hours after last post ot bump XD i use to make that mistake

Link to comment
Share on other sites

  • 2 weeks later...

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