Auto Blog Post

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
lukeconte
Newbie
Posts: 1
Joined: Fri Jul 22, 2005 2:00 am

Auto Blog Post

Post by lukeconte » Fri Jul 22, 2005 2:05 am

I need help to get this script to work - the script is based on
http://www.mjtnet.com/forum/viewtopic.php?t=1390


after posting the "blog" does not see my post


VBSTART
Dim IE()
Dim MaxIEObjects

Function CreateIE
MaxIEObjects = MaxIEObjects + 1
ReDim preserve IE (MaxIEObjects)
Set IE(MaxIEObjects) = CreateObject("InternetExplorer.Application")
IE(MaxIEObjects).Visible=1
CreateIE = MaxIEObjects
End Function

Sub Navigate(IEInst,frame,URL)
if frame="" then
IE(IEInst).Navigate URL
else
on error resume next
dim err
err = 0
err = IE(IEInst).Document.Frames.length
if err = 0 then
IE(IEInst).Navigate URL
exit sub
end if
on error goto 0
dim frameNr
dim frameFound
frameFound = 0
if IE(IEInst).Document.Frames.Length > 0 then
for frameNr = 0 to IE(IEInst).Document.Frames.Length - 1
if IE(IEInst).Document.Frames(frameNr).name = frame then
IE(IEInst).Document.Frames(frameNr).navigate URL
frameFound = 1
exit for
end if
next
end if
if frameFound = 0 then
IE(IEInst).Navigate URL
end if
end if
do while IE(IEInst).Busy
loop
End Sub

Sub KillIE(IEInst)
IE(IEInst).Quit
Set IE(IEInst) = nothing
End Sub

Sub DoForm(TheForm,fieldname,fieldvalue,submit)
Dim ItemNr
for ItemNr = 0 to TheForm.Elements.Length - 1
if TheForm.Elements(ItemNr).Name = fieldname then
TheForm.Elements(ItemNr).Value = fieldvalue
If submit=1 then
Dim SubItems
Dim FoundSubmitButton
FoundSubmitButton = 0
for SubItems = 0 to TheForm.Elements.Length - 1
if UCase(TheForm.Elements(SubItems).Name) = "SUBMIT" then
if UCase(TheForm.Elements(SubItems).TYPE) = "SUBMIT" then
TheForm.Elements(SubItems).Click
FoundSubmitButton = 1
Exit For
end if
end if
next
if FoundSubmitButton = 0 then
TheForm.submit
end if
end if
exit for
end if
next
End Sub

Sub FormFill(IEInst,frame,fieldname,fieldvalue,submit)
Dim FormNr
Dim TheForm
if frame="" then
if IE(IEInst).Document.All.Tags("FORM").Length > 0 then
for FormNr = 0 to IE(IEInst).Document.Forms.Length - 1
Set TheForm = IE(IEInst).Document.Forms(FormNr)
DoForm TheForm,fieldname,fieldvalue,submit
Set TheForm = nothing
next
end if
else
dim frameNr
dim frameFound
frameFound = 0
if IE(IEInst).Document.Frames.Length > 0 then
for frameNr = 0 to IE(IEInst).Document.Frames.Length - 1
if IE(IEInst).Document.Frames(frameNr).name = frame then
if IE(IEInst).Document.frames(frame).Document.All.Tags("FORM").Length > 0 then
for FormNr = 0 to IE(IEInst).Document.frames(frame).Document.Forms.Length - 1
Set TheForm = IE(IEInst).Document.frames(frame).Document.Forms(FormNr)
DoForm TheForm,fieldname,fieldvalue,submit
Set TheForm = nothing
next
end if
frameFound = 1
exit for
end if
next
end if
if frameFound = 0 then
if IE(IEInst).Document.All.Tags("FORM").Length > 0 then
for FormNr = 0 to IE(IEInst).Document.Forms.Length - 1
Set TheForm = IE(IEInst).Document.Forms(FormNr)
DoForm TheForm,fieldname,fieldvalue,submit
Set TheForm = nothing
next
end if
end if
end if
do while IE(IEInst).Busy
loop
End Sub

Function ExtractTag(IEInst,TagName,Num,all)
dim t
set t = IE(IEInst).document.getElementsbyTagname(Tagname)
if all=1 then
ExtractTag = t.Item(Num).outerHTML
else
ExtractTag = t.Item(Num).innerText
end if
End Function

VBEND

Let>delay=7
VBEval>CreateIE,IE[0]
VBRun>Navigate,%IE[0]%,,http://blogs.pcseattle.org/mt-comments.cgi?entry_id=110
Wait>delay
VBRun>FormFill,%IE[0]%,,author,My Name,0
VBRun>FormFill,%IE[0]%,,email,myemail.test.com,0
VBRun>FormFill,%IE[0]%,,url,www.test.com,0
VBRun>FormFill,%IE[0]%,,text,The info I want to post on the blog,0

Wait>delay

VBRun>FormFill,%IE[0]%,,preview, PREVIEW ,1
'VBRun>FormFill,%IE[0]%,,post, POST ,1

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts