Sign in to follow this  
Followers 0
Ravel

Recurrsive Screen Recorder

8 posts in this topic

#1 ·  Posted (edited)

What I am trying to do is set this script up to have a program start recording everything that is on the screen for 10 min intervals. At the end of the 10 min interval it saves the file and records starts recording again, and then stops again after ten mins saves the file the same name as before. So basically the file is rewritten with new information every ten mins.

The only time I want this cycle to stop is when a specific window opens. When this window opens the recursive macro should stop and can only be restarted by human interaction. This will make that file that is constantly rewritten have valuble information in it that we can use to study.

This is what I have so far:

CODE
HotkeySet('{ESC}', 'Terminate')

opt ("WinTitleMatchMode",2)

Run("C:\Program Files (x86)\CamStudio\Recorder.exe"); camstudio is the freeware screen recorder that I am using

While 1

WinWaitActive("CamStudio"); if the window never exists then the software should continuously rewrite the file with 10mins of new recorded screen data until it does exist.

Send("^{F8}")

Send("^{F9}")

sleep(5)

Send("Tacan")

Sleep(10)

Send("{ENTER}")

WinWaitActive("Save AVI File")

Sleep(10)

Send("Tacan")

Sleep(10)

Send("{ENTER}")

If WinWaitActive("Windows Media Player")then ; this name is just a placeholder. I want the window when it exists, to stop the recording process.

sleep(10000)

Send("^{F9}")

sleep(5)

Send("Tacan")

Sleep(10)

Send("{ENTER}")

EndIf

If WinWaitActive("Save AVI File")then

Sleep(10)

Send("Tacan")

Sleep(10)

Send("{ENTER}")

Sleep(100)

WinActivate("Player")

processclose ("test.exe")

EndIf

Sleep (1000)

WEnd

$TimeStamp = TimerInit ()

;Check every minute if time difference is greater than or equal to 10 mins

Do

;Pause for 1 minute

Sleep(1000 * 60)

Until TimerDiff ( $TimeStamp) >= 1000 * 30 * 10 * 1

WEnd

Func Terminate()

Exit

EndFunc

I appreciate any help that you all can provide

Screen_Data_Recorder.au3

Edited by Ravel

Share this post


Link to post
Share on other sites



Hello Ravel (my favorite impressionist composer),

Could you share with us what problems you are experiencing? I did notice that there appeared to be an extra 'WEnd' in the script I downloaded.

Thanks!

Zach...

Share this post


Link to post
Share on other sites

Hello Ravel (my favorite impressionist composer),

Could you share with us what problems you are experiencing? I did notice that there appeared to be an extra 'WEnd' in the script I downloaded.

Thanks!

Zach...

Well so far I am able to get it to stop recording when a specific window title appears, but I am trying to figure out how to get it to record for ten mins. Stop save the file and start recording again. I can't figure out how to get this to continue until the "window" appears.

Share this post


Link to post
Share on other sites

Put in a "pause" function when the window appears.

Global $Paused, $title = "Window", $text = "blah"
HotKeySet("{PAUSE}", "_Pause")


While 1
   Sleep(50)
   If WinExist($title,$text) then _Pause()
WEnd

Func _Pause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Put in a "pause" function when the window appears.

Global $Paused, $title = "Window", $text = "blah"
HotKeySet("{PAUSE}", "_Pause")
While 1
   Sleep(50)
   If WinExist($title,$text) then _Pause()
WEnd

Func _Pause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

I forgot in the main topic to state that I want it to stop when the window appears, and save the file at the same time. That portion of the script that you wrote Blue, do i just paste that into the current script without any changes?

But I reiterate the script should operate like this:

I run the script: Record screen information for 10 mins----tell the recording program to stop---save file "file.avi"----start recording again for 10 mins---->after ten mins tell the program to stop recording---save file "file.avi"---and repeat. The cycle will break when the window (example) "windows media player" appears---> recording stops, saves it as "file.avi" and does not start recording until I come back to restart the script.

I hope this kinda clarifies what I am trying to do.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Ravel,

Here is a road map that might aid in your quest.

Run this and observe the Console messages.

After awhile, open an instance of Windows Media Player and observe the messages.

HotKeySet( "{ESC}", "Terminate" )

$isRecording = False
$timeout = 1000 * 10; <--- this is set to 10 seconds for testing purposes

; <===================   FUNCTIONS  =========================>
Func StartRecording()
    If $isRecording then 
        ConsoleWrite( @CRLF & "Perform steps here to STOP recording" & @CRLF)       
        SaveFile()
        ConsoleWrite( @CRLF & "Perform steps here to RESTART recording" & @CRLF)        
    Else
        ConsoleWrite( @CRLF & "Perform steps here to START recording" & @CRLF)      
        $isRecording = True 
    EndIF 

    Return TimerInit()
EndFunc

Func SaveFile()
    ConsoleWrite( @CRLF & "Perform steps here to save file" & @CRLF)
EndFunc

Func Terminate()
    ConsoleWrite( @CRLF & "Exiting; Perform steps here to cleanup" & @CRLF)
    Exit
EndFunc

; <===================   START HERE =========================>
$begin = StartRecording()
While WinExists( "Windows Media Player", "" ) = 0 
    If TimerDiff( $begin ) >= $timeout Then     
        ConsoleWrite( @CRLF & "!Timeout Occurred" & @CRLF)
        $begin = StartRecording()
    EndIf
    ConsoleWrite( "." )
    Sleep(1000)
Wend

ConsoleWrite( @CRLF & "Window Was Found!" & @CRLF)
SaveFile()
Terminate()

You'll want to fill in the necessary actions inside the appropriate functions.

Edited by zfisherdrums

Share this post


Link to post
Share on other sites

I hope this kinda clarifies what I am trying to do.

The original post was quite clear, but the way you've been asking, it sounds like you want us to write it for you. No. Ain't going to happen. And for the record, you don't just copy/paste the code I gave you, you use it as a templated example to WRITE YOUR OWN CODE.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

The original post was quite clear, but the way you've been asking, it sounds like you want us to write it for you. No. Ain't going to happen. And for the record, you don't just copy/paste the code I gave you, you use it as a templated example to WRITE YOUR OWN CODE.

Dude what is the issue? I wasn't sure you understood or not, and if you thought that I asked to have you write no that wasn't exactly it, but please understand that not all of us understand autoit as well as others. I have written a plenty of scripts before, but they have all been simple. When I come up here it usually for help to write a more complicated script. Understand that not everyone knows how to write a scripts as well as you may, and sometimes it helps to be a bit more clear so that both parties understand what is going on. Anyhow, I am not sure why you took offense to the fact that I was trying to get the code that I pasted tweaked, because as you saw I did attempt to write the code myself and once i reached the end of my rope I posted here.

Anyway thanks for your help, but I am not sure how to apply the code that you posted to what I am trying to do that is what I needed help with.

Thanks zfisherdrums I will give that a try.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0