Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incrementing 1

Status
Not open for further replies.

NetNodeMan

Technical User
Mar 30, 2005
65
IE
I'm trying to get my code to increment but the only thing incrementing seems to be the number of times I'm banging my head off the table here:


Sub objIE_NavigateError(pDisp,URL,TargetFrameName,StatusCode,Cancel)

internetError = internetError + 1
wshell.popup "Failure when loading"
createobject("wscript.shell").run "WebTest.bat"

End Sub


if internetError <>0 and internetError Mod 3 = 0 then

wshell.popup "Failure when loading more than 3 times"
createobject("wscript.shell").run "WebTracker.bat"

end if

I have my code laid out so it writes internetError to a log. internetError is set as a dim and equalled to 0 elsewhere in my code BUT:

internetError always = 0 when printed to the log. Can anyone tell me where I'm going wrong? Code is welcomed :)
 
double-click, usually (os setting dependent). Aren't you usually run a vbs by double-click?
 
I run a vbs by putting "test.vbs" inside a batch file.
 
I can only suggest you modify the script like this. It is really a shot in the dark.
[tt]
[blue]'... keep your original
'then it is here in your script[/blue]]
[green]'**************CREATE LOGFILE AND AMEND/APPEND

dim wshshell, fso , slog , logfile
dim ieErr [/green]

'insert this
if wscript.arguments.count=0 then
ieErr=0
else
ieErr=cint(wscript.arguments.item(0))
end if

[green]'continue with your script[/green]
[/tt]
Now, in your functions, replace every line of this
>[tt]createobject("wscript.shell").run "test.bat"[/tt]
by this
[tt]createobject("wscript.shell").run wscript.scriptfullname & " " & ieErr,1,false[/tt]

 
That looks good tjusi - lets say my vbs file is called test.vbs, what is the correct syntax then of:

createobject("wscript.shell").run wscript.scriptfullname & " " & ieErr,1,false
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top