Hints, tips and tricks for newbies
Moderators: Dorian (MJT support), JRL
-
Okapi
- Junior Coder
- Posts: 28
- Joined: Wed Dec 29, 2010 1:22 am
Post
by Okapi » Wed Jun 01, 2011 6:44 pm
Hi all,
I made that code : http request to download a file and put it in directory in different name. Then if download is successful, run this file :
Code: Select all
HTTPRequest>http://www.site.com/file.doc,%TEMP_DIR%\document.doc,GET,,Result_Variable,,,,
If>Result_Variable=
Run>%TEMP_DIR%\document.doc
EndIf
Problem is when download is successful, Result_Variable is blank (not initialized at all), so it can't be manipulated. How to make the if condition then ? I don't want to use IfFileExists because this file may exists from a previous download, not this download.
Thanks for help.
-
JRL
- Automation Wizard
- Posts: 3526
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Wed Jun 01, 2011 9:54 pm
Looking at help for HTTPRequest>. The sample "Get" does not show the last four commas. What happens if you remove the last four commas?
-
JRL
- Automation Wizard
- Posts: 3526
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Wed Jun 01, 2011 10:01 pm
Actually on further reading help...
Help wrote:If LocalFileName was specified and the data was successfully written to the file Result_Variable will be blank. Otherwise it will contain an error message.
It sounds like the result variable will be empty unless there is an error. If the result variable is not being set at all, try setting it to "blank" before the HTTPRequest.
Let>Result_Variable=
HTTPRequest>blah,blah...
If>Result_Variable=
//download must have been successful
If it is still blank after the function is called, in theory there is a new file.
-
Okapi
- Junior Coder
- Posts: 28
- Joined: Wed Dec 29, 2010 1:22 am
Post
by Okapi » Thu Jun 02, 2011 7:05 am
Thanks for trick that works.
PS: Last four commas are for proxy info, when no proxy info is specified, they could be removed.
-
adroege
- Automation Wizard
- Posts: 438
- Joined: Tue Dec 07, 2004 7:39 pm
Post
by adroege » Wed Aug 17, 2011 11:17 am
Thanks. That should work but I'll have to wait for the system guys to actually install something whether its perl net or expect and TCL. I'm not allowed to do it myself. Can anyone think of a more direct way?
Thanks for the advice
I don't understand what is your problem?
-
JRL
- Automation Wizard
- Posts: 3526
- Joined: Mon Jan 10, 2005 6:22 pm
- Location: Iowa
Post
by JRL » Wed Aug 17, 2011 12:28 pm
The problem is it was spam. And now its gone.