------------- *** the DO command *** -------------  

> do "put" && theValue && "into field" && theField 

Anthony: What's wrong with: put theValue into field
theField ?!

Alain: OK, it was a bad example.

Anthony: I think the 'do' command has made people fail
to realize what HC syntax allows!

Alain: I am thoroughly familiar with HyperTalk. I have
been using it since day-one that it came out. It has
been my main programming language for 14 years now. I
even created an educational program entirely with HC
that teaches HyperTalk-Scripting to future teachers of
all levels of computing experience.

Alain: Below is a much better illustration of the
power of the DO command. In a nutshell, it allows you
to mix-and-match three (3) different scripting
languages inside the same script: HyperTalk, Perl, and
AppleScript. And, moreover, params can be passed to
these other languages.

on closeField
  ----
  makeTable fld "TP", fld "DK", fld "DV"
  copyCGI "dispatch.cgi"
  ----
end closeField


on makeTable(path, key, values)
  ----
  put "$TP = '" & path & "'; "  & return after var
  put "$DK = '" & key & "'; " & return after var
  put "$DV = '" & values & "'; " & return after var
  ----
  put readFile("makeTable.pl") & return after var
  ----
  do var as perl
  ----
end makeTable


on copyCGI programName
  ----
  put "HD:Source:" & programName into sourcePath
  put "HD:Destination:" & programName into destinPath
  ----
  put "tell application" && quote & "Finder" & quote &
return after scriptVar
  put "set source to (" & sourcePath & ") as alias" &
return after scriptVar
  put "set destination to (" & destinPath & ") as
alias" & return after scriptVar
  put "duplicate source to destination with replacing"
& return after scriptVar
  put "end tell" after scriptVar
  ----
  do scriptVar as appleScript
  ----
end copyCGI

Alain: Please note that the lines of the 3rd handler
may wrap themselves if your Email client's window is
small. Copy and paste them into a suitable editor if
you have difficulty reading the handler.
__________________________________________________
Do You Yahoo!?
Thousands of Stores.  Millions of Products.  All in one place.
Yahoo! Shopping: http://shopping.yahoo.com

Reply via email to