Hope you haven’t been put off a Windows venture into timekeeping using the same web application idea we’ve been talking about the last couple of days, with the last being Mac OS X MAMP Timekeeping Web Application Email Tutorial, with a bias towards Mac OS X? To make things work in Windows for this same web application needs a batch process screen capture background process, and you’d think it would be easier in Windows than Mac OS X. We, here, also believe this to be true, as Windows has been designed with the PrintScreen button of such great use for instantaneous screen capture with no applications involved … just “user intervention”. But, today, to fit in with our ideas we don’t want “user intervention” so we started looking for ideas on the web and got to this useful link full of interesting ideas … thanks. But … and there’s always a but … we prefer to fall back on one of our favourite Windows pieces of software in the world … and perhaps worlds beyond … that being AutoHotKey. Words apart from “Auto” and “Hot” and “Key” cannot explain how good AutoHotKey is … though we’ve been trying here! We use it to record Mouse and Keyboard Windows desktop “procedures”. The wonderful thing about AutoHotKey is that it doesn’t tie you down to set “procedures” to suit what other people tell you, and so you can “invent” your own procedures, allowing “operator” types, in the I.T. world some creative licence, we’ve no doubt. You can tell reading the forums many people have a lot of a gobsmacked admiration for AutoHotKey.
Let’s break the “task at hand” up though, because even AutoHotKey benefits from a bit of departmentalization, at times. We want to, for Windows automated (but backgrounded) screen capture, say every fifteen minutes, needs …
- wait until the minutes of the day are 00 or 15 or 30 or 45 … for Windows would imply the use of one of …
- Task Schedular for some code that runs through once
- at for some code that runs through once
- Windows exe for a compiled program that loops and perhaps never finishes until user intervention
- Windows bat for batch interpretive program that loops and perhaps never finishes until user intervention
… and for the purposes of user friendliness we opt for the last once we see that the date and time functionalities are possible and not that convoluted looking … thanks here for advice … and we called ours c:\screenshot.bat … and we use our often used …
ping 127.0.0.1 -t -n 10 > nul
… to wait for a while within the Windows bat supervisor’s workings
if exist c:\sshot.JPG erase c:\sshot.JPG
… you’ll see why later, below- get the screen captured into a clipboard buffer … we’ll use AutoHotKey (compiled exe program that uses this really simple c:\PrintScreen.ahk AutoHotKey script (we derived, as we do mostly, by using AutoHotKey ScriptWriter’s Record button usage) … we don’t often leave it as the (running of an) AutoHotKey script, though that is possible too) … then …
- get clipboard buffer to be saved into a jpg image … and we determine Windows Paintbrush is the generic out-of-the-box way to go here, and settle for it always saving its image content to c:\sshot.JPG … and this is where you may have to change? … we opt for an AutoHotKey script … compiled to a Windows exe that uses this really simple c:\sshot.ahk AutoHotKey script we call from the Windows bat supervisor, as mentioned above … because lots of Windows environments disallow PaintBrush to Save As to a file in c:\ root directory
- once we know that c:\sshot.JPG exists our Windows bat supervisor …
rename c:\sshot.JPG screen-%2-%3.jpg
… via a call of itself using the Windows start /b switch option of use
… and so, we hope you see that the whole shebang can be supervised by one Windows bat supervisor …
… which, itself, can work its functionality via any of …
- being run, at the user’s discretion from the Windows command line … our anticipated usage method … but could be the action parameter to …
- “as soon as you …” … read more at this useful link about Startup folders and Windows registry ideas
- Task Schedular
- at
- others … for example, another program already “tasked” could call our screenshot.bat as above, or the existance of a file “plonked” locally or remotely could control its use
You can see some of what we did for this Windows screenshotting automation with today’s tutorial picture as the result of the use of today’s background processing work that was achieved by …
- on windows, getting background screenshotting processing working +
- visit URL quarter_hour_timer.html (live run) and right-click View Source and Ctrl-A Ctrl-C to copy the code into a Notepad file where we Ctrl-V paste it into a c:\quarter_hour_timer.html accessed in Firefox via File -> Open File to file:///c:/quarter_hour_timer.html
Did you know?
Windows has an order or priority of what it tries to run, should a user not specify everything, and for local hard drive use … ie. not getting into remote usage possibilities here … some priorities for today’s c:\screenshot.bat could be …
- “screenshot” as the command would only work if either …
- you are in c:\ now and there is no c:\screenshot.com nor c:\screenshot.exe (which take precedence over c:\screenshot.bat) … which takes precedence over …
- c:\ root directory is on your path (ie. %PATH% environment variable), and its position in %PATH% is higher than any other “wrong headed” screenshot.bat files on your current (in our case, c:) drive, and there is no c:\screenshot.com nor c:\screenshot.exe
… is the case, assuming you have the priviledge to run it
- “c:\screenshot” as the command would work if either …
- there is no c:\screenshot.com nor c:\screenshot.exe (which take precedence over c:\screenshot.bat)
… is the case, assuming you have the priviledge to run it
- “c:\screenshot.bat” as the command would assuming you have the priviledge to run it
Previous relevant Mac OS X MAMP Timekeeping Web Application Email Tutorial is shown below.
The practicalities of yesterday’s (Mac OS X MAMP Timekeeping Web Application Primer Tutorial) timekeeping Mac OS X Web Application, left as they are, would leave you with a somewhat useful web application whose use is only for the here and now, but what if you want it to be more accountable? Well, that is when we, here, at RJM Programming, like to use that tried and trusted email form of communication.
Today’s email methods spurn the use of server-side intervention, at least for now. So what is available to us as tools, if we don’t include Ajax nor jQuery in that list? Well, we have, to our minds …
- mailto links (get us to the email client) +
- the body section of that email can have a clipboard image pasted into it, for which we can utilize HTML5 canvas element’s toDataURL() method, teamed up with a window.open popup window of the toDataURL image data, which can be selected and copied, optionally, by the user themselves, should they wish this to make their email more self explanatory
We last discussed this thinking with Canvas Annotation Email Attachment Clipboard Tutorial.
We rely on the crontab functionality, being as there is no server-side help, to create the image file, whose contents eventually go to make up the contents that can be selected and copied and pasted by the user into the body section of the email (and sent off to whosoever they feel like sending it too, as you have the full power of the email client available to you with the interaction you have with an actual email client program).
Here is the HTML and Javascript quarter_hour_timer.html which changed to cater for today’s email functionality in this way, and, as per the Stop Press from yesterday, we’ll also have a live run link here today.
Previous relevant Mac OS X MAMP Timekeeping Web Application Primer Tutorial is shown below.
Sometimes when you program, especially for administrative type functionality, there are useful programs to write, that are able to become web applications, but in a limited set of platforms. So it is today with our timekeeping web application that relies on …
- Mac OS X operating system +
- Existance of [/usr/sbin/]screencapture +
- crontab active and editable via crontab -e +
- One of …
- MAMP installed to, in our case, /Applications/MAMP/htdocs/ (as is mentioned in the relevant crontab background task that snapshots the user’s screen every quarter hour) that maps to the MAMP web application URL http://localhost:8888/ … or …
- crontab directory mention that corresponds to a URL call of our web application like for our Google Chrome example (where the directory below, used, could be a place of your choosing (that matches what is in your crontab task entry)) …
file:///Applications/MAMP/htdocs/quarter_hour_timer.html?localplace=
… or just, via the web browser’s File -> Open File menu …
file:///Applications/MAMP/htdocs/quarter_hour_timer.html
… pretty restrictive, huh? … but pretty useful for our quarter hour timekeeping purposes today.
We want to have a web application that is running at the user’s discretion, and when first fired up, looks for outputs from crontab tasks above …
0,15,30,45 * * * * /usr/sbin/screencapture -Cd -tjpg /Applications/MAMP/htdocs/screen-`date +"\%Y\%m\%d-\%H\%M"`.jpg
… for the current day in question and if existant show …
- a date and time stamp +
- the snapshot of what you were doing at the quarter hour, that is clickable to make bigger for more in depth viewing +
- an HTML textarea element in which you can optionally type in more specifics about that quarter hour
So, as much as we like to think of Mac OS X Terminal application’s BSD (a unix derivative) operating system, as being a lot like Linux, there are some commands and usage that …
- adds Mac OS X specific command line functionality to a Linux or unix base set of functionality, like for today’s screencapture command … and we’ve included another such example, below, with the command say featuring in Mac OS X Text to English Speech Primer Tutorial as shown below
- changes switches on Linux or unix commands
- won’t have some Linux or unix commands that other platforms do
In the great tradition of behoving … we behove … we behove thee quarter_hour_timer.html if you like, my liege. On this occasion you’ll have gleaned that there is no live run link, because the RJM Programming web server is not Mac OS X … so command line screencapture has no meaning for a CentOS web server’s operating system command line. You’ll see in the code that rather than use “Client Pre-emptive Iframe” concepts to check for existence of crontab screen capture images, we, instead use the onerror event for HTML img elements to check for non-existance.
Stop Press
Just noticed that, perhaps, after all, a live run from the RJM Programming website can make sense if you have a Mac OS X laptop, for instance, that is running that suggested crontab entry as explained in tutorial above. That type of live run managed to latch on to our local crontab screencaptures on my MacBook Pro.
Previous relevant Mac OS X Text to English Speech Primer Tutorial is shown below.
We’ve got a few new ideas today …
- Text to English Speech via Mac OS X’s command line say command used by PHP via exec to make say.php (which is useful as a download to a Mac OS X laptop using MAMP) which, today, does not have a live run because the web server of domain rjmprogramming.com.au is a CentOS Linux server … Linux equivalent of Mac OS X’s say? … read here
- Trying to present this brought up the usual movie production problem with iMovie overlaying the audio on top of the video (though you may want to try, and you could start reading with this link) versus QuickTime Player talent to catch both audio and video tracks (and that we ended up using), but not of the “screen goings on”, alas versus MPlayer OSX Extended which can play separately but not two tracks on top and doesn’t do any reconstituting … so …
- Improved on our inhouse Video/Audio synchronizing efforts by allowing audio_video.html supervisor (changed in this way) be able to be called to press one of its preconceived synchronization buttons onload which we do with (the newly added) Macbeth Act 1 Scene 1 … in a small celebration of the Bard … who, am thinking (in that Falstaff way), would have got a huge chuckle out of “anonymous” instead of “anon” during the Three Witches scene … we had to do something to say Happy Birthday
Along the way we tried filming the MacBook Pro with the iPad to a YouTube …
… but weren’t happy with the audio quality, alas (too/two).
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.