If certain text in file do this...

Discuss RoboTask here
Post Reply
sparrow
Posts: 3
Joined: Mon Feb 14, 2005 6:11 pm

If certain text in file do this...

Post by sparrow »

Playing with the trial version and trying it out. So far it seems you've got all the right things to make tasking much easier. Congratulations.
My question: different text items are copied to the clipboard at different times using other software. How do I set up RoboTask too read that text or letter and then depending on what that letter is go get a certain text file elsewhere and move it and rename it to another location. I got the naming down but not the reading of the clipboard. Ex: Clipboard recieves the letter A inside a text file. Robotask recieves this file, reads the contents, which is 'A', and then moves and renames a file I designate somewhere else. If the clipboard then has B then move this other file somewhere else. Sorry for the verbiabe. Thks.
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

If certain text in file do this...

Post by Oleg »

I understand your question so: you want to make a multicontents clipboard (or some similar).
I think that it is possible. You shall create a few tasks which reads the clipboard and saves this content to file. Also you shall create corresponding quantity of tasks which reads content from file and puts content to the clipboard.
For example:
We want to create clipboard with three parts. We need to create 3 "reading" tasks.
1-st gets clipboard an write content into "c:\MyComtents\1.txt"
2-nd gets clipboard an write content into "c:\MyComtents\2.txt"
3-d gets clipboard an write content into "c:\MyComtents\3.txt"
1-st task starts with hot key "Ctrl-1", 2-nd with "Ctrl-2" and 3-d with "Ctrl-3"

Also we need to create 3 "writing" tasks
1-st reads file "c:\MyComtents\1.txt" and puts content into clipboard
2-nd reads file "c:\MyComtents\2.txt" and puts content into clipboard
3-d reads file "c:\MyComtents\3.txt" and puts content into clipboard
1-st task starts with hot key "Ctrl-Shift-1", 2-nd with "Ctrl-Shift-2" and 3-d with "Ctrl-Shift-3"

So we have a likeness of multicontents clipboard. When we press "Ctrl-1" (or "Ctrl-2 or 3") clipboard content will be saved in corresponding part.
When we press "Ctrl-Shift-1" ("Ctrl-Shift-2 or 3") RoboTask retrieves corresponding part and puts it to the clipboard.
sparrow
Posts: 3
Joined: Mon Feb 14, 2005 6:11 pm

If certain text in file do this...

Post by sparrow »

Letter copied to clipboard. Then…

Code: Select all

Clipboard put into var(a) //get text ???
IF var(b) = ‘C’ THEN test next lines //if then
       IF var(a) = ‘B’ THEN do next line //nested ?
                  copy & move file etc… // okay
       IF var(a) = ‘S’ THEN do next lines //
                    copy  & move file etc… //
IF var(b) = ‘B’ THEN test next lines //
       IF var(a) = ‘S’ THEN do next line
                    copy  & move file etc… // etc…
Depending on what variable(b) is, S, B, or C, I would like to take actions depending on what variable(a) is. Then I would like variable(a) to take the place of variable(b). I am having a problem understanding how to do this.
Ex: clipboard contains the letter ‘B’ that goes into var(a). Variable(b) has ‘C’ at present, so variable(a) is tested in that nest of IF THENs. It is ‘B’ so those corresponding actions are taken. After that happens variable(a) gets moved over to variable(b). Then a new clipboard action takes place later in the day and that contains ‘S’. At present variable(b) contains ‘B’ from the previous placement from variable(a). Because it is ‘B’ those corresponding nested actions should take place. Then variable(a) replaces variable(b). And around and around again. Any suggestions? Do I need to set a value for variable(b) at startup? Or can I just leave it blank.
Thanks for the prompl reply
Last edited by sparrow on Thu Feb 24, 2005 12:30 am, edited 1 time in total.
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

If certain text in file do this...

Post by Oleg »

I think that you have chosen some uncomfortable object for analysis, because clipboard may contain any content: some text or string unrelated to your task. And this content can appear in clipboard at very unexpected moment.
Are you not afraid to receive a problems?

Ok. VAR_A has received value from clipboard. You want to do something depend of values of two variables VAR_A and VAR_B. And next you want assign value of VAR_A to VAR_B. You reason rightly.
I advise you to check value of VAR_A. If it contains any "trash" then you should abort the task. Full algorithm of your task is approx such:

get ClipBoard into VAR_A
if VAR_A<>'S'
   if VAR_A<>'B'
      if VAR_A<>'C'
        break
      end if
   end if
end if
if VAR_B = 'C'
   if VAR_A = 'B'
      do something
   end if
   if VAR_A = 'S'
      do something
   end if
end if
if VAR_B = 'S'
   if VAR_A = 'B'
      do something
   end if
   if VAR_A = 'C'
      do something
   end if
end if
if VAR_B = 'B'
   if VAR_A = 'S'
      do something
   end if
   if VAR_A = 'C'
      do something
   end if
end if
assign VAR_A to VAR_B

But I think that you can do it on BASIC easier.
Do I need to set a value for variable(b) at startup? Or can I just leave it blank.
It depends of what do you want, but I advise to assign to VAR_B some fixed value: empty string or some letter. RoboTask saves values of user variables for next session.
I hope I have helped you.
Last edited by Oleg on Thu Feb 24, 2005 5:39 am, edited 1 time in total.
sparrow
Posts: 3
Joined: Mon Feb 14, 2005 6:11 pm

If certain text in file do this...

Post by sparrow »

Oleg,
You are helping greatly. Thank you for the prompt replys. I am learning much. Still building.
I start a program at a certain time every day. That program logs in automatically and receives a data feed. That data feed stops for an hour each day, which disconnects me. I must then quit the program and restart it to automatically log in again, or I can hit the okay dialog box which says the data feed is no longer there, wait an hour and manually use the mouse and reconnect through the menu bar.
How do I automate to quit the program so I can re launch it 1 hour later. Or is there some other method I should look into? I don't know how to quit the program. You have been very helpful. I hope I'm not asking too much. I am still on trial version so I understand if enough is enough. Thanks for all the help. You have a good program.
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

If certain text in file do this...

Post by Oleg »

You can use window command in order to close some program. If you close main window of program then the program is forced to close.

To control dialog box use "Send Keysstokes" action. Each dialog box observes the following rules:
- TAB key - select next control element
- Shift-TAB - delect previous element
- Enter - accept corrent dialog parameters (Ok)
- Esc - cancel

If you need to call some dialog (ex: Login form) from main window, generally there is an acceleration key (ex. Ctrl-O)
Also you can use comdinations Alt-F (menu File) + O (open).
It depends of your application. As a rule any application can be controlled by keyboard, without mouse.
Mouse actions will be included in new release of RoboTask (cooming soon)
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: If certain text in file do this...

Post by Oleg »

What is this?
already corrected

View here: https://robotask.com/forum/viewtopic.ph ... =7109#p493
Oleg Yershov
Post Reply