WRITE output to text string, file, window, message box, status bar, clipboard (f)

⇒Help ⇒Contents ⇒Input-Output (⇒Optional Keywords Syntax)

Bookmarks:
  ⇒append_formatted list to string   ⇒comma separated variables   ⇒copy list to clipboard   ⇒current time   ⇒file_output options   ⇒fill a format template   ⇒formatting output   ⇒maximum numeric output digits   ⇒move a file   ⇒no format at all option   ⇒output medium selection   ⇒quote list items   ⇒screen and print output   ⇒standard fortran format   ⇒string delimiters   ⇒symbolic names in output list   ⇒transparent write   ⇒window output options   ⇒write multi column output

Optional keywords:
Align APPend BaCkcolor BolD ClipBoard CLoSe Column COLumnS DeCoRation DELETE ERror FIle FLUsh FONt ForeColor Format IOStat ITalic ItemS LENgth Messagebox Name PoinT PRint Rec REName ROTate Row StatusBar Text UnderLine WINdowhandle
option type

output medium selection

(see also formatting output below)
--- ---
  • WRITE() "pi = ", 2*ACOS(0) ! prints pi = 3.141592654 to the next script window row, column 1. This can be changed by the Row and/or Col option

WINdowhandle

NUM
  • WRITE(win=window_handle) list ! if needed the window scrolls up

Text

txt
  • WRITE(T=charstring) list ! write list to CHARACTER string
To

append_formatted list to string

use the

APPend

keyword:
  • WRITE(Text=oldstring, append, fmt="a, f5.2") " this is appended:", pi

FIle

txt
  • OPEN(file=filename) ! the file must be opened prior to the 1st write
  • WRITE(FIle=filename) io_list ! this example writes to a sequential file
Other commands particular to file output see file_output options

PRint

num
  • WRITE(print=p) list ! p=1: print to line printer, p=1+8 close printer. See Print for details

StatusBar

[T]
  • WRITE(sb, Name) a, b ! writes symbolic names with values: "a=... b=..."

ClipBoard

[T]

Messagebox

txt
  • WRITE(Messagebox=options, IOS=selected_button) io_list
  • The user must respond before HicEst can continue
  • the string options may contain one symbol each for
    • the icon displayed with message, default is none
      ? question-mark ! exclamation-mark i information S stop-sign

    • the button combination
      o ok y yes no a abort retry ignore O ok cancel (the default) R retry cancel Y yes no cancel

    • 1 or 2 or 3: the default button number highlighted when the message box is first displayed
      default is 1
    • M: system modal box: All applications are suspended until the user responds.
  • WRITE(Msg="y?", IOStat=button_nr, Format="A, U|it is |WWW CCYY/MM/DD HH:mm, a") "Time for coffee?", 0
    • Message box yes/no (y), ? icon, default button 1.
    • The bar symbols separate title and text, or lines, resp.
    • A value of zero is printed as the

      current time

      by the time format prefix U.

formatting output

options

Format

txt There are numerous ways to format numerics or strings,

see Format

.
Here are 6 examples for mixed string and numeric output:
  • no format at all option

    :
    • WRITE() "pi = ", pi, pi
    pi = 3.141592654 9.869604401
  • the numeric

    LENgth

    option:

    maximum numeric output digits

    without Format option. Includes decimal point but no signs
    • WRITE(LENgth=5) pi, -pi/2, 123, 12345678
    3.142 -1.571 123 124E5
  • Format-picture:

    fill a format template

    :
    • WRITE(T=t3, Fmt="LeftalignedText........ pi= 0.0000 pi^2= 000.00") "Picture format:", pi, pi^2
    Picture format:          pi= 3.1416  pi^2=   9.87
  • CSV

    comma separated variables

    (or other special characters).
    With only 1 special character in Format this becomes the separator between list items
    • WRITE(Format=";") "pi = ", pi, pi^2
    pi =;3.141592654;9.869604401;
  • quote list items

    : 2 identical list item separators in a format string of length 2.
    Apart from ' and " most special characters can work as

    string delimiters

    (here e.g. ~)
    • WRITE(Format=~""~) day, month, year, time
    "29" "October" "2007" "23.59"
  • standard Fortran format

    like the string ("A") and floating point ("F") specifiers
    • WRITE(Fmt="a, f3, f8.4") "pi = ", pi, pi^2
    pi =  3.1  9.8696

Name

[T] For numeric and string variables and array elements include

symbolic names in output list

  • WRITE(Name ) 123, i, pi ! outputs: 123 i=3 PI=3.141592654
  • WRITE(N) text ! outputs: text=... (maximum 100 characters)
options pertinent to

all output media

ItemS

NUM
  • WRITE(ItemS=n) pi, pi*pi, pi^3 ! n is assigned 3

IOStat

NUM ios=stat ! stat gets completion code

ERror

LBL err=999 ! on error jump to label 999
options particular to

screen and print output

DeCoRation

txt
  • WRITE(decor="RA=1") ! write blue border RectAngle, see DeCoRation

Align

txt The following keywords can be combined in the string argument
Left Right Center horizontal Top Bottom Vertical center Word wrap Xpand tabs Single line

  • only the capitals are required, e.g.
    • WRITE(a="CentWr", PoinT=240) "hello world" ! huge letters
  • with the COLumnS option "Pageprompt" and "0" (to clear page) are possible
  • the default is Left+Xpand (+Word wrap for strings with linefeed character)

BaCkcolor

num

ForeColor

num
  • WRITE(Forecol=color_nr) ! e.g. black=0, blue=1, green=2, red=4, etc.
options particular to

file_output options

Rec

num
  • WRITE(file=filename, r=record_number) list ! write to a specific record number. This is for

    non-sequential files only

    , see OPEN

CLoSe

num
  • WRITE(file=filename, close=value) list
  • value=1 closes the file after list is written
  • value=0 keeps the file open
  • value=-1 writes list and truncates a non-sequential file

DELETE

log
  • WRITE(file=filename, delete=n) ! delete if n /= 0, keep if n == 0

FLUsh

log
  • WRITE(file=filename, flush=n) list ! write buffer to disk without close for n /= 0

REName

txt
  • WRITE(file=filename, rename=full_path_new_file_name)
  • filename should not be OPENed
  • This can be far more efficient than to call the command interpreter via SYSTEM
  • Use REName to

    move a file

    :
    • WRITE(file=filename, rename="\other_folder\"//filename)
options particular to

window output options

Column

num
  • WRITE(Column=1/2, Row=0.5) pi ! left adjusted middle of screen
  • Units are for H=0...0.9999 in % screen height
  • for H>1 in character heights of default font nr=1 if no option FONt=nr is noted
  • for H<0 in pixels

Row

num analogous to Column

COLumnS

num
  • ! this short program loops from 0 to 2*pi in steps of pi/100. i, sin(i), cos(i) ) are written to the script window. When the screen bottom is reached, a new column is started. After the 4th column a message suspends further output.
  • DO i = 0, 2*pi, pi/100
  • WRITE(COLumnS=4, FONt="Courier", Format="3f8.3") i, SIN(i), COS(i)
  • ENDDO

FONt

txt
  • WRITE(font="Arial") list ! see Fonts

BolD

[T]
  • WRITE(bold) list ! bold or bold=1: bold font on, bd=0: bold font off

ITalic

[T]
  • WRITE(italic=1) list ! italic or italic=1: italic font on, italic=0: italic font off

UnderLine

[T]
  • WRITE(ulin=val) list ! ulin or ulin=1: underlined font on, ulin=0: underline off

PoinT

num
  • WRITE(point=p) list ! p = font size in points. p=0 will call the font manager

ROTate

num
  • WRITE(Rotate=degrees) list ! rotates font counter clockwise, default is degrees=0. Not with Align option



©2000-2008 Georg Petrich, HicEst Instant Prototype Computing. All rights reserved.
Impressum