///////////////////////////////////////////////////////////////// // File: TAPtoTPX.cs // // Contents: // A sample script that converts a TinyTERM version 3.3 .TAP // connection file to a TinyTERM version 4.04 .TPX file. // See the file TAPtoTPX.wri for complete documentation. // // Originated by P. Clark, Century Software 4/28/99 // Last modified 9/22/99 ///////////////////////////////////////////////////////////////// //////////////////////// // Function declaration //////////////////////// function WriteVal(Section,Key,Value) { // Switches files, writes a value and switches back IniSync("",0); IniSetFile(TpxFile); IniSetStr(Section,Key,Value); IniSync("",0); IniSetFile(TapFile); } function OnOff(TpxSec,TpxK,TapVal) { // Converts OFF-ON values to 0-1. Calls WriteVal if(TapVal == "OFF") { TpxVal = "0"; } else { TpxVal = "1"; } WriteVal(TpxSec,TpxK,TpxVal); } function ColorSet(TpxSec,TpxK,TapVal,Pos) { // Sets color values for text attributes. Calls WriteVal TpxVal = _str(_val(Field(TapVal,Pos,_asc(","))) + 1); WriteVal(TpxSec,TpxK,TpxVal); } function Itemize(TpxSec,TpxK,TapVal,HiVal) { // Converts a TAP text value to a TPX numeric value. Calls WriteVal LoopCount = 0; while (LoopCount < HiVal) { if (aray[LoopCount] == TapVal) { TpxVal = _str(LoopCount); } LoopCount = LoopCount + 1; } WriteVal(TpxSec,TpxK,TpxVal); } //////////////////////// // Variable declaration //////////////////////// var sdir; var TempTpx; var NewTpx; var TTparams; var TTfullpath; var TTEXE; var TapFile; var TpxFile; var TpxSection; var TpxKey; var TpxValue; var TapValue; var LoopCount; var aray; aray = DimStr(19); /////////////////////// // Create new TPX file /////////////////////// // Generate new default.tpx sdir = GetSysDir(); TempTpx = Fconcat(sdir,"default","tpx"); NewTpx = Fconcat(sdir,"nbbm","tpx"); if (exists(TempTpx)) { copy(TempTpx,NewTpx); } TTEXE = "tt.exe"; TTfullpath = sdir + "\\" + TTEXE; // It's safest to quote the path (long file names), but the "spawn" command won't allow it. TTparams = "/mkdef /nosplash"; te.displaynl(ttfullpath + ", " + TTEXE + " " + TTparams); spawn(1, ttfullpath, TTEXE + " " + TTparams); // Run TT, nowait (there is a bug if we wait) // Locate the .TAP file to translate TapFile = StdOpen("C:\\","tap files|*.tap|","tap","Locate TAP File to Translate"); if (len(TapFile) == 0) { te.displaynl("Conversion cancelled"); return; } IniSetFile(TapFile); // Rename default.tpx to TAP name and restore original default.tpx TpxFile = Fconcat(sdir,Fhead(TapFile),"tpx"); copy(TempTpx,TpxFile); if (exists(NewTpx)) { copy(NewTpx,TempTpx); erase(NewTpx); } te.display("Converting "); te.display(TapFile); te.display(" to "); te.displaynl(TpxFile); //////////////////////////////////////////////////////// // Configure the emulation section of the new .TPX file //////////////////////////////////////////////////////// TpxSection = "term.emu"; // Emulation aray[0] = "ADM1"; aray[1] = "ANSI"; aray[2] = "AT386"; aray[3] = "IBM3101"; aray[4] = "PCTERM"; aray[5] = "SCOANSI"; aray[6] = "TTY"; aray[7] = "TV912"; aray[8] = "TV925"; aray[9] = "TV950"; aray[10] = "VT100"; aray[11] = "VT102"; aray[12] = "VT220"; aray[13] = "VT220-7"; aray[14] = "VT320"; aray[15] = "VT320-7"; aray[16] = "WYSE50"; aray[17] = "WYSE60"; aray[18] = "WYSE60-25"; TpxKey = "emulate"; TapValue = _toUpperC(IniGetStr("default.con","emulate","SCOANSI")); if (TapValue == "VT52") { // TinyTERM 4.x has no VT52 or IBM3151 support TpxValue = "10"; WriteVal(TpxSection,TpxKey,TpxValue); } else if (left(TapValue,7) == "IBM3151") { TpxValue = "3"; WriteVal(TpxSection,TpxKey,TpxValue); } else { Itemize(TpxSection,TpxKey,TapValue,19); } // Colors TpxKey = "colorfg0"; TapValue = IniGetStr("term.sys","default","15,2"); ColorSet(TpxSection,TpxKey,TapValue,1); TpxKey = "colorbg0"; ColorSet(TpxSection,TpxKey,TapValue,2); TpxKey = "colorfg1"; TapValue = IniGetStr("term.sys","reverse","-1,-1"); ColorSet(TpxSection,TpxKey,TapValue,2); TpxKey = "colorbg1"; ColorSet(TpxSection,TpxKey,TapValue,1); TpxKey = "colorfg2"; TapValue = IniGetStr("term.sys","blink","-1,-1"); ColorSet(TpxSection,TpxKey,TapValue,1); TpxKey = "colorbg2"; ColorSet(TpxSection,TpxKey,TapValue,2); TpxKey = "colorfg3"; TapValue = IniGetStr("term.sys","underline","-1,-1"); ColorSet(TpxSection,TpxKey,TapValue,1); TpxKey = "colorbg3"; ColorSet(TpxSection,TpxKey,TapValue,2); TpxKey = "colorfg4"; TapValue = IniGetStr("term.sys","bold","-1,-1"); ColorSet(TpxSection,TpxKey,TapValue,1); TpxKey = "colorbg4"; ColorSet(TpxSection,TpxKey,TapValue,2); TpxKey = "colorfg5"; TapValue = IniGetStr("term.sys","revbl","-1,-1"); ColorSet(TpxSection,TpxKey,TapValue,2); TpxKey = "colorbg5"; ColorSet(TpxSection,TpxKey,TapValue,1); TpxKey = "colorfg6"; TapValue = IniGetStr("term.sys","revul","-1,-1"); ColorSet(TpxSection,TpxKey,TapValue,2); TpxKey = "colorbg6"; ColorSet(TpxSection,TpxKey,TapValue,1); TpxKey = "colorfg7"; TapValue = IniGetStr("term.sys","revbold","-1,-1"); ColorSet(TpxSection,TpxKey,TapValue,2); TpxKey = "colorbg7"; ColorSet(TpxSection,TpxKey,TapValue,1); TpxKey = "colorfg8"; TapValue = IniGetStr("term.sys","blul","-1,-1"); ColorSet(TpxSection,TpxKey,TapValue,1); TpxKey = "colorbg8"; ColorSet(TpxSection,TpxKey,TapValue,2); TpxKey = "colorfg9"; TapValue = IniGetStr("term.sys","blbold","-1,-1"); ColorSet(TpxSection,TpxKey,TapValue,1); TpxKey = "colorbg9"; ColorSet(TpxSection,TpxKey,TapValue,2); TpxKey = "colorfg10"; TapValue = IniGetStr("term.sys","ulbold","-1,-1"); ColorSet(TpxSection,TpxKey,TapValue,1); TpxKey = "colorbg10"; ColorSet(TpxSection,TpxKey,TapValue,2); TpxKey = "colorfg11"; TapValue = IniGetStr("term.sys","revblul","-1,-1"); ColorSet(TpxSection,TpxKey,TapValue,2); TpxKey = "colorbg11"; ColorSet(TpxSection,TpxKey,TapValue,1); TpxKey = "colorfg12"; TapValue = IniGetStr("term.sys","revblbold","-1,-1"); ColorSet(TpxSection,TpxKey,TapValue,2); TpxKey = "colorbg12"; ColorSet(TpxSection,TpxKey,TapValue,1); TpxKey = "colorfg13"; TapValue = IniGetStr("term.sys","revulbold","-1,-1"); ColorSet(TpxSection,TpxKey,TapValue,2); TpxKey = "colorbg13"; ColorSet(TpxSection,TpxKey,TapValue,1); TpxKey = "colorfg14"; TapValue = IniGetStr("term.sys","blulbold","-1,-1"); ColorSet(TpxSection,TpxKey,TapValue,1); TpxKey = "colorbg14"; ColorSet(TpxSection,TpxKey,TapValue,2); TpxKey = "colorfg15"; TapValue = IniGetStr("term.sys","revblulbold","-1,-1"); ColorSet(TpxSection,TpxKey,TapValue,2); TpxKey = "colorbg15"; ColorSet(TpxSection,TpxKey,TapValue,1); // Cursor aray[0] = "BLOCK"; aray[1] = "SOLIDBLOCK"; aray[2] = "LINE"; aray[3] = "SOLIDLINE"; TpxKey = "cursor"; TapValue = _toUpperC(IniGetStr("default.con","cursor","LINE")); Itemize(TpxSection,TpxKey,TapValue,4); // Columns and scrollback TpxKey = "col"; TapValue = IniGetStr("general","emulsize","25,80"); TpxValue = Field(TapValue,2,_asc(",")); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "scrollback"; TpxValue = IniGetStr("term.sys","scrollback","999"); WriteVal(TpxSection,TpxKey,TpxValue); // WRU information TpxKey = "wru"; TpxValue = IniGetStr("default.con","wru",""); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "wruchar"; TpxValue = IniGetStr("term.sys","wruchar",""); WriteVal(TpxSection,TpxKey,TpxValue); // Duplex mode aray[0] = "FULL"; aray[1] = "HALF"; aray[2] = "MNEMONIC"; aray[3] = "CONTROL"; TpxKey = "mode"; TapValue = _toUpperC(IniGetStr("default.con","mode","FULL")); if (TapValue == "DUMP") { // TinyTERM 4.x has no DUMP support TpxValue = "0"; } else { Itemize(TpxSection,TpxKey,TapValue,4); } // Numlock and tdelay TpxKey = "numlock"; TapValue = _toUpperC(IniGetStr("term.sys","numlock","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "tdelay"; TpxValue = IniGetStr("term.sys","tdelay","0"); WriteVal(TpxSection,TpxKey,TpxValue); // Logging information TpxKey = "logfile"; TpxValue = IniGetStr("term.sys","logfile","term#.log"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "log"; TapValue = _toUpperC(IniGetStr("term.sys","log","ON")); OnOff(TpxSection,TpxKey,TapValue); // Login information TpxKey = "loginscheme"; TapValue = _toUpperC(IniGetStr("general","loginscheme","UNIX")); if (TapValue == "COMPUSERVE") { TpxValue = "CompuServe"; } else { TpxValue = "UNIX Password"; } WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "logout"; TpxValue = IniGetStr("default.con","logout","^L03^T05^Mexit^M^Slogin:^S"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "user"; TpxValue = IniGetStr("default.con","user",""); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "password"; TpxValue = IniGetStr("default.con","password",""); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "view"; TapValue = _toUpperC(IniGetStr("term.sys","view","OFF")); OnOff(TpxSection,TpxKey,TapValue); // Exit switches TpxKey = "exitdisc"; TapValue = _toUpperC(IniGetStr("term.sys","exitdisc","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "exitdtr"; TapValue = _toUpperC(IniGetStr("term.sys","exitdtr","OFF")); OnOff(TpxSection,TpxKey,TapValue); // Data capture and print settings aray[0] = "PRTMGR"; aray[1] = "DISK"; aray[2] = "DEVICE"; TpxKey = "capType"; TapValue = _toUpperC(IniGetStr("term.sys","captmethod","DISK")); Itemize(TpxSection,TpxKey,TapValue,3); TpxKey = "capdev"; TpxValue = IniGetStr("term.sys","capture","capt#.fil"); WriteVal(TpxSection,TpxKey,TpxValue); aray[0] = "DEVICE"; aray[1] = "PRTMGR"; aray[2] = "NONE"; TpxKey = "prntype"; TapValue = _toUpperC(IniGetStr("term.sys","printmethod","DEVICE")); TpxValue = "0"; Itemize(TpxSection,TpxKey,TapValue,3); TpxKey = "prndev"; TpxValue = Field(IniGetStr("term.sys","printer","lpt1:"),1,_asc("(")); WriteVal(TpxSection,TpxKey,TpxValue); // Assorted emulation settings TpxKey = "termid"; TpxValue = IniGetStr("term.sys","termid",""); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "lines"; TapValue = IniGetStr("general","emulsize","25,80"); TpxValue = Field(TapValue,1,_asc(",")); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "TurnChar"; TpxValue = IniGetStr("term.sys","turnchar",""); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "extend"; TapValue = _toUpperC(IniGetStr("term.sys","extend","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "blockmode"; TapValue = _toUpperC(IniGetStr("term.sys","blockmode","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "colornum"; TpxValue = IniGetStr("term.sys","colornumber","16"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "addcr"; TapValue = _toUpperC(IniGetStr("term.sys","addcr","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "addlf"; TapValue = _toUpperC(IniGetStr("term.sys","addlf","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "wrap"; TapValue = _toUpperC(IniGetStr("default.con","wrap","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "bsdel"; TapValue = _toUpperC(IniGetStr("default.con","bsdel","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "destbs"; TapValue = _toUpperC(IniGetStr("term.sys","destbs","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "pages"; TpxValue = IniGetStr("term.sys","pages","1"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "maskpar"; TapValue = _toUpperC(IniGetStr("term.sys","maskpar","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "custsize"; TapValue = IniGetStr("general","emulsize","25,80"); if ((TapValue == "25,80") || (TapValue == "24,80")) { TpxValue = "0"; } else { TpxValue = "1"; } WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "KeybSchemeID"; TapValue = IniGetStr("keyboard","name",""); if (len(TapValue) == 0) { TpxValue = "Default"; } else { TpxValue = TapValue; } WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "loginschstr"; TpxValue = IniGetStr("default.con","login","^L03^T05^M^Sogin:^S^W^U^M^Sassword:^S^W^P^M"); WriteVal(TpxSection,TpxKey,TpxValue); //////////////////////////////////////////////////////////// // Configure the file transfer section of the new .TPX file //////////////////////////////////////////////////////////// TpxSection = "term.ft"; // Transfer protocol aray[0] = "TERMCRC"; aray[1] = "WTERMCRC"; aray[2] = "FTP"; aray[3] = "XMODEM"; aray[4] = "XMODEM-CRC"; aray[5] = "YMODEM"; aray[6] = "ZMODEM"; aray[7] = "KERMIT"; aray[8] = "ASCII"; aray[9] = "LINE"; TpxKey = "xprot"; TapValue = _toUpperC(IniGetStr("default.con","xprot","FTP")); Itemize(TpxSection,TpxKey,TapValue,10); // Start and stop server strings TpxKey = "startserver"; TpxValue = IniGetStr("default.con","startserver","^L03^T10^C^X^X^X^X^X^H^H^H^H^H^H^Mterm -x^M ^SOK^M^J^S^R00|^Slogin:^S^R01"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "stopserver"; TpxValue = IniGetStr("default.con","stopserver","^L03^T05^C^X^X^X^X^X^M^S$^^S^R00|^S#^S^R00|^S%^S^R00|^Slogin:^S^R00"); WriteVal(TpxSection,TpxKey,TpxValue); // Failed transfer settings TpxKey = "restart"; TpxValue = IniGetStr("term.sys","restart","0"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "retries"; TpxValue = IniGetStr("term.sys","retries","10"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "rtime"; TpxValue = IniGetStr("term.sys","rtime","8"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "stime"; TpxValue = IniGetStr("term.sys","stime","20"); WriteVal(TpxSection,TpxKey,TpxValue); // Assorted file transfer switches and values TpxKey = "addefo"; // This is the correct spelling TapValue = _toUpperC(IniGetStr("term.sys","addeof","ON")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "fileconv"; TapValue = _toUpperC(IniGetStr("term.sys","fileconv","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "toupper"; TapValue = _toUpperC(IniGetStr("term.sys","toupper","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "altchk"; TapValue = _toUpperC(IniGetStr("term.sys","altchk","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "esc8bit"; TapValue = _toUpperC(IniGetStr("term.sys","esc8bit","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "txblksiz"; TpxValue = IniGetStr("term.sys","txblksiz","16384"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "txwindow"; TpxValue = IniGetStr("term.sys","txwindow","16384"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "flags"; TpxValue = IniGetStr("term.sys","flags",""); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "rcvsync"; TpxValue = IniGetStr("term.sys","rcvsync","0"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "xferack"; TapValue = _toUpperC(IniGetStr("term.sys","xferack","ON")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "xferstat"; TapValue = _toUpperC(IniGetStr("term.sys","xferstat","ON")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "control"; TapValue = _toUpperC(IniGetStr("term.sys","control","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "compress"; TapValue = _toUpperC(IniGetStr("term.sys","compress","ON")); OnOff(TpxSection,TpxKey,TapValue); // Kermit-specific settings TpxKey = "kermecho"; TapValue = _toUpperC(IniGetStr("term.sys","kermecho","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "kermeol"; TpxValue = IniGetStr("term.sys","kermiteol","13"); WriteVal(TpxSection,TpxKey,TpxValue); // More file transfer settings TpxKey = "hiwait"; TpxValue = IniGetStr("term.sys","hiwait","1"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "htime"; TpxValue = IniGetStr("term.sys","htime","11"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "itime"; TpxValue = IniGetStr("term.sys","itime","0"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "lchar"; TpxValue = IniGetStr("term.sys","lchar","10"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "ldelay"; TpxValue = IniGetStr("term.sys","ldelay","0"); WriteVal(TpxSection,TpxKey,TpxValue); // Email-specific settings (TinyTERM 4.x has no email support, but the settings are there) TpxKey = "emailaddr"; TpxValue = IniGetStr("term.sys","emailaddr",""); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "emailsubj"; TpxValue = IniGetStr("term.sys","emailsubj",""); WriteVal(TpxSection,TpxKey,TpxValue); // FTP-specific settings TpxKey = "ftphost"; TpxValue = IniGetStr("term.sys","ftphost",""); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "ftpuser"; TpxValue = IniGetStr("term.sys","ftpuser",""); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "ftppass"; TpxValue = IniGetStr("term.sys","ftppass",""); WriteVal(TpxSection,TpxKey,TpxValue); // Additional file transfer settings TpxKey = "fillchar"; TpxValue = IniGetStr("term.sys","fillchar",""); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "XferDisc"; TapValue = _toUpperC(IniGetStr("general","ftclose","ON")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "PostXFRScpt"; TpxValue = ""; TapValue = IniGetStr("general","postcmd",""); if (TpxValue != TapValue) { TpxValue = Fconcat(sdir,Fhead(TapValue),"cs"); } WriteVal(TpxSection,TpxKey,TpxValue); //////////////////////////////////////////////////////////// // Configure the communication section of the new .TPX file //////////////////////////////////////////////////////////// TpxSection = "term.comm"; // Node TpxKey = "node"; TapValue = IniGetStr("default.con","node",""); if ((left(TapValue,1) == "T") && (IniGetStr("default.con","port","") == "TAPI")) { TpxValue = field(TapValue,1,_asc(";")); TpxValue = right(TpxValue,len(TpxValue)-1); } else { TpxValue = TapValue; } WriteVal(TpxSection,TpxKey,TpxValue); // Miscellaneous comm settings TpxKey = "port"; TapValue = IniGetStr("term.sys","netport","23"); if (_val(TapValue) < 1) { TpxValue = "23"; } else { TpxValue = TapValue; } WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "cdelay"; TpxValue = IniGetStr("term.sys","cdelay","0"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "retries"; TpxValue = IniGetStr("term.sys","retries","3"); WriteVal(TpxSection,TpxKey,TpxValue); // Communications type aray[0] = "TEL"; // telnet aray[1] = "COM"; // serial aray[2] = "RLO"; // rlogin aray[3] = "TAP"; // tapi aray[4] = "NON"; // none TpxKey = "commtype"; TapValue = _toUpperC(IniGetStr("default.con","port","TELNET")); LoopCount = 0; while (LoopCount < 5) { if (aray[LoopCount] == left(TapValue,3)) { TpxValue = _str(LoopCount); } LoopCount = LoopCount + 1; } WriteVal(TpxSection,TpxKey,TpxValue); // Asynchronous settings TpxKey = "baud"; TpxValue = IniGetStr("default.con","baud","19200"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "stopbits"; TpxValue = IniGetStr("default.con","stopbits","1"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "wordlen"; TpxValue = IniGetStr("default.con","wordlen","8"); WriteVal(TpxSection,TpxKey,TpxValue); // Parity aray[0] = "NONE"; aray[1] = "ODD"; aray[2] = "EVEN"; aray[3] = "MARK"; aray[4] = "SPACE"; TpxKey = "parity"; TapValue = _toUpperC(IniGetStr("default.con","parity","NONE")); Itemize(TpxSection,TpxKey,TapValue,5); // XON and XOFF TpxKey = "xon"; TapValue = IniGetStr("term.sys","xonxoff","17,19"); TpxValue = Field(TapValue,1,_asc(",")); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "xoff"; TpxValue = Field(TapValue,2,_asc(",")); WriteVal(TpxSection,TpxKey,TpxValue); // DDTR and close on disconnect TpxKey = "ddtr"; TapValue = _toUpperC(IniGetStr("term.sys","ddtr","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "closedisc"; TapValue = _toUpperC(IniGetStr("term.sys","exitdisc","OFF")); OnOff(TpxSection,TpxKey,TapValue); // COM port TpxKey = "ComPort"; TapValue = _toUpperC(IniGetStr("default.con","port","COM1")); if ((_asc(midstr(TapValue,4,1)) < 1) || (_asc(midstr(TapValue,4,1)) > 6)) { TpxValue = "1"; } else { TpxValue = midstr(TapValue,4,1); } WriteVal(TpxSection,TpxKey,TpxValue); // RLOGIN network port TpxKey = "RloginPort"; TapValue = IniGetStr("term.sys","netport","513"); if (TapValue == "23") { TpxValue = "513"; } else { TpxValue = TapValue; } WriteVal(TpxSection,TpxKey,TpxValue); ////////////////////////////////////////////////////// // Configure the general section of the new .TPX file ////////////////////////////////////////////////////// TpxSection = "term.gen"; // Miscellaneous settings TpxKey = "editor"; TpxValue = IniGetStr("term.sys","editor","notepad.exe"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "remark"; TpxValue = IniGetStr("default.con","remark","Converted TAP File"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "macro"; TapValue = _toUpperC(IniGetStr("general","macro","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "sessionbar"; TapValue = _toUpperC(IniGetStr("general","session","ON")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "menubar"; TapValue = _toUpperC(IniGetStr("general","menubar","ON")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "ribbon"; TapValue = _toUpperC(IniGetStr("general","ribbon","ON")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "splash"; TapValue = _toUpperC(IniGetStr("general","splash","ON")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "altkeys"; TapValue = _toUpperC(IniGetStr("term.sys","altkeys","OFF")); OnOff(TpxSection,TpxKey,TapValue); // Tooltips TpxKey = "tooltips"; TapValue = IniGetStr("term.sys","tooltips","750"); if (_val(TapValue) == 0) { TpxValue = "0"; } else { TpxValue = "1"; } WriteVal(TpxSection,TpxKey,TpxValue); // Protection TpxKey = "protect"; TpxValue = IniGetStr("general","protect","0"); WriteVal(TpxSection,TpxKey,TpxValue); // DDE server settings (DDE is not enabled in TinyTERM 4.x, but the settings are there) TpxKey = "ddeenable"; TapValue = _toUpperC(IniGetStr("term.sys","dde","ON")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "ddetimeout"; TpxValue = IniGetStr("term.sys","ddetimeout",""); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "ddename"; TpxValue = IniGetStr("term.sys","ddename",""); WriteVal(TpxSection,TpxKey,TpxValue); // Hostmode settings (Hostmode is not enabled in TinyTERM 4.x, but the settings are there) TpxKey = "requirelogin"; TapValue = _toUpperC(IniGetStr("general","requirelogin","ON")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "allownewuser"; TapValue = _toUpperC(IniGetStr("general","allownewuser","ON")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "allowxfer"; TapValue = _toUpperC(IniGetStr("general","allowxfer","ON")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "allowchat"; TapValue = _toUpperC(IniGetStr("general","allowchat","ON")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "banner"; TpxValue = IniGetStr("general","banner","banner.txt"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "motd"; TpxValue = IniGetStr("general","motd","motd.txt"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "autoanswer"; TapValue = _toUpperC(IniGetStr("general","autoanswer","OFF")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "autobaud"; TapValue = _toUpperC(IniGetStr("general","autobaud","ON")); OnOff(TpxSection,TpxKey,TapValue); TpxKey = "portnum"; TpxValue = IniGetStr("general","portnum","23"); WriteVal(TpxSection,TpxKey,TpxValue); // File information TpxKey = "author"; TpxValue = IniGetStr("general","author","author"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "date"; TpxValue = IniGetStr("general","date","date"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "subject"; TpxValue = IniGetStr("general","subject","subject"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "version"; TpxValue = IniGetStr("general","version","version"); WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "email"; TpxValue = IniGetStr("general","email","email"); WriteVal(TpxSection,TpxKey,TpxValue); // Save settings on exit aray[0] = "YES"; aray[1] = "NO"; aray[2] = "PROMPT"; TpxKey = "SaveType"; TapValue = _toUpperC(IniGetStr("general","exitsave","PROMPT")); Itemize(TpxSection,TpxKey,TapValue,3); // Errbox TpxKey = "errbox"; TapValue = _toUpperC(IniGetStr("term.sys","errbox","ON")); OnOff(TpxSection,TpxKey,TapValue); // Assorted event-driven scripts TpxKey = "pstxfrscrpt"; TpxValue = ""; TapValue = IniGetStr("general","postcmd",""); if (TpxValue != TapValue) { TpxValue = Fconcat(sdir,Fhead(TapValue),"cs"); } WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "scptstartup"; TpxValue = ""; TapValue = IniGetStr("default.con","startcmd",""); if (TpxValue != TapValue) { TpxValue = Fconcat(sdir,Fhead(TapValue),"cs"); } WriteVal(TpxSection,TpxKey,TpxValue); TpxKey = "scptlogin"; TpxValue = ""; TapValue = IniGetStr("default.con","autocmd",""); if (TpxValue != TapValue) { TpxValue = Fconcat(sdir,Fhead(TapValue),"cs"); } WriteVal(TpxSection,TpxKey,TpxValue);