home *** CD-ROM | disk | FTP | other *** search
- /* $VER ControlPanel 3.50 (4/2/95)
- ** $Filename: ControlPanel $
- ** $Date: 8.1.95
- ** $Creation: 16.12.94
- **
- ** Arexx Version Of AmiTCP_ControlPanel
- **
- ** Users rexxreqtools.library
- **
- ** (C) Copyright 1994-1995 Martin Carl Hunt
- **
- */
-
- Address Command
-
- /* Adds Libraries Control Panel Needs */
- Call addlibraries()
-
- /* Initialieses Varibales Etc. */
- Call Initialisation()
-
- /* Gets Configuration Details (Prog. Names, Position, Amitcp: */
- Call GetConfig()
-
- /* If env:user doesn't exist call StartAmiTCP requester */
- if ~exists("env:user") then call StartAmiTCP ()
-
- /* Get User Details */
- call getuserdetails()
- /* Main Control Panel Loop */
- quit_controlpanel = 0
- do until quit_controlpanel
-
- reqtitle = "AmiTCP Control Panel - Main Menu Current
- User:" || usr || " Real Name:" || relnme
-
-
- MainMenu = rtezrequest("What do you want to do?", ,
- "_Start|S_top|_Connect|_Disconnect|Change _User|_Applications|A_uto|_Quit", ,
- reqtitle, "rtez_flags = ezreqf_centertext",
- topoffset leftoffset "rt_reqpos = reqpos_topleftscr" "rtez_defaultresponse = 6")
-
- if MainMenu == 0 then quit_controlpanel = 1
- if MainMenu == 1 then call Startnet()
- if MainMenu == 2 then call Stopnet()
- if MainMenu == 3 then call LinkUp()
- if MainMenu == 4 then call LinkDown()
- if MainMenu == 5 then call ChangeUser()
- if MainMenu == 6 then call Applications()
- if mainmenu == 7 then run auto.exe
-
- end
- call delay(250)
- "delete t:cp-run#? quiet"
- exit
-
- /* ----------------------------------------------------- */
-
- AddLibraries:
- if ~show("L","libs:rexxarplib.library") then
- do
- call addlib("libs:rexxarplib.library", 0, -30, 0)
- arplib = 1
- end
- if ~show("L","libs:rexxsupport.library") then
- do
- call addlib("libs:rexxsupport.library", 0, -30, 0)
- supportlib = 1
- end
- if ~show("L","libs:rexxreqtools.library") then
- do
- call addlib("libs:rexxreqtools.library", 0, -30, 0)
- reqtoolslib = 1
- end
- RETURN
-
- /* ----------------------------------------------------- */
-
- Initialisation:
- runno = 0
- NL = '0a'x
- quit_controlpanel = 0
-
- RETURN
-
- /* ----------------------------------------------------- */
-
- GetUserDetails:
- Relnme = "NOTSET"
- USR = "NOTSET"
-
- if open(ahandle, "env:realname", "r") then
- do
- Relnme = ReadLn(ahandle)
- call close(ahandle)
- end
-
- if open(bhandle, "env:user", "r") then
- do
- USR = ReadLn(bhandle)
- call close(bhandle)
- end
-
- if USR = "NOTSET" then
- do
- call open(dhandle, "env:user", "W")
- call seek(dhandle,0,"B")
- call writeln(dhandle, usr)
- call close(dhandle)
- end
-
- if Relnme = "NOTSET" then
- do
- call open(chandle, "env:realname", "W")
- call seek(chandle,0,"B")
- call writeln(chandle, usr)
- call close(chandle)
- relnme = usr
- end
- return
-
- /* ----------------------------------------------------- */
-
- StartAmiTCP:
- if exists("Amitcp:bin/startnet") then
- do
- choice = rtezrequest( "What do you want to do?", " _Start Amitcp | _Quit ", "AmiTCP Control Panel - Startup", "rtez_flags = ezreqf_centertext" "rt_reqpos = reqpos_centerscr")
- if choice == 1 then
- do
- call Startnet()
- "copy amitcp:env/#? env:"
- end
- else exit
- end
- RETURN
-
- /* ----------------------------------------------------- */
-
- Startnet:
- "Execute amitcp:bin/startnet"
- RETURN
-
- /* ----------------------------------------------------- */
-
- Stopnet:
- if show('P','AMITCP') then address AMITCP KILL
- RETURN
-
- /* ----------------------------------------------------- */
-
- LinkUp:
- LinkMenu=""
- if ~exists("Amitcp:bin/plink") then
- do
- LinkMenu = rtezrequest("Do You Want To Collect News" , "_Yes |_No |_Cancel", "AmiTCP Control Panel - Choose News Reader", "rtez_flags = ezreqf_centertext" "rt_reqpos = reqpos_centerscr")
- if linkmenu == 1 then address command "run link up news"
- if linkmenu == 2 then address command "run Link Up"
- end
- else
- do
- LinkMenu = rtgetstring(" ", "Enter FTP Batch File Name If Appropriate" ,"AmiTCP Control Panel - Connect", ,
- " _News | _Forget News | News and then _Disconnect | _Cancel ", "rtez_flags = ezreqf_centertext" "rt_reqpos = reqpos_centerscr" ,
- , LM_result)
-
- plinkparams = ""
- if LM_result ~= 0 then
- do
- if LM_Result == 1 then PlinkParams = "Up NEWS Savenew"
- if LM_Result == 2 then PlinkParams = "Up"
- if LM_Result == 3 then PlinkParams = "Up Autonews Savenew"
- if LinkMenu ~= "" then
- do
- if exists(word(linkmenu,1)) then
- do
- PlinkParam = Plinkparams || " Batch " || LinkMenu
- end
- else
- do
- "ED " linkmenu
- PlinkParam = Plinkparams || " Batch " || LinkMenu
- end
- end
- if linkmenu = "" then plinkparam = plinkparams
- "run PLINK" plinkparam
- end
- LM_result = "LM_result"
- end
- RETURN
-
- /* ----------------------------------------------------- */
-
- LinkDown:
- if exists("amitcp:bin/plink") then "run >nil: plink down"
- else "run >nil: link down"
- RETURN
-
- /* ----------------------------------------------------- */
-
- ChangeUser:
- name_correct = 0
- do until Name_Correct
- call open(handle1, "env:realname", "a")
- call seek(handle1, 0, "B")
- Env_Realname = ReadLn(handle1)
- RealName = rtgetstring(Env_Realname, "Enter Your Real Name " || NL || ,
- "i.e. Fred Bloggs ", "AmiTCP Control Panel - Change User", ,
- "_Use |_Save |_Cancel", "rtez_flags = ezreqf_centertext" "rt_reqpos = reqpos_centerscr", CU_RESULT)
- if CU_Result == 0 then RealName = ENV_Realname
- if CU_result ~== 0 then
- do
- call seek(handle1, 0, "B")
- call Writeln(handle1, RealName)
- end
- if CU_result == 2 then
- do
- call open(handle2, "Amitcp:env/RealName", "w")
- call Writeln(handle2, Realname)
- call close (handle2)
- end
- call close (handle)
-
- call open(handle, "env:User", "a")
- call seek(handle, 0, "B")
- Env_User = ReadLn(handle)
- CU_Result = "CU_RESULT"
- User = rtgetstring(Env_User, "Enter Your User Name " || NL || ,
- "i.e. Fred ", "AmiTCP Control Panel - Change User", ,
- "_Use |_Save |_Cancel", "rtez_flags = ezreqf_centertext" "rt_reqpos = reqpos_centerscr", Cu_result)
- if CU_result == 0 then User = Env_user
- if CU_result ~== 0 then
- do
- call seek(handle, 0, "B")
- call Writeln(handle, User)
- end
-
- if CU_result == 2 then
- do
- call open(handle2, "amitcp:env/User", "w")
- call Writeln(handle2, User)
- call close (handle2)
- end
-
- Call Close(handle)
-
- Name_Correct = rtezrequest("Your REAL NAME is " || RealName || NL ||,
- "Your USER NAME is " || User || NL || NL ||,
- "IS This Correct? ", "_Yes |_No", "AmiTCP Control Panel - Change User", ,
- "rtez_flags = ezreqf_centertext" "rt_reqpos = reqpos_centerscr")
- CU_RESULT = "CU_RESULT"
- end
-
- relnme = RealName
- USR = User
-
- RETURN
-
- /* ----------------------------------------------------- */
-
- Applications:
- do until Cancel = 0
- reqtitle = "AmiTCP Control Panel - Applications Menu Current User:" || usr ||" Real Name:" || relnme
-
- Cancel = rtezrequest("Choose Application To Run", ,
- "_E-Mail|_News|_FTP|_WWW|_Gopher|_IRC|_Archie|_Telnet|_More|_Cancel", ,
- reqtitle, "rtez_flags = ezreqf_centertext",
- topoffset leftoffset "rt_reqpos = reqpos_topleftscr" "rtez_defaultresponse = 9")
-
- Choice = Cancel
- if choice == 1 then mailprog
- if choice == 2 then address command newsprog
- if choice == 3 then ftpprog
- if choice == 4 then wwwprog
- if choice == 5 then gopherprog
- if choice == 6 then ircprog
- if choice == 7 then call runprog(archie_gui || " FILE")
- if choice == 8 then "run >nil: telnet_gui.exe"
- if choice == 9 then
- do
- cancel = 3
- do until cancel <2
- Cancel = rtezrequest("Choose Application To Run", ,
- "_Back|_Finger|_Ping|_TraceRoute|_UUXT|_DeArc|_Ed News|_Cancel", ,
- reqtitle, "rtez_flags = ezreqf_centertext",
- topoffset leftoffset "rt_reqpos = reqpos_topleftscr" "rtez_defaultresponse = 1")
-
- choice = cancel
- if choice == 1 then cancel = 1
- if choice == 2 then call runprog(finger_gui || " FILE")
- if choice == 3 then call runprog(Ping_gui || " SCREEN")
- if choice == 4 then call runprog(traceroute_gui || " FILE")
- if choice == 5 then uudecoderprog
- if choice == 6 then dearchiverprog
- if choice == 7 then newsedprog
- if choice == 8 then cancel = 0
- end
- end
- end
- RETURN
-
- /* ----------------------------------------------------- */
-
- RunProg:
- arg params
- prog = word(params,1)
- output = word(params,2)
- runno = runno + 1
- filename2 = ""
- filename = "t:cp-run-" || runno
- filename2 = filename || ".output"
- call open(file, filename, 'w')
- if output == "FILE" then
- do
- line1 = "amitcp:bin/" || prog || ".exe > " filename2
- call writeln(file, line1)
- call writeln(file, "ed " || filename2)
- end
- if output ~== "FILE" then do
- line1 = "amitcp:bin/" || prog || ".exe"
- call writeln(file, line1)
- call writeln(file, "Wait 5 secs")
- call writeln(file, "endcli")
- end
- call close(file)
- if output ~== "FILE" then address command "newshell con:0/150/640/100/" || prog || "-OUTPUT from " || filename
- if output == "FILE" then address command "run execute " || filename
- return
-
- /* ----------------------------------------------------- */
-
- GetConfig:
- /* Default Values If s:cp.config doesn't exist */
- Amitcp = "Dh1:amitcp"
- Mailprog = "mail"
- Newsprog = "grn left=30 height=230"
- FtpProg = "gui-ftp"
- WWWprog = "amosaic"
- GopherProg = "gopher"
- IrcProg = "gv"
- UUDecoderProg = "uuxt-gui"
- DeArchiverProg = "GuiArc"
- NewsEdProg = "NewsEd_Gui.exe"
- topoffset = 100
- leftoffset = 10
-
- /*Try to open s:cp.config*/
- if open(configfile, "s:cp.config", r) then
- do
- do until eof(configfile)
- a = readln(configfile)
-
- if upper(word(a,1)) == "AMITCPDIR" then AmiTCP = delword(a, 1, 2)
- if upper(word(a,1)) == "LEFT" then leftoffset = delword(a, 1, 2)
- if upper(word(a,1)) == "TOP" then topoffset = delword(a, 1, 2)
- if Upper(word(a,1)) == "MAIL" then mailprog = "run" delword(a, 1, 2)
- if upper(word(a,1)) == "NEWS" then Newsprog = "run" delword(a, 1, 2)
- if upper(word(a,1)) == "FTP" then ftpprog = "run" delword(a, 1, 2)
- if upper(word(a,1)) == "WWW" then WWWprog = "run" delword(a, 1, 2)
- if upper(word(a,1)) == "GOPHER" then gopherprog = "run" delword(a, 1, 2)
- if upper(word(a,1)) == "IRC" then IRcprog = "run" delword(a, 1, 2)
- if upper(word(a,1)) == "UUDECODER" then Uudecoderprog = "run" delword(a, 1, 2)
- if upper(word(a,1)) == "DEARCHIVER" then DeArchiverprog = "run" delword(a, 1, 2)
- if upper(word(a,1)) == "NEWSED" then NewsEdprog = "run" delword(a, 1, 2)
-
- end
- call close(configfile)
- end
- "assign amitcp: "amitcp
- leftoffset = "rt_leftoffset = "||leftoffset
- topoffset = "rt_topoffset = "||topoffset
- RETURN
-