Extending SuperCard with OS X Shell Commands
SideBar
Essential SuperCard functions
SuperCard Shell function
Execute shell commands
SuperCard Merge function
Variable & quote insertion.
A Quick look
OS X ships chock full of preinstalled shell commands capable of a wide variety of tasks.
Some are single purpose utilities akin to the Xfcns/Xcmds we're all accustomed to.
The screencapure command captures the screen, window, or any portion thereof, to clipboard (or file) returning nothing.
Capture portion of screen (interactive, to clipboard)
on mouseup
put shell("screencapture -ic ;") into junk
end mouseup
Others are powerful languages with hundreds of individual commands and functions.
Fortunately, one needn't learn all of such languages to take advantage.
The example below uses a Perl function to tidy-up output.
Return GMT formatted to HTTP specification
function gmtime
return shell("date -u +'%a, %e %b %Y %T %Z' | perl -pe chomp ;")
end gmtime
A linefeed is usually appended to text output, which in-turn is converted automatically to a carriage return by the SuperCard shell function (unless the extended function syntax is used)
The Perl function 'chomp' deletes linefeeds from output.
Recent Additions
Reference
Shell Scripting reference at Apple
Top
Comments (6)
John Collett said
at 3:21 pm on Apr 26, 2006
This is an excellent start. Please keep up the good work.
I have tried some exercises using the ideas presented so far.
Where are more details about screenCapture? I have not been able to find it listed anywhere.
DCS said
at 2:15 am on Apr 27, 2006
I can only speculate.
Since we know the command is working...
shell("screencapture") issued from the msg box will post a brief usage text to the console log.
That usage text is nearly as in-depth as the man page itself.
John Johnston said
at 2:48 am on May 14, 2006
Hi DCS, you are making great progress.
Have you though of adding a SideBar for navigation?
DCS said
at 3:32 am on May 14, 2006
Looks like you may have been toying with a sidebar a bit earlier.
I've delayed to make sure i don't trash something you may have started.
John Johnston said
at 7:57 am on May 14, 2006
No I just clicked on a link t o sidebarin todays tips and it seemed to make a page, eek!
DCS said
at 8:10 am on May 14, 2006
No worries!
You don't have permission to comment on this page.