screencapture loop and so on

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
worldwide
Junior Coder
Posts: 31
Joined: Mon Jul 09, 2007 11:34 am

screencapture loop and so on

Post by worldwide » Mon Jul 09, 2007 12:05 pm

Hello,

i just dtarted with macro sceduler and thought i would directly get the idea.
I wanted to make the following :
after started the macro it should wait until an window would open with the Label- "Single Map".
Then it should move to the reference place 0,0.
After that it should make one screencapture with the proper size.
Then save the screenshot with date/time and name as jpg.
And repeat until macro closed.

Somehow, it doesnt wait until screen label SingleMap pop ups, it directly starts making those screenshots.

I hope i could make myself clear, i also inserted the prog i made.

Any suggestions or help? Or what did i wrong ?


[quote]
Label>StartOfLoop
IfWindowOpen>Single Map,,
Wait>0.2
MoveWindow>Single Map,0,0
Wait>0.2
Day>der_Tag
Month>der_Monat
Year>das_Jahr
Sec>Sekunden
Min>Minuten
Hour>Stunden
ScreenCapture>0,0,802,577,D:\atest\%das_Jahr%_%der_Monat%_%der_Tag%_%Stunden%_%Minuten%_%Sekunden%_TMS4.jpg
WaitWindowClosed>Sinle Map
else
Goto>StartOfLoop
endif
[/quote]

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

Post by Marcus Tettmar » Mon Jul 09, 2007 12:30 pm

Possibly there is another window, could be hidden, called SingleMap. In Macro Scheduler go to Tools/View System Windows and see how many entries there are for SingleMap.

Assuming the window you want is the only visible one with that title, add this line to the top of your script:
Let>WF_TYPE=2
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

worldwide
Junior Coder
Posts: 31
Joined: Mon Jul 09, 2007 11:34 am

Post by worldwide » Mon Jul 09, 2007 1:02 pm

:D :o thanx seems to be working now.

Now i made a small loop so that it only saves ONE screenshot and saves this.
Also the macro should work until the macro would be closed.

These two points doesnt work like this :

------------------------------------------------------------
Let>WF_TYPE=2
Let>r=0
Label>StartOfLoop
IfWindowOpen>Single Map,,
MoveWindow>Single Map,0,0
Day>der_Tag
Month>der_Monat
Year>das_Jahr
Sec>Sekunden
Min>Minuten
Hour>Stunden
Repeat>r
ScreenCapture>0,0,802,577,D:\atest\%das_Jahr%_%der_Monat%_%der_Tag%_%Stunden%_%Minuten%_%Sekunden%_TMS4.jpg
Let>r=r+1
Until>r=1
WaitWindowClosed>Sinle Map
EndIf
Goto>StartOfLoop
-----------------------------------------------------------------------

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

Post by Marcus Tettmar » Mon Jul 09, 2007 1:07 pm

Your repeat/until loop will loop forever. If you only want it to do the ScreenCapture once per opening, then repeat/until is not really appropriate. A simple If condition would do the job. I think this is what you want:

Code: Select all

Let>WF_TYPE=2
Let>r=0
Label>StartOfLoop
IfWindowOpen>Single Map
  MoveWindow>Single Map,0,0
  Day>der_Tag
  Month>der_Monat
  Year>das_Jahr
  Sec>Sekunden
  Min>Minuten
  Hour>Stunden
  If>r=0
    ScreenCapture>0,0,802,577,D:\atest\%das_Jahr%_%der_Monat%_%der_Tag%_%Stunden%_%Minuten%_%Sekunden%_TMS4.jpg
    Let>r=1
  Endif
  WaitWindowClosed>Single Map
EndIf
Goto>StartOfLoop
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

worldwide
Junior Coder
Posts: 31
Joined: Mon Jul 09, 2007 11:34 am

Post by worldwide » Mon Jul 09, 2007 1:59 pm

:D :P :wink:
Yes Yes Yes it works now the right way :-) thanx !!!!

It seems to be that i got adicted to MS.

The thing is this, the window i capture shows data, but after capturing the screen the data is not in the captured picture...... i was wiondering if this is due to the fact that there is a DLL-file which holds the data ?
I hope i made myself clear on this, since my writing is not to good :oops:

I red several postings concerning DLL, but i have no direct clue how to work with that, somebody any ideas for this for me ?

Best

Aaron
Pro Scripter
Posts: 113
Joined: Mon Apr 09, 2007 1:35 am
Location: Wyoming

just a thought

Post by Aaron » Mon Jul 09, 2007 5:36 pm

The thing is this, the window i capture shows data, but after capturing the screen the data is not in the captured picture
Maybe you need a wait>1 before capture, as it may be capturing the window before the data has a chance to populate the window.

Hope this helps
Aaron

worldwide
Junior Coder
Posts: 31
Joined: Mon Jul 09, 2007 11:34 am

Post by worldwide » Tue Jul 10, 2007 4:41 am

:D :o

YES that was it !!! Great help here and thanx !!!

Just 4 all heres the complete script :

-----------------------------------------------------------------------
Let>WF_TYPE=2
Label>StartOfLoop
Let>r=0
IfWindowOpen>Single Map
MoveWindow>Single Map,0,0
Day>d
Month>m
Year>y
Sec>S
Min>M
Hour>H
Wait>0.1
If>r=0
ScreenCapture>0,0,802,577,D:\%y%_%m%_%d%_%H%_%M%_%S%_Name.jpg
Let>r=1
Endif
WaitWindowClosed>Single Map
EndIf
Goto>StartOfLoop
-----------------------------------------------------------------------------

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