How can I serialize with sendkeys?

ggsradas

  • Joined: Jul 11, 2012
  • Posts: 2

Wed 7/11/2012 - 17:09

Hi, 

Please help me. This is my job:

 

1. LOOP

...

10. Wait For Window

11. Send Keys (I wanna put on a text box: 1.jpg... in the next loop I wanna put: 2.jpg... in the next loop I wanna put: 3.jpg, 4.jpg, ...  to 100.jpg)

...

16. END LOOP

 

Is ok use "Send Keys" ?? or what else it's so much better?

I hope me explain, sorry for my english I'm a spanish.

 

Thank you !!!!!!

serialize.JPG

#1

dennis

  • Joined: Dec 20, 2011
  • Posts: 64

Thu 7/12/2012 - 10:01

You need to use a variable as a counter, lets call it %Counter%, which will increase by 1 in each iteration. In the "Send Keys" action you would put as "Text to send" the name of the counter variable followed by the file extension, i.e. %Counter%.jpg

Now, depending on how the total number of files is determined, there are different ways to define and use the counter variable, as explained below.

1) If the total number of files is known beforehand, then you would use a "Loop" action starting at 1, ending at the count of files (e.g. 100), incremented by 1. The counter variable in this case would be the index variable of the "Loop" action, which by default is named %LoopIndex%.

2) If you would like the user to define the total number of files during runtime, then you would first use a "Display Input Dialog" action to store the user input in a variable, which by default is named %UserInput%. Then you would use a "Loop" action (similar to case 1) only this time you would enter %UserInput% as the end value of the loop. Again, %LoopIndex% would be the counter variable.

3) If you would like to process every file in a folder, then you would first use a "Get Files in Folder" action that would store the retrieved files in a list variable, named by default %Files%. Then you would use a "For Each" action to iterate though the contents of the %Files% list variable, storing the current item in a variable named by default %CurrentItem%. Finally, in the "Send Keys" action the text to send would be %CurrentItem.Name% (that is the filename with its extension - you can see all the available properties of a variable by clicking on the + sign preceding the variable name in the list of available variables presented after clicking on the "gear" icon). As you can see, in this case there is no need for a counter variable.

If you would give us some more details about the task you are trying to automate then we would be able to provide additional guidance and post a sample job.

 

Dennis

#2

ggsradas

  • Joined: Jul 11, 2012
  • Posts: 2

Thu 7/12/2012 - 22:17

 

Thank you so much. Your choices were very helpful. I accept more opinions, obviously. Thank you Dennis

#3
Not a member yet? Register

Copyright 2013 - Softomotive Ltd