Repeat and condition !!

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Okapi
Junior Coder
Posts: 28
Joined: Wed Dec 29, 2010 1:22 am

Repeat and condition !!

Post by Okapi » Sat Mar 26, 2011 7:05 pm

Hi all,
I want to rename then upload a file, if upload is successful, the file is deleted locally, otherwise, wait for 15 sec and attempt to upload again, till its successful :

Code: Select all

RenameFile>parameters
FTPPutFile>parameters
If>FTP_RESULT=command successful
DeleteFile>parameters
Else
Wait>15
What commands should be added ? a Label or Repeat and how ! thanks.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Mon Mar 28, 2011 3:39 pm

You could just use a Goto and a Label:

Code: Select all

RenameFile>parameters
Label>DoUpload
FTPPutFile>parameters
If>FTP_RESULT=command successful
  DeleteFile>parameters
Else
  Wait>15
  Goto>DoUpload
Endif
But I think you may need to change the If check as FTP_RESULT may contain more than just "command successful" - look in the watch list to see what it contains on success and use accordingly, or use a substring search (e.g. using the Position command).
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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