home *** CD-ROM | disk | FTP | other *** search
/ CICA 1994 September / CICA_Shareware_for_Windows_Walnut_Creek_September_1994.iso / win3 / desktop / sh93v100.lzh / XLTAB2 < prev    next >
Text File  |  1993-09-12  |  3KB  |  129 lines

  1. # excel tabellier programm V2
  2. #
  3. #    F3    startet Dialog und Tabellierung
  4. #
  5. #    Werfen Sie einen Blick in die get_range() Funktion, sie eignet
  6. #    sich gut als Bibliotheksfunktion.
  7. #
  8. #    Das Programm sollte sich ohne großen Aufwand auf andere
  9. #    Tabellenkalkulationen portieren lassen.
  10. #    Setzen Sie dazu remoteDDE (BEGIN Section) auf den richtigen Wert
  11. #    und ändern Sie die Belegung der shift+F2 Taste.
  12. #
  13.  
  14. FUNCTION get_range(range) {
  15.     local    file, top, bottom, left, right, x
  16.  
  17.     if (index(range, "!") == 0)
  18.         return (1);
  19.     else
  20.         file = substr(range, 1, rstart-1);
  21.  
  22.     x = substr(range, rstart+1);            # ZaSb:ZcSd
  23.     top = substr(x, 2) + 0;
  24.     if (index(x, "S") == 0)
  25.         return (1);
  26.     else
  27.         left = substr(x, rstart+1) + 0
  28.  
  29.     if (index(x, ":") == 0) {
  30.         bottom = top;
  31.         right = left;
  32.         return (0);
  33.         }
  34.  
  35.     x = substr(x, rstart+1)             # ZcSd
  36.     bottom = substr(x, 2) + 0
  37.     if (index(x, "S") == 0)
  38.         return (1);
  39.     else
  40.         right = substr(x, rstart+1) + 0
  41.  
  42.     return (0)
  43.     }
  44.  
  45.  
  46.  
  47. BEGIN {
  48.     ctrl(2, "Excel Tabellierer V2", 1, 4, 113)
  49.     close("") |: status()
  50.     DDEservice = "xltab"
  51.  
  52.     remoteDDE  = "excel|"
  53.     remoteSYS  = "excel|system"
  54.     SYS       = remoteSYS "!"
  55.     SEL       = SYS "selection"
  56.     MACROLIB   = "xltab.xlm"
  57.     MACROFILE  = shellpath "\\" MACROLIB
  58.  
  59. # excel und makrodatei laden
  60. #
  61.     if (getmod("excel") == 0) {
  62.         status("excel wird gestartet ...")
  63.         exec("excel " MACROFILE, 1)
  64.         }
  65.     else {
  66.         if (index((SYS "topics" | get) |: strlwr(), "\t" MACROFILE "\t") == 0) {
  67.             status (file " wird geöffnet ...")
  68.             cmd = "[open(\"" & MACROFILE & "\")]"
  69.             cmd | remoteSYS
  70.             }
  71.         }
  72.     }
  73.  
  74.  
  75. #
  76. # excel dialog starten
  77. #
  78.  
  79. /F3 "dialog"/ {
  80.     ctrl(1)
  81.     "[App.Activate(,0)]"          | remoteSYS
  82.     "[Run(\"" MACROLIB "!dialog1\")]" | remoteSYS
  83.     }
  84.  
  85.  
  86. #
  87. # F3 dialog ruft zurück
  88. #
  89.  
  90. /? xyTAB data/ {
  91.     DDEoutput = "Hello World!"
  92.     }
  93.  
  94. /| xyTAB data/ {
  95.     beep();
  96.     n = split(DDEinput, data, "\r\n");
  97.  
  98.     variabel = data[0]
  99.     ergebnis = data[1]
  100.     eingabe  = data[2]
  101.     ausgabe  = data[3]
  102.  
  103.     enter("xyTAB")
  104.     }
  105.  
  106. /user xyTAB/ {
  107.     thistext = WINtext;
  108.     ctrl("tabulating ...");
  109.  
  110.     get_range(ausgabe)
  111.     outF = get_range["file"] "!"
  112.     outZ = get_range["top"];
  113.     outS = get_range["left"];
  114.  
  115.     get_range(eingabe)
  116.     varF = get_range["file"] "!"    # Achtung !
  117.     varZ = get_range["top"] + 0;    #    die Werte sind Strings!
  118.     varS = get_range["left"];    #
  119.     end  = get_range["bottom"] + 0;
  120.  
  121.     for (; varZ <= end; outZ++, varZ++) {
  122.         (remoteDDE varF "Z" varZ "S" varS) | get x
  123.         status(x);
  124.         y = x | remoteDDE variabel : ergebnis | (remoteDDE outF "Z" outZ "S" outS);
  125.         }
  126.  
  127.     ctrl(thistext);
  128.     }
  129.