if web page doesn’t exist

Discuss RoboTask here
Post Reply
Automater
Posts: 3
Joined: Sat Aug 28, 2010 4:24 am

if web page doesn’t exist

Post by Automater »

Hi,I have a text file with several web urls (one per line).I have Robotask reading through the list and downloading the pages successfully.However, I need help including an if statement. If the web page is not found do this.How do I use the "if" command with the "download file" command? I want it to add a line of text to a file if the web page is missing.Thanks!
EliasLor
Posts: 4
Joined: Fri Aug 27, 2010 1:14 am

if web page doesn’t exist

Post by EliasLor »

I think what you need to do is put code in to tell you
when the title of the web page states that it does not
exist. So if the text for the web page signifies that it
could not be found you would create a local boolean
variable that goes from False to True, the variable could
be ....WEBPAGEDOESNOTEXIST = FALSE. And if it does not
exist it would change this variable to TRUE. If that
variable is true then you can have it write a statement
to a file putting the name of the web page you tried to
download. So that all the statements in the file would be
of web pages that do not exist. In order to do this you
have to find out how to get the text from the web page
which signifies that it does not exist, each web page has
a title for IE in this case it would be "Internet
Explorer cannot display the webpage" or something like
that. If you can access that information then you can set
it up like the way I described above. I'm not sure of all
the details, just thought I would give you an idea of how
to go about it. Let me know if this helps.
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

if web page doesn’t exist

Post by Oleg »

See the example below.
You have to set "If error occurred" to "Continue execution" and use {IsError} variable.
Also you can use "Text loop" for processing of your URL list.

See more information here

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1005538731
ContinueOnError=INTEGER|1
ExternalName=STRING|"Task175"
Hide=INTEGER|0
ID=INTEGER|137776471
LogOnAsUser=INTEGER|1
Name=STRING|"Download files and save in ""{TEMPDIR}""..."
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER

[Actions\Action1]
ActionID=STRING|"A_INET_DOWNLOAD"
Enabled=INTEGER|-1
Name=STRING|"Download files and save in ""{TEMPDIR}"""
Params=FOLDER

[Actions\Action1\Params]
action=STRING|"0"
file0=STRING|"http://www.no_server.com/abc/"
filecount=STRING|"1"
proxykind=STRING|"0"
saveas=STRING|"0"
saveasname=STRING|"*.*"
savedir=STRING|"{TEMPDIR}"
useproxy=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action2\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{IsError}"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Can't download page"""
Params=FOLDER

[Actions\Action3\Params]
icon=STRING|"1"
msg0=STRING|"Can't download page"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action4]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
Last edited by Oleg on Sun Aug 29, 2010 5:04 am, edited 1 time in total.
Post Reply