General HydroStatics
Ship Stability Software
Command of the Week
(New or interesting aspects of GHS that you may not know about)

PICSHOW
(Requires GHS version GHS 16.58 or later)

In GHS you have the intrinsic set of commands, and then you have MACRO commands -- "Big" commands that you make by putting together commands and giving them a name.

No doubt you already knew this. We say it to explain why an issue of the Command Of the Week, like this one, can be a "MACRO COW."

Back in COW030, the DIR /MACRO command was featured, and a couple of examples were given showing how DIR /MACRO can send file names to a macro to be processed by it.

This week we have another application for DIR /MACRO, which grew out of a real-world need that had nothing to do with GHS.

When looking for a simple "slide show" application, nothing was found that was simple and easy enough. "Maybe GHS can do it," someone said. "Let's give it a try."

Using a template to view JPG files and the DIR /MACRO command to feed the file names to it, PICSHOW took only three short macros in addition to the simple template. And it worked like a charm.

Here is the GHS code:

template show /bg:15
"Go" .picshow /persist
break
@$pic$.jpg /width:80
exit
/
variable started=0
macro start
if {started}=0 then set started=1 | copy "%1.jpg" $pic$.jpg
/
dir *.jpg /macro:start
macro copy
if {templok}>=0 then exit
if "%1"="$PIC$" then exit
copy "%1.jpg" $pic$.jpg
template /refresh
wait 2
/
macro picshow
dir *.jpg /macro:copy
if {templok}<0 then exit picshow
/
screen min
set templok=-1
.show
erase $pic$.jpg
screen min:rest
As you can see in the collage of three screen shots below, there is nothing extra on the screen but the template frame and one Go button to start the show. It cycles through all the JPG files in the folder then starts over again and keeps going until you close the template window.




Questions, comments, or requests?
Contact Creative Systems, Inc.

support@ghsport.com

USA phone: 360-385-6212 Fax: 360-385-6213
Office hours: 7:00 am - 4:00 pm Pacific Time, Monday - Friday

Mailing address:
PO Box 1910
Port Townsend, WA 98368 USA

www.ghsport.com

Click here for an index to this and previous COWs