Thursday, May 12, 2016

Automatically Generate Screenshots of Foxboro I/A Graphics

At work we have a Foxboro I/A control system. I was getting a lot of requests to take screenshots of control system graphics - which I don't mind fulfilling, because usually someone wants to make something better.

I wanted a better way to fulfill these requests! Something that can do everything at once.

I found an old post on the "Foxboro Freelist", a user-run mailing list for Foxboro system maintainers. Back in November I posted an improved version, but I have improved it again since (continue reading).
for DISP in $(find /opt/graphics/disp/ /opt/graphics/control/ /opt/graphics/trend/ /opt/graphics/loadout/disp/ /opt/graphics/powerhouse/ -name "*.fdf")
do
cd d:
pref -SPR1SR dmcmd /opt/graphics/disp/BLANKSCRN.fdf
sleep 2
echo $DISP
pref -SPR1SR dmcmd $DISP
sleep 5
cd 'C:/Program Files (x86)/HyperSnap 6'
echo $PWD
FILE=$(echo `date +%Y-%m-%d`$DISP | sed 's/\//-/g')
echo $FILE
SAV="D:/opt/screenshots/$FILE.png"
echo $SAV
HprSnap6 -snap:awin -save:png $SAV
pref -SPR2SR dmcmd close
done
exit
 Notes:

  • In the first FOR statement, you can specify as many graphics subfolders as you want. 
  • Replace SPR1SR with the DM (Display Manager) name of the FoxView instance you will be working on. The script calls the graphic to the DM you specify, then calls HyperSnap via its command line interface to take a screenshot. 
    • Just to be clear, the script WILL open these graphics live on your AW (application workstation) and take a screenshot. It won't happen in the background. So if you have any graphics that invoke scripts when opened or closed, exclude those folders from the FOR statement. 
    • This will tie up your AW for however long it takes to open all of your graphics. I like to run the script at the end of the day. If the screensaver comes on, it does not seem to matter. 
  • Create a blank graphic (BLANKSCRN.fdf) for the script to call in between live process graphics. 
  • The sleep commands are necessary because Foxboro users know that graphics don't load instantly - graphics need to query data from the OM (Object Manager) before they're usable. 
  • Assumes you have HyperSnap 6 installed (should ship with all AW's)
  • The output file is named with the date, folder path and filename. For example, 2016-05-12-path-to-graphic-filename.fdf.png. 
  • The echo statements are unnecessary, but it is useful to see their output for debugging. 
  • Save the above as a .ksh file and run in the Kornshell environment. 
  • If you want to generate screenshots of overlay files (popups), change this:
    • pref -SPR1SR dmcmd $DISP
    • to this:
    • pref -SPR1SR dmcmd "dmcmd ov $DISP -l MIDDLE -move"
Since coming up with this script, we generate screenshots of 200+ graphics on a monthly basis and drop them in a network folder on our Business LAN. This way, anyone who is interested can take a look at the current state of the control graphics, find errors and suggest improvements. 

Drop me a line if you find this through Google - I'd love to know if this helped you out!

Update 2016-05-27: I've put this up on Github so people can download the .ksh directly, or contribute to making it better! https://github.com/b-neufeld/fox-auto-generate-screenshots

11 comments:

  1. I really like what you guys are up too. This type of clever work and reporting! Keep up the wonderful works guys I've incorporated you guys to my own blogroll.Crafting Executing Strategy Thompson 18 test bank solutions manual

    ReplyDelete
  2. Today, I went to the beachfront with my children. I found a sea shell and gave it to my 4 year old daughter and said "You can hear the ocean if you put this to your ear." She placed the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is entirely off topic but I had to tell someone!ecommerce web design

    ReplyDelete
  3. I just wanted to make a simple word to be able to thank you for some of the pleasant steps you are sharing at this site. My particularly long internet lookup has now been compensated with sensible information to talk about with my classmates and friends. I 'd repeat that many of us website visitors actually are quite endowed to be in a superb site with very many lovely people with valuable suggestions. I feel pretty blessed to have discovered your entire website page and look forward to so many more entertaining times reading here. Thanks a lot once again for a lot of things.
    cheap and affordable vinyl flooring singapore

    ReplyDelete
  4. It’s actually a cool and useful piece of info. I’m satisfied that you simply shared this useful information with us. Please stay us up to date like this. Thank you for sharing.
    commercial interior designer

    ReplyDelete
  5. Hello! I've been reading your web site for a while now and finally got the courage to go ahead and give you a shout out from Dallas Tx! Just wanted to say keep up the fantastic job!
    office cabinet Singapore

    ReplyDelete
  6. Hey! I know this is kind of off topic but I was wondering which blog platform are you using for this site? I'm getting tired of Wordpress because I've had issues with hackers and I'm looking at options for another platform. I would be fantastic if you could point me in the direction of a good platform.
    website developer

    ReplyDelete
  7. Hi there! Would you mind if I share your blog with my myspace group? There's a lot of folks that I think would really enjoy your content. Please let me know. Cheers Candid wedding photographers in Chennai

    ReplyDelete
  8. You can definitely see your expertise in the work you write. The world hopes for more passionate writers like you who are not afraid to say how they believe. Always go after your heart. best hearing aids

    ReplyDelete
  9. I'm really enjoying the design and layout of your blog. It's a very easy on the eyes which makes it much more pleasant for me to come here and visit more often. Did you hire out a designer to create your theme? Excellent work! Whatsapp.com

    ReplyDelete
  10. Pretty nice post. I just stumbled upon your weblog and wanted to say that I've truly enjoyed browsing your blog posts. In any case I will be subscribing to your feed and I hope you write again soon!
    printing company singapore

    ReplyDelete
  11. I want to express some thanks to you just for bailing me out of this type of trouble. Just after exploring through the search engines and coming across notions which are not powerful, I figured my entire life was done. Living minus the solutions to the problems you have fixed through your main article is a crucial case, and the ones that could have in a negative way damaged my career if I had not come across your blog. Your own capability and kindness in dealing with all things was very helpful. I am not sure what I would've done if I had not encountered such a subject like this. I'm able to at this point look ahead to my future. Thanks a lot so much for your specialized and amazing help. I won't hesitate to recommend your blog post to any person who would like guidelines on this issue.
    mobile app development

    ReplyDelete