Creating a data input loop which only fires after a certain other job finishes

yobjob

  • Joined: Jul 21, 2011
  • Posts: 37

Wed 8/31/2011 - 19:08

I am currently autmating setting up wordpress blgos on a host.

 

So far I've got to automating it all except having to change the url in a text file which winauto reads- so I'd been doing it by hand so far.

 

What I want to be able to do is have a list of several hundred urls plus their corresponding blog names and have winauto loop through them but only going to number 2, 3, etc once the last job is done.

 

So read text file for info on blog one ->input data and setup blog one. end.

 

Read text for blog two -> inut data etc.

 

I watched the 1st loop vid just then but didn't see how I would get it to trigger after each previous job completed.

#1

yobjob

  • Joined: Jul 21, 2011
  • Posts: 37

Wed 8/31/2011 - 21:22

Hmm been messing around for about an hour now and haven't been able to figure it out :(

 

What I thought would work: %Filecontents[%LoopIndex%]% threw up an error so I dunno what to try now.

 

Hmm I just watched the other loop video and I'm guessing the for each one is gonna solve it. I just had a lil play around, I'll come back to it tommorow. :)

#2

yobjob

  • Joined: Jul 21, 2011
  • Posts: 37

Thu 9/1/2011 - 10:06

Hmm, I'm getting rather confused with where each loop should go so could I get some pointers on this...

 

What is complicating matters is that I did each part in seperate jobs. Now I don't know whether I should put a loop around all the jobs or if I should put a loop within each job/both? I am thinking a loop within each is no good because it would be firing when I didn't want it to.

 

I'm having trouble with the for each loops. I have to have 2 loops- one for one data input one for another but for some reason the job only works for one.

 

It will count up through the data for one of the loops but when both are going it stays at the first entry for the other loop. The one with trouble works fine again when I disable the other loop...

 

I was trying to think of a workaround creating outside jobs just for that one but I run into the same issue of if they are seperate it means the loops withn the nested jobs would be firing out of sync with the other loop.

#3

Samantha

  • Joined: Apr 23, 2010
  • Posts: 2328

Thu 9/1/2011 - 10:06

Hi yobjob! To start with, this: %Filecontents[%LoopIndex%]% should actually be like this: %Filecontents[LoopIndex]%. Secondly, I'm not quite sure I've understood your job flow. Would you mind uploading the job you have created here so that I understand what you're trying to do? :) Samantha

#4

yobjob

  • Joined: Jul 21, 2011
  • Posts: 37

Thu 9/1/2011 - 10:45

Good idea :D

 

Hmm, so for loops index I could just use one loop for all my files just using the index? That would really make life alot easier. I'll have a play with that now as that seemed the most logical way to do it before I found it didn't work through my erroneous coding.

 

Hmm, I just remembered that the loop indexed is related to the normal loop so I'd still be interested in your suggestions for the for each loop.

all merged one job.waj

#5

Samantha

  • Joined: Apr 23, 2010
  • Posts: 2328

Thu 9/1/2011 - 13:23

Hi there! I checked out the job you have, and I cannot quite understand what the problem is. WHat you should always bear in mind when creating an automation that includes user interaction actions (mouse clicks, keystrokes, etc) and a loop to repeat the same procedure for each iteration is the fact that you should always start from the same point. Which means that each time the loops iterrates, the environment should be the same or slightly altered depending on the job's requirements. Eg. If at the beginning of your job's first iterration, you need to write to a text field in a web form or so, you need to make sure that the form is open on the screen, or make sure you open it if the previous iteration had closed the window. Hope this makes sense :) Samantha

#6

yobjob

  • Joined: Jul 21, 2011
  • Posts: 37

Thu 9/1/2011 - 14:45

hi,

 

yes what you say didn't get to my issue.

 

The problem is that when I run the job the 1st loop isn't working.

 

I'll try and explain:

 

one file loop is for the urls:

 

url1

url 2

url3

etc.

 

Another file is for blog names:

 

blog 1

2

3

etc.

 

Now when I only have the for each loop for urls it works fine and counts them up accordingly but when I put the second loop for blog names it only counts up on the blog names and every url stays at line 0.

#7

Samantha

  • Joined: Apr 23, 2010
  • Posts: 2328

Tue 9/6/2011 - 18:47

you would need to use a common index for the lists. So if we say that both lists have the same count, then we can do the following: Read from file A save list items in %ListA% Read from file B save list items in %ListB% Set variable %Index% = 0 Loop from 0 to %ListA.Count-1% %ListA[Index]% - %ListB[Index]% Increase %Index% by 1 End Loop So you need to have a common index, and make sure you have as many items in lista as many items you have in list b. And also, don't forget to increase the %Index% variable during each loop. Does this make sense? I hope I've not confused you more! :) Samantha

#8

yobjob

  • Joined: Jul 21, 2011
  • Posts: 37

Tue 9/6/2011 - 19:27

That's what I ended up doing wiht the loop and it worked out ok.

 

cheers. :)

#9
Not a member yet? Register

Copyright 2013 - Softomotive Ltd