home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / rexxit11.zip / Update.cmd < prev    next >
OS/2 REXX Batch file  |  1996-01-27  |  8KB  |  262 lines

  1. /* Update-Programm für Rexxit 1.1 */
  2. /* (C) Richard Sturm 1996         */
  3. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'; call SysLoadFuncs
  4. /* -----------------------------------------------------------------------*/
  5.  
  6. call SysCurState 'OFF'
  7.  
  8. call hinsetzen 'blau'
  9. call vorsetzen 'hellweiß'
  10. call leeren
  11.  
  12. call schreiben 5,10, 'Rexxit 1.1 Update'
  13. call schreiben 6,10, '(C) Richard Sturm 1996'
  14. call schreiben 18, 10, '(For more information see the README file.)'
  15. call schreiben 19,10, '(Weitere Informationen entnehmen sie bitte der README-Datei.)'
  16.  
  17. arg Ursprungs_ini
  18. if Ursprungs_ini = '' then do
  19.    call Vorsetzen 'hellrot'
  20.    call schreiben 11, 10, 'Error: You must drop a v1.0 INI-file onto this program!'
  21.    call schreiben 13, 10, 'Fehler: Sie müssen eine V1.0-INI-Datei abwerfen!'
  22.    return
  23.    end
  24.  
  25. Stelle = lastpos('\', Ursprungs_ini)
  26.  
  27. if left(Ursprungs_ini, 1) = '"'
  28.    then do
  29.       Name = substr(Ursprungs_ini, Stelle + 1, length(Ursprungs_ini) - Stelle - 1)
  30.       Ursprungs_ini = substr(Ursprungs_ini, 2, length(Ursprungs_ini) - 2)
  31.       end
  32.    else do
  33.       Name = substr(Ursprungs_ini, Stelle + 1)
  34.       end
  35.  
  36. Sprache = 'English / Deutsch'
  37.  
  38. select
  39.    when Name = 'MENÜ.INI' | Name = 'MENU.INI' then do
  40.       Ziel_ini = 'Code.ini'
  41.       Sprache = SysIni(Ursprungs_ini, 'Conditions/If', 'IF')
  42.       if Sprache <> 'ERROR:' 
  43.          then Sprache = 'English'
  44.          else Sprache = 'Deutsch'
  45.       end
  46.    when Name = 'SONST.INI' then Ziel_ini = 'Rexxit.ini' 
  47.    otherwise do
  48.       call Vorsetzen 'hellrot'
  49.       call schreiben 11, 10, 'Error: Unknown INI-file!'
  50.       call schreiben 13, 10, 'Fehler: Unbekannte INI-Datei!'
  51.       return
  52.       end
  53.    end
  54.  
  55. Zahl = 10 /* Abstand der Punkte vom linken Rand */
  56.  
  57. call schreiben 11, 10, Name '->' Ziel_ini '('Sprache')'
  58. call Vorsetzen 'hellgelb'
  59.  
  60. call SysIni Ursprungs_ini, 'ALL:', 'Anwendungen'
  61.  
  62. do I = 1 to Anwendungen.0 
  63.    call SysIni Ursprungs_ini, Anwendungen.I, 'ALL:', 'Schluessel'
  64.    do K = 1 to Schluessel.0
  65.       Wert.K = SysIni(Ursprungs_ini, Anwendungen.I, Schluessel.K)
  66.  
  67.       Rc = SysIni(Ziel_ini, Anwendungen.I, Schluessel.K, Wert.K)
  68.       if Rc <> '' then say 'Unknown Error / Unbekannter Fehler!'
  69.  
  70.       call Punkte
  71.       end
  72.    end
  73.  
  74. if Ziel_ini = 'Code.ini' then do
  75.  
  76.    if Sprache = 'English' then do
  77.       call SysIni Ziel_ini, 'Functions/API-Functions', 'RXFUNCADD', 'rxfuncadd()'
  78.       call Punkte
  79.       call SysIni Ziel_ini, 'Functions/API-Functions', 'RXFUNCDROP', 'rxfuncdrop()'
  80.       call Punkte
  81.       call SysIni Ziel_ini, 'Functions/API-Functions', 'RXFUNCQUERY', 'rxfuncquery()'
  82.       call Punkte
  83.       call SysIni Ziel_ini, 'Functions/API-Functions', 'RXQUEUE GET', 'rxqueue("Get" newqueue)'
  84.       call Punkte
  85.       call SysIni Ziel_ini, 'Functions/API-Functions', 'RXQUEUE SET', 'rxqueue("Set" newqueue)'
  86.       call Punkte
  87.       call SysIni Ziel_ini, 'Functions/API-Functions', 'RXQUEUE DELETE', 'rxqueue("Delete" queue)'
  88.       call Punkte
  89.       call SysIni Ziel_ini, 'Functions/API-Functions', 'RXQUEUE CREATE', 'rxqueue("Create" [, queue])'
  90.  
  91.       end
  92.    else do
  93.       call SysIni Ziel_ini, 'Funktionen/API-Funktionen', 'RXFUNCADD', 'rxfuncadd()'
  94.       call Punkte
  95.       call SysIni Ziel_ini, 'Funktionen/API-Funktionen', 'RXFUNCDROP', 'rxfuncdrop()'
  96.       call Punkte
  97.       call SysIni Ziel_ini, 'Funktionen/API-Funktionen', 'RXFUNCQUERY', 'rxfuncquery()'
  98.       call Punkte
  99.       call SysIni Ziel_ini, 'Funktionen/API-Funktionen', 'RXQUEUE GET', 'rxqueue("Get" neuwschlname)'
  100.       call Punkte
  101.       call SysIni Ziel_ini, 'Funktionen/API-Funktionen', 'RXQUEUE SET', 'rxqueue("Set" neuwschlname)'
  102.       call Punkte
  103.       call SysIni Ziel_ini, 'Funktionen/API-Funktionen', 'RXQUEUE DELETE', 'rxqueue("Delete" wschlname)'
  104.       call Punkte
  105.       call SysIni Ziel_ini, 'Funktionen/API-Funktionen', 'RXQUEUE CREATE', 'rxqueue("Create" [, wschlname])'
  106.       call Punkte
  107.       end
  108.    end
  109.  
  110. call leeren
  111. call vorsetzen 'hellweiß'
  112. call schreiben 12, 35, 'Done / Fertig'
  113.  
  114. return
  115.  
  116. punkte:
  117. if Zahl = 71 then do
  118.    Zahl = 10
  119.    call schreiben 13, 10, copies(' ', 70)
  120.    end
  121. call schreiben 13, Zahl, '.'
  122. Zahl = Zahl + 1
  123.  
  124. return
  125.  
  126. /* ANSI-Schale für Textbildschirm */ 
  127.  
  128. /* Lesen von Zeichen ab einer Bildschirmposition */
  129. Lesen: procedure /*************************************/
  130. parse arg Zeile, Spalte
  131. Esc = '1B'x
  132. select
  133.    when arg() = 0 then
  134.       nop
  135.    when arg() = 2 then
  136.       call charout , Esc || '['Zeile';'Spalte'H'
  137.    otherwise do
  138.       say 'FEHLER: Lesen benötigt entweder 0 oder 2 Argumente!'
  139.       exit
  140.       end
  141.    end
  142. parse pull S
  143. return S
  144.  
  145. /* Schreiben von Zeichen ab einer Bildschirmposition */
  146. Schreiben: procedure /*********************************/
  147. parse arg Zeile, Spalte, Text
  148. Esc = '1B'x
  149. select
  150.    when arg() = 1 then
  151.       call charout , Zeile
  152.    when arg() = 2 then
  153.       call charout , Esc || '['Zeile';'Spalte'H'
  154.    when arg() = 3 then
  155.       call charout , Esc || '['Zeile';'Spalte'H'Text
  156.    otherwise do
  157.       say 'FEHLER: Schreiben benötigt 1, 2 oder 3 Argumente!'
  158.       exit
  159.       end
  160.    end
  161. return
  162.  
  163. /* Setzen der VORdergrundfarbe */
  164. Vorsetzen: procedure expose Vordergrundcode Hintergrundcode /**********/
  165. arg Farbe
  166. Esc = '1B'x
  167. select
  168.    when pos('GEHEIM', Farbe)  > 0 then C = 8
  169.    when pos('SCHWARZ', Farbe) > 0 then C = 30
  170.    when pos('ROT', Farbe)     > 0 then C = 31
  171.    when pos('GRüN', Farbe)    > 0 then C = 32
  172.    when pos('GELB', Farbe)    > 0 then C = 33
  173.    when pos('BLAU', Farbe)    > 0 then C = 34
  174.    when pos('MAGENTA', Farbe) > 0 then C = 35
  175.    when pos('CYAN', Farbe)    > 0 then C = 36
  176.    when pos('WEIß', Farbe)    > 0 then C = 37
  177.    otherwise do
  178.       say 'FEHLER: Farbe ungültig für Vordergrund!'
  179.       exit
  180.       end
  181.    end
  182. if left(Farbe, 4) = 'HELL'
  183.    then
  184.       C = '1;'C
  185.    else do
  186.       call charout , Esc || '[0m'
  187.       if left(Hintergrundcode,1) = Esc then
  188.          call charout , Hintergrundcode
  189.       end
  190. Vordergrundcode = Esc || '['C'm'
  191. call charout , Vordergrundcode
  192. return
  193.  
  194. /* Setzen der HINtergrundfarbe */
  195. Hinsetzen: procedure expose Vordergrundcode Hintergrundcode /**********/
  196. arg Farbe
  197. Esc = '1B'x
  198. select
  199.    when pos('SCHWARZ', Farbe) > 0 then C = 40
  200.    when pos('ROT', Farbe)     > 0 then C = 41
  201.    when pos('GRüN', Farbe)    > 0 then C = 42
  202.    when pos('GELB', Farbe)    > 0 then C = 43
  203.    when pos('BLAU', Farbe)    > 0 then C = 44
  204.    when pos('MAGENTA', Farbe) > 0 then C = 45
  205.    when pos('CYAN', Farbe)    > 0 then C = 46
  206.    when pos('WEIß', Farbe)    > 0 then C = 47
  207.    otherwise do
  208.       say 'FEHLER: Farbe ungültig für Hintergrund!'
  209.       exit
  210.       end
  211.    end
  212. if left(Farbe, 4) = 'HELL'
  213.    then
  214.       C = '5;'C
  215.    else do
  216.       call charout , Esc || '[0m'
  217.       if left(Vordergrundcode,1) = Esc then
  218.          call charout , Vordergrundcode
  219.       end
  220. Hintergrundcode = Esc || '['C'm'
  221. call charout , Hintergrundcode
  222. return
  223.  
  224. /* Setzen, ob automatischer ZeilenUMbruch */
  225. Umsetzen: procedure /**********************************/
  226. arg Modus
  227. Esc = '1B'x
  228. select
  229.    when Modus = 'aus' then
  230.       Modus = 'h'
  231.    when Modus = 'ein' then
  232.       Modus = 'l'
  233.    otherwise do
  234.       say "FEHLER: Autom. Zeilenumbruch nur 'ein' oder 'aus'!"
  235.       exit
  236.       end
  237.    end
  238. call charout , Esc || '[=3h' || Esc || '[=7' || Modus
  239. return
  240.  
  241. /* Löschen des Bildschirms bzw. Zeilenrests */
  242. Leeren: procedure /************************************/
  243. arg Parm
  244. Esc = '1B'x
  245. select
  246.    when Parm = '' then
  247.       call charout , Esc || '[2J'
  248.    when Parm = 'REST' then
  249.       call charout , Esc || '[K'
  250.    otherwise do
  251.       say 'FEHLER: Angabe ungültig für Leeren!'
  252.       exit
  253.       end
  254.    end
  255. return
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.