home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Netzwerk / HF-PCN1.DMS / in.adf / NetworkPC / ConfigNetworkPC < prev    next >
Encoding:
Text File  |  1996-06-13  |  13.4 KB  |  415 lines

  1. ; Configuration script for the NetPC program
  2.  
  3. ;Indicator types
  4. (set ISTR0 "None")
  5. (set ISTR1 "LED")
  6. (set ISTR2 "Gopher-like")
  7. (set ISTR3 "Background")
  8. ;(set ISTR4 "Mouse")
  9.  
  10. ;Speeds
  11. (set SPEED0 "1200")
  12. (set SPEED1 "2400")
  13. (set SPEED2 "4800")
  14. (set SPEED3 "9600")
  15. (set SPEED4 "19200")
  16. (set SPEED5 "38400")
  17. (set SPEED6 "57600")
  18. (set SPEED7 "115200")
  19.  
  20. ;Cables
  21. (set CABLE0 "Weird Science Cable")
  22. ;(set CABLE1 "Special 8W")
  23.  
  24.  
  25.  
  26. (procedure EditConfig
  27.  
  28.   ; Set transfer type
  29.   (set OldXferType XferType)
  30.   (set XferType 
  31.     (askchoice 
  32.       (prompt "Select port to use")
  33.       (choices "Serial" "Parallel")
  34.       (default 1)
  35.       (help 
  36.         "You have to select whether you want to use parallel or serial transfer. "
  37.       )
  38.     )
  39.   )
  40.  
  41.   (if (= XferType 1)
  42.     (
  43.       (set Device "NetPcParallel.device")
  44.       (set Timeout 10)
  45.       (set Unit 0)
  46.       (set Flags
  47.         (askchoice
  48.           (prompt "Which cable do you use")
  49.           (choices CABLE0)
  50.           (default Flags)
  51.           (help
  52.            "\n"
  53.            "The Weird Science Parallel Cable is supplied with NetworkPC"
  54.           )
  55.         )
  56.       )
  57.     )
  58.   )
  59.  
  60.   (if (= XferType 0)
  61.     (
  62.  
  63.       ; Set device
  64.       (if (<> XferType OldXferType)
  65.         (set Device "serial.device")
  66.       )
  67.  
  68.       (set DevOK 0)
  69.       (until (= DevOK 1)
  70.         (set DefDev ("DEVS:/%s" Device))
  71.         (set Device
  72.           (fileonly
  73.             (askfile
  74.               (prompt "Select device you want to use. For parallel transfer "
  75.                       "select NetPcParallel.device. Click on HELP for further details")
  76.               (help 
  77.                 "You have to select device to communicate via. It will mostly be \"serial.device\" "
  78.                 "but you can also use \"artser.device\" etc. But remember that some devices don't "
  79.                 "support the Break() function (baudbandit.device), so they cannot be "
  80.                 "used.\n\nFor parallel transfer is used device called PC2AmParallel.device."
  81.               )
  82.               (default DefDev)
  83.             )
  84.           )
  85.         )
  86.  
  87.         (set DevOK 1)
  88.         (if (= Device "parallel.device")
  89.           (
  90.             (message
  91.               "NetworkPC does not use standard parallel.device for the transfer. "
  92.               "For parallel transfers it uses its own device called 'NetPcParallel.device'. "
  93.               "If you wanted to set parallel transfer use this one. Now you will have to select "
  94.               "the device again.\n"
  95.               "Better way is to select parallel transfer (in previous requester)."
  96.             )
  97.             (set DevOK 0)
  98.           )
  99.         )
  100.       )
  101.  
  102.       ; Set unit
  103.       (set Unit
  104.         (asknumber
  105.           (prompt "Select unit of the device")
  106.           (help "This will be mostly zero. You will have to change it only if you use a multiserial card.")
  107.           (default Unit)
  108.         )
  109.       )
  110.  
  111.       ; Set Flags
  112.       (set Flags
  113.         (asknumber
  114.           (prompt "Select open flags of the device")
  115.           (help "This will be mostly zero. You will have to change it only if you use a multiserial card.")
  116.           (range -2147483648 2147483647)
  117.           (default Flags)
  118.         )
  119.       )
  120.  
  121.       ; Set baud rate
  122.       ; Find baud code
  123.       (set BaudCode 0)
  124.       (while (AND (> BaudRate (+ 0 (select BaudCode SPEED0 SPEED1 SPEED2 SPEED3 SPEED4 SPEED5 SPEED6 SPEED7))) (< BaudCode 7))
  125.         (set BaudCode (+ BaudCode 1))
  126.       )
  127.       (set BaudRate
  128.         (+ 0
  129.           (select 
  130.             (askchoice 
  131.               (prompt "Select baud rate")
  132.               (choices SPEED0 SPEED1 SPEED2 SPEED3 SPEED4 SPEED5 SPEED6 SPEED7)
  133.               (default BaudCode)
  134.               (help 
  135.               "You have to select baud rate to communicate on. It is important to set "
  136.               "this baudrate to the same value on both Amiga and PC. Selecting too big "
  137.               "baudrate may cause infunctionality, low baudrates lowers transfer speed. "
  138.               "If you have at least A500 and 386SX/40, you can choose 57600."
  139.               )
  140.             )
  141.             SPEED0 SPEED1 SPEED2 SPEED3 SPEED4 SPEED5 SPEED6 SPEED7
  142.           )
  143.         )
  144.       )
  145.  
  146.       ;Set timeout
  147.       (set Timeout
  148.         (asknumber
  149.           (prompt "Set timeout\nNote, that it is in TENTHS of second.")
  150.           (help
  151.             "Timeout is the time, after which Amiga will try to restore "
  152.             "send PC a break, to make it reply packet etc. Good value is about"
  153.             "20 (2 secs) or a little bit more. High values do not have sense, "
  154.             "because there will be spent much time in waiting for PC. But setting "
  155.             "it too small may cause many timeouts when working with slower device "
  156.             "(floppy) or on small baud rates.\n\n"
  157.             "When you use parallel transfer, you should set this value to 100 or similar value."
  158.           )
  159.           (default Timeout)
  160.         )
  161.       )
  162.     )
  163.   )
  164.  
  165.   ;Set MaxTransfer
  166.   (set MaxTransfer
  167.     (asknumber
  168.       (prompt "Set maximal length of a packet.")
  169.       (range 312 8192)
  170.       (help
  171.         "Here you can set the maximal length of packet, that is transfered via "
  172.         "serial (parallel) line. Note that it is used only for sending files, "
  173.         "because other packets (open, ...) are only about 20 bytes long. So set "
  174.         "it to a lower value only when you can list directories well (listing main "
  175.         "PC: directory takes shorter packets that listing "true" directory on PC). "
  176.         "Usually, you can keep this value at least 4096 or even 8192."
  177.       )
  178.       (default MaxTransfer)
  179.     )
  180.   )
  181.  
  182.   ; Set if we want to pretend SetComment
  183.   (set PretendSCom 0)
  184.   (if (>= HighCyl 16)
  185.     (set PretendSCom 1)
  186.   )
  187.   (set PretendSCom
  188.     (askoptions
  189.       (prompt "Can NetworkPC pretend SetComment() was succesfull ?")
  190.       (choices "Do pretend")
  191.       (default PretendSCom)
  192.       (help
  193.         "MS-DOS filesystem does not support file comments, so NetworkPC doesn't "
  194.         "support it too and returns 'Action not known'. But some disk managers "
  195.         "sets comment of file when copying and puts up a requester when they "
  196.         "got error from filesystem, which may be very annoying. If you turn "
  197.         "on this option, NetworkPC will answer 'OK' to SetComment() requests "
  198.         "like it successfuly set the comment, although it didn't do anything."
  199.       )
  200.     )
  201.   )
  202.  
  203.   ;Set progress indicator
  204.   (set IndicType
  205.     (askchoice 
  206.       (prompt "Select progress indicator type")
  207.       (choices ISTR0 ISTR1 ISTR2 ISTR3)
  208.       (default IndicType)
  209.       (help 
  210.         "Progress indicator is something that tells you the communication is "
  211.         "still working (data are transfering). Here's a description of supported "
  212.         "types:\n\n"
  213.         "NONE - No indicator will be used\n\n"        
  214.         "LED - Power LED brightness will be turned after sending each packet. "
  215.         "So when communication works, you will see LED flashing. But it may confuse "
  216.         "you, because it looks like you have been visited by a guru (system crash)."
  217.         "It may also interfere with a music playing program, because turning LED "
  218.         "turns also ON/OFF audio filter.\n\n"
  219.         "GOPHER-LIKE - In the NetworkPC commodity window, there's a square, in which "
  220.         "you will see rotating line. But you have to popup NetworkPC to see it, so you "
  221.         "cannot look at it all the time.\n\n"
  222.         "BACKGROUND - After sending every packet, background flashes. Maybe good for "
  223.         "some people, but for me it is too \"hard\" indication.\n\n"
  224. ;        "MOUSE - Mouse will flash as when unpacking by PowerPacker."
  225.       )
  226.     )
  227.   )
  228.  
  229.   ; Hotkey qualifier
  230.   (set HotKeyQ
  231.     (askoptions
  232.       (prompt "Choose qualifiers for commodity hotkey. If you don't select any, hotkey will be disabled.")
  233.       (choices "CTRL" "LALT" "RALT" "LSHIFT" "RSHIFT" "LCOMMAND" "RCOMMAND")
  234.       (default HotKeyQ)
  235.       (help 
  236.         "NetworkPC window can be now popped up by a hotkey. "
  237.         "Here you select hotkey 'shifting'. In the next requester "
  238.         "you will select the key itself."
  239.       )
  240.     )
  241.   )
  242.  
  243.   (set HotKeyC
  244.     (askstring
  245.       (prompt "Enter KEY for the hotkey {shifting has been selected "
  246.               "before.} Only first char is considered."
  247.       )
  248.       (default HotKeyC)
  249.       (help "This is the hotkey that the NetworkPC window will open on.")
  250.     )
  251.   )
  252.  
  253.   (set MaxErr (BITAND HighCyl 15))
  254.   (if (= MaxErr 0) ((set MaxErr 4)))
  255.   (set MaxErr
  256.     (asknumber
  257.       (prompt
  258.         "Choose number of errors to popup error requester.\n"
  259.         "Set it to 0 for no requester.\n"
  260.         "Do not change if you don't have any idea what is it for !"
  261.       )
  262.       (range 0 14)
  263.       (help
  264.         "When NetworkPC cannot transfer packet for a long time, it pops up "
  265.         "a requester informing user there is some problem. It is for new "
  266.         "users, but it may be useful also in other situations.\n"
  267.         "In this dialog, you set the number of fails to popup this requester. "
  268.         "When you set it to 0 for no requests. "
  269.       )
  270.       (default (- MaxErr 1))
  271.     )
  272.   )
  273.   (set MaxErr (+ MaxErr 1))
  274.   
  275.   (set Priority
  276.     (asknumber
  277.       (range -128 127)
  278.       (prompt
  279.         "Set task priority for NetworkPC-handler. Help will tell you what is "
  280.         "this for."
  281.       )
  282.       (help
  283.         "If you use NetworkPC via parallel, you may be confused that it almost "
  284.         "freezes your system while it is transfering. Especially some people "
  285.         "running BBSes and having some files on PC hated it.\n"
  286.         "By default, NetworkPC has priority of 5 so there is no big danger it will be "
  287.         "interrupted while transfering, which could cause timeout. But if you "
  288.         "want to use your Amiga while transferring, you may set this to 0 or "
  289.         "-1. Normal programs will run OK. But when there will be heavy system "
  290.         "load, NetworkPC will be unable to transfer.\n"
  291.         "Modify this value only when NetworkPC is running OK on your machine and "
  292.         "you have real reasons to do it."
  293.       )
  294.       (default Priority)
  295.     )
  296.   )
  297. )
  298.  
  299. ; /***********************\
  300. ; *                       *
  301. ; *  Program starts here  *
  302. ; *                       *
  303. ; \***********************/
  304.  
  305. (if (<= (getversion (resident)) (* 37 65536))
  306.   (abort "Sorry, this script works only for systems 2.1 and later (kickstart version 37+)")
  307. )
  308.  
  309. (if (= (exists "c:GetPCSpecs") 0)
  310.   (abort "Cannot find command 'c:GetPCSpecs'. If you haven't installed NetworkPC yet, you must do it before running this configuration script.")
  311. )
  312.  
  313. (if (= (exists "c:SetPCSpecs") 0)
  314.   (abort "Cannot find command 'c:SetPCSpecs'. If you haven't installed NetworkPC yet, you must do it before running this configuration script.")
  315. )
  316.  
  317. (user 2)
  318.  
  319. (set FileName 
  320.   (askfile
  321.     (prompt "Please enter where you have installed the device specification file (\"PC\").")
  322.     (help
  323.       "There's a device specification file (called \"PC\"), which also contains "
  324.       "configuration data. Configuration script needs to know where it is to change "
  325.       "it. It should be either in the SYS:Storage/DOSDrivers or DEVS:DOSDrivers directory."
  326.     )
  327.     (default "SYS:Storage/DOSDrivers/PC")
  328.   )
  329. )
  330.  
  331. (if (= (exists FileName) 0)
  332.   (abort "The file you have entered does not exist !")
  333. )
  334.  
  335. (run ("GetPCSpecs %s" FileName))
  336.  
  337. ; Get original values
  338. (set Device (getenv "P2A_DEVICE"))
  339. (set Unit (+ 0 (getenv "P2A_UNIT")))
  340. (set Flags (+ 0 (getenv "P2A_FLAGS")))
  341. (set BaudRate (+ 0 (getenv "P2A_BAUD")))
  342. (set MaxTransfer (+ 0 (getenv "P2A_MAXTRANSFER")))
  343. (set Timeout (+ 0 (getenv "P2A_TIMEOUT")))
  344. (set HFlags (+ 0 (getenv "P2A_BLOCKSPERTRACK")))
  345. (set LowCyl (+ 0 (getenv "P2A_LOWCYL")))
  346. (set HighCyl (+ 0 (getenv "P2A_HIGHCYL")))
  347. (set IndicType (BITAND HFlags 7))
  348. (set HotKeyQ (/ (BITAND LowCyl $F00) $100))
  349. (set HotKeyC (getenv "P2A_HOTKEY"))
  350. (set Priority (+ 0 (getenv "P2A_PRIORITY")))
  351.  
  352. (set XferType (= Device "NetPcParallel.device"))
  353.  
  354. (until
  355.   (= Result 1)
  356.   (EditConfig)
  357.   ; Set some vars
  358.   (set TSecs (/ Timeout 10))
  359.   (set TTent (- Timeout (* TSecs 10)))
  360.   (set Result 
  361.     (if (= XferType 1)
  362.       (
  363.         (askbool
  364.           (prompt
  365.             "Confirm settings:\n\n"
  366.             ("Using PARALLEL port\nCable: %s\n" (select Flags CABLE0 CABLE1))
  367.             ("Indicator: %s\n" (select IndicType ISTR0 ISTR1 ISTR2 ISTR3))
  368.           )
  369.           (help "Script asks you to confirm your selection.")
  370.         )
  371.       )
  372.       (
  373.         (askbool
  374.           (prompt
  375.             "Confirm settings:\n\nUsing SERIAL port\n"
  376.             ("Device: %s\nUnit: %ld\nFlags: %ld\nBaudRate: %ld\nTimeout: %ld.%lds\n" Device Unit Flags BaudRate TSecs TTent)
  377.             ("Indicator: %s\n" (select IndicType ISTR0 ISTR1 ISTR2 ISTR3))
  378.           )
  379.           (help "Script asks you to confirm your selection.")
  380.         )
  381.       )
  382.     )
  383.   )
  384. )
  385.  
  386.  
  387. ; Copy values to env vars
  388. (set HFlags IndicType)
  389. (set LowCyl (* HotKeyQ $100))
  390. (set HighCyl (+ MaxErr (* 16 PretendSCom)))
  391. (textfile (dest "ENV:P2A_DEVICE") (append Device))
  392. (textfile (dest "ENV:P2A_UNIT") (append Unit))
  393. (textfile (dest "ENV:P2A_FLAGS") (append Flags))
  394. (textfile (dest "ENV:P2A_BAUD") (append BaudRate))
  395. (textfile (dest "ENV:P2A_MAXTRANSFER") (append MaxTransfer))
  396. (textfile (dest "ENV:P2A_TIMEOUT") (append Timeout))
  397. (textfile (dest "ENV:P2A_BLOCKSPERTRACK") (append HFlags))
  398. (textfile (dest "ENV:P2A_LOWCYL") (append LowCyl))
  399. (textfile (dest "ENV:P2A_HIGHCYL") (append HighCyl))
  400. (textfile (dest "ENV:P2A_HOTKEY") (append HotKeyC))
  401. (textfile (dest "ENV:P2A_PRIORITY") (append Priority))
  402.  
  403. (run ("SetPCSpecs %s T:PC" FileName))
  404.  
  405. (copyfiles
  406.   (source "t:PC")
  407.   (dest (pathonly FileName))
  408. )
  409.  
  410.  
  411. (exit "\n\nDON'T FORGET TO INSTALL THE PC PART\n(USING THE PC INSTALLATION DISK)")
  412.  
  413. (welcome)
  414.  
  415.