home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / QM95REAL.ZIP / SCRIPTS.Z / MAKECIS3.QSC < prev    next >
Text File  |  1995-08-24  |  15KB  |  441 lines

  1. '
  2. ' This script is used to automatically create and add new dialing directory
  3. ' entry for Compuserve
  4. '
  5. '--------------------------------------------------------=[ Constants    ]=-
  6. const WS_BORDER        = 0x00800000
  7. const WS_VSCROLL       = 0x00200000
  8. const WS_TABSTOP       = 0x00010000
  9. const LB_RESETCONTENT  = 0x0184
  10. const LB_GETTEXT       = 0x0189
  11. const LB_SETTABSTOPS   = 0x0192
  12. const LBS_NOTIFY       = 0x0001
  13. const LBS_SORT         = 0x0002
  14. const LBS_USETABSTOPS  = 0x0080
  15. const LBS_STANDARD     = LBS_NOTIFY+WS_BORDER+WS_VSCROLL+WS_TABSTOP
  16. const CB_GETLBTEXT     = 0x0148
  17. const CB_RESETCONTENT  = 0x014B
  18. const CBS_DROPDOWNLIST = 0x0003
  19. const CBS_SORT         = 0x0100
  20. const CBS_STANDARD     = CBS_DROPDOWNLIST+WS_VSCROLL+WS_TABSTOP
  21.  
  22. '---------------------------------------------------------------------------=[ Dialogs      ]=-
  23. dialog Generator 5, 10, 205, 240
  24.   caption "CompuServe Information Service"
  25.   groupbox "User Information", -1, 10, 10, 185, 55
  26.   rtext "Your PIN", -1, 15, 25, 50, 15
  27.   userid as edittext 101, 70, 25, 95, 15
  28.   rtext "Your Password", -1, 15, 45, 50, 15
  29.   password as edittext 102, 70, 45, 95, 15
  30.  
  31.   groupbox "Connection Information",-1,10,70,185,55
  32.   ltext "Modem",        -1, 15,85, 40, 15
  33.   modem as combobox    106, 60,85,130, 50,
  34.   ltext "Service",      -1, 15,105, 40, 15
  35.   service as combobox  107, 60,105,130, 50,CBS_STANDARD
  36.  
  37.   groupbox "Phone Information",-1, 10, 135, 185,75
  38.   pushbutton "Search Phone Database", 112, 100, 150, 90, 15
  39.   ltext "Phone Number", -1, 15,170, 70, 15
  40.   areacode as edittext 103,100,170, 25, 15
  41.   number as edittext   104,130,170, 60, 15
  42.   ltext "Country"  ,    -1, 15,190, 40, 15
  43.   country as combobox  105, 60,190,130, 50,CBS_STANDARD+CBS_SORT
  44.  
  45.   defpushbutton "Make Script", 114, 15, 220, 50, 14
  46.   pushbutton "Cancel", IDCANCEL, 75, 220, 50, 14
  47.   pushbutton "About/Info", 113, 135, 220, 50, 14
  48. end dialog
  49.  
  50. dialog phonesearch 6, 15, 310, 110  
  51.   caption "Search Phone Number List"
  52.   ltext "Area Code",-1, 15,5,40,15
  53.   scode as edittext 603,60,5,20,15
  54.   ltext "Baud Rate",-1, 85,5,40,15
  55.   srate as edittext 604,130,5,30,15
  56.   ltext "State    ",-1,165,5,40,15
  57.   sstate as edittext 605,210,5,20,15
  58.   groupbox "Phone Number       City                              State      Supported Baud Rates",-1,10,20,290,65
  59.   sresult as listbox 507,15,30,280,60,LBS_STANDARD+LBS_USETABSTOPS
  60.   pushbutton "Cancel",IDCANCEL,100,90,50,15
  61.   defpushbutton "Search",606,160,90,50,15
  62. end dialog
  63.  
  64. dialog ServicesHelp 6, 15, 194, 144
  65.   caption "About Script Generator"
  66.   defpushbutton "OK", IDOK, 72, 122, 50, 14
  67.   groupbox "", -1, 4, 4, 185, 111
  68.   ltext "Compuserve Script Generator is used to automatically create a script to call compuserve.", -1, 10, 10, 170, 25
  69.   ltext "Macro Keys are also defined with common Compuserve Functions, Use the A,AC,AS,ASC button to toggle.", -1, 10, 35, 170, 25
  70.   ltext "Fill in PIN, Password, Area Code, Number, Country Code, Modem, and Service Type.", -1, 10, 60, 170, 25
  71.   ltext "The search button allows you search for numbers from the Phone Number Database.", -1, 10, 85, 170, 25
  72. end dialog
  73.  
  74. '----------------------------------------------------= Type Declarations =--
  75. type tabrecord
  76.   tabs(1 to 3) as integer
  77. end type
  78.  
  79. '--------------------------------------------------------=[ Declarations ]=---
  80. declare Sub SendDlgItemMessageText lib "user32" alias "SendDlgItemMessageA" (hwnd as integer, id as integer, message as integer, wparam as integer, lparam as string)
  81. declare function SendDlgItemMessageInt  lib "user32" alias "SendDlgItemMessageA" (hwnd as integer, id as integer, message as integer, wparam as integer, lparam as long) as long
  82. declare function SendDlgItemMessageTab Lib "User32" Alias "SendDlgItemMessageA" (Hwnd as integer, Id as integer, Msg as integer, Wparam as integer, lparam as TabRecord) as integer
  83. declare function GetDlgItem lib "user32" (hwindow as integer, id as integer) as integer
  84. declare function EnableWindow lib "user32" (hwindow as integer, on as integer) as integer
  85.  
  86. '-----------------------------------------------------------------------------=[ Variables    ]=-
  87. dim search as phonesearch
  88. dim searchname as string
  89. dim readstring as string
  90. dim n as string
  91. dim sl as Generator
  92. dim found as integer
  93. dim count as integer
  94. dim scriptname as string
  95. dim cinfo as countryinfo
  96.  
  97. '---------------------------------------------------------------------------=[ Functions    ]=-
  98. function GetUniqueScriptName(prefix as string) as string
  99.   dim scrname as string
  100.   scrname = ConfigScriptPath + "\" + prefix + ".QSC"
  101.   dim i as integer
  102.   i = 0
  103.   do while exists(scrname)
  104.     i = i + 1
  105.     scrname = ConfigScriptPath + "\" + prefix + str(i) + ".QSC"
  106.   loop
  107.   GetUniqueScriptName = scrname
  108. end function
  109.  
  110. function Generator.id(113) as integer
  111.   dim help as ServicesHelp
  112.   dialogbox help
  113. end function
  114.  
  115. function Generator.id(112) as integer
  116.   if (sl.service = 0) then searchname = ConfigScriptPath+"\cisphone.cps"
  117.   if (sl.service = 1) then searchname = ConfigScriptPath+"\cisphone.tel"
  118.   if (sl.service = 2) then searchname = ConfigScriptPath+"\cisphone.tym"
  119.   if (sl.service = 3) then searchname = ConfigScriptPath+"\cisphone.dpc"
  120.   if (sl.service = 4) then searchname = ConfigScriptPath+"\cisphone.lat"
  121.   if (sl.areacode <> "") then search.scode = sl.areacode
  122.   if dialogbox (search) = IDOK then
  123.     if n <> "" then
  124.       sl.areacode = left (n,3)
  125.       sl.number   = mid  (n,5,8)
  126.     end if
  127.   end if
  128. end function
  129.  
  130. function Generator.id(114) as integer
  131.   dim i as integer, seencomma as integer
  132.   for i = 1 to len(userid)
  133.     dim c as string
  134.     c = mid(userid, i, 1)
  135.     if c = "," then
  136.       if seencomma then
  137.         msgbox "Your PIN should be in the format 12345,6789"
  138.         exit function
  139.       else
  140.         seencomma = true
  141.       end if
  142.     elseif c < "0" or c > "9" then
  143.       msgbox "Your PIN should be in the format 12345,6789"
  144.       exit function
  145.     end if
  146.   next i
  147.   i = instr(userid, ",")
  148.   if i <= 1 or i >= len(userid) then
  149.     msgbox "Your PIN should be in the format 12345,6789"
  150.     exit function
  151.   end if
  152.   if password = "" then
  153.     msgbox "You need to fill in your password."
  154.     exit function
  155.   end if
  156.   if service <> 5 then
  157.     if (number = "") or (areacode = "") then
  158.       msgbox "Your phone number data is incomplete."
  159.       exit function
  160.     end if
  161.     if (country < 0) then
  162.       msgbox "You need to pick a country."
  163.       exit function
  164.     end if
  165.   end if
  166.   DialogResult = IDOK
  167.   n = spc(255)
  168.   SendDlgItemMessageText (hwindow,105,CB_GETLBTEXT,sl.country,n)
  169. end function
  170.  
  171. function phonesearch.id(507) as integer
  172.   n = spc(255)
  173.   SendDlgItemMessageText (hwindow,507,LB_GETTEXT,sresult,n)
  174.   dialogresult = IDOK
  175. end function
  176.  
  177. function phonesearch.id(606) as integer
  178.   dim sendmess as integer, totalfound as integer
  179.   dim sfound as boolean
  180.     
  181.   if not ((scode = "") and (srate = "") and (sstate = "")) then 
  182.     totalfound = 0
  183.     sendmess = SendDlgItemMessageInt (hwindow,507,LB_RESETCONTENT,0,0)
  184.     if exists (searchname) then
  185.       open searchname for input as #1
  186.       do while not (eof (1))
  187.         sfound = false
  188.         input #1,readstring
  189.         if (scode <> "") then
  190.           if (srate <> "") then
  191.             if (sstate <> "") then
  192.               if (left (readstring,3) = scode) and (instr (mid (readstring,38,30),srate) <> 0) and (mid (readstring,35,2) = sstate) then sfound = true
  193.             else
  194.               if (left (readstring,3) = scode) and (instr (mid (readstring,38,30),srate) <> 0) then sfound = true
  195.             end if
  196.           else
  197.             if (sstate <> "") then
  198.               if (left (readstring,3) = scode) and (mid (readstring,35,2) = sstate) then sfound = true
  199.             else
  200.               if (left (readstring,3) = scode) then sfound = true
  201.             end if
  202.           end if
  203.         else
  204.           if (srate <> "") then
  205.             if (sstate <> "") then
  206.               if (instr (mid (readstring,38,30),srate) <> 0) and (mid (readstring,35,2) = sstate) then sfound = true
  207.             else
  208.               if (instr (mid (readstring,38,30),srate) <> 0) then sfound = true
  209.             end if
  210.           else
  211.             if (sstate <> "") then
  212.               if (mid (readstring,35,2) = sstate) then sfound = true
  213.             end if
  214.           end if
  215.         end if
  216.         if sfound then
  217.           readstring = left (readstring,12)+chr(9)+mid(readstring,14,21)+chr(9)+mid(readstring,35,2)+chr(9)+mid(readstring,38,30)
  218.           addlistboxitem (hwindow,507,readstring)
  219.           totalfound = totalfound + 1
  220.           sfound = false
  221.         end if
  222.       loop
  223.       close #1
  224.     end if
  225.     if totalfound = 0 then
  226.       addlistboxitem (hwindow,507,"No Records Found Matching Search Criteria!")
  227.     end if
  228.   else
  229.     msgbox "You must select an Area Code, Baud Rate, and/or State to search"
  230.   end if    
  231.   scode = ""
  232.   srate = ""
  233.   sstate = ""
  234. end function
  235.  
  236. function generator.id(107) as integer
  237.   if service = 5 then
  238.     enablewindow (getdlgitem (hwindow,112),0)
  239.     enablewindow (getdlgitem (hwindow,103),0)
  240.     enablewindow (getdlgitem (hwindow,104),0)
  241.     enablewindow (getdlgitem (hwindow,105),0)
  242.     sl.areacode = ""
  243.     sl.number = "compuserve.com"
  244.   else
  245.     enablewindow (getdlgitem (hwindow,112),1)
  246.     enablewindow (getdlgitem (hwindow,103),1)
  247.     enablewindow (getdlgitem (hwindow,104),1)
  248.     enablewindow (getdlgitem (hwindow,105),1)
  249.     sl.areacode = ""
  250.     sl.number = ""
  251.   end if
  252. end function
  253.     
  254. '---------------------------------------------------------------------------=[ Subroutines  ]=-
  255. sub phonesearch.init
  256.   dim t as tabrecord, result1 as integer
  257.   t.tabs(1) =  60
  258.   t.tabs(2) =  140
  259.   t.tabs(3) =  160
  260.   result1 = SendDlgItemMessageTab (HWindow, 507, LB_SETTABSTOPS, 3, t)
  261. end sub
  262.  
  263. sub Generator.init
  264.   userid   = ""
  265.   password = ""
  266.   areacode = ""
  267.   number   = ""
  268.   for count = 1 to getmodemcount
  269.     addcomboboxitem (hwindow,106,getmodemname (count - 1))
  270.   next count
  271.   modem = 0
  272.   addcomboboxitem (hwindow,107,"CompuServe Network")
  273.   addcomboboxitem (hwindow,107,"SprintNet")
  274.   addcomboboxitem (hwindow,107,"Tymnet")
  275.   addcomboboxitem (hwindow,107,"Canadian Datapac")
  276.   addcomboboxitem (hwindow,107,"LATA")
  277.   addcomboboxitem (hwindow,107,"Telnet Services")
  278.   service = 0
  279.   if getfirstcountry (cinfo) then
  280.     do
  281.       readstring = pad (cinfo.name,150)+pad(str(cinfo.countryid),5)+pad(str(cinfo.countrycode),5)
  282.       addcomboboxitem (hwindow,105,readstring)
  283.     loop until not (getnextcountry (cinfo))
  284.   end if
  285. end sub
  286.  
  287. sub CreateCISCPSScript
  288.   print #1, "striphibit on"
  289.   print #1, "delay 1"
  290.   print #1, "send ""^C"";"
  291.   print #1, "waitfor ""User ID: """
  292.   print #1, "send lastconnectuserid"
  293.   print #1, "waitfor ""Password: """
  294.   print #1, "send lastconnectpassword"
  295. end sub
  296.  
  297. sub CreateCISTELScript
  298.   print #1, "striphibit on"
  299.   print #1, "when match ""Host Name:"" do send ""CIS"""
  300.   print #1, "when match ""Terminal"" do send ""D1^M"""
  301.   print #1, "delay 1"
  302.   print #1, "send ""@.^M"""
  303.   print #1, "delay 2"
  304.   print #1, "timeout 5"
  305.   print #1, "try1200:"
  306.   print #1, "waitfor ""TERMINAL="""
  307.   print #1, "timeout off"
  308.   print #1, "waitfor ""@"""
  309.   print #1, "send ""C 202202"""
  310.   print #1, "waitfor ""User ID: """
  311.   print #1, "send lastconnectuserid"
  312.   print #1, "waitfor ""Password: """
  313.   print #1, "send lastconnectpassword"
  314.   print #1,
  315.   print #1, "catch err_timeout"
  316.   print #1, "send ""^M.^M"""
  317.   print #1, "goto try1200"
  318. end sub
  319.  
  320. sub CreateCISTYMScript
  321.   print #1, "striphibit on"
  322.   print #1, "when match ""Host Name:"" do send ""CIS"""
  323.   print #1, "delay 2"
  324.   print #1, "send ""A"";"
  325.   print #1, "waitfor ""LOG IN"""
  326.   print #1, "send ""CML05"""
  327.   print #1, "waitfor ""User ID: """
  328.   print #1, "send lastconnectuserid"
  329.   print #1, "waitfor ""Password: """
  330.   print #1, "send lastconnectpassword"
  331. end sub
  332.  
  333. sub CreateCISDPCScript
  334.   print #1, "striphibit on"
  335.   print #1, "when match ""Host Name:"" do send ""CIS"""
  336.   print #1, "delay 2"
  337.   print #1, "send ""..."""
  338.   print #1, "waitfor ""datapac"""
  339.   print #1, "send ""29400138"""
  340.   print #1, "waitfor ""User ID: """
  341.   print #1, "send lastconnectuserid"
  342.   print #1, "waitfor ""Password: """
  343.   print #1, "send lastconnectpassword"
  344. end sub
  345.  
  346. sub CreateCISLATScript
  347.   print #1, "striphibit on"
  348.   print #1, "when match ""Host Name:"" do send ""CIS"""
  349.   print #1, "delay 2"
  350.   print #1, "send ""...^M"""
  351.   print #1, "waitfor ""public data"""
  352.   print #1, "send "".CPS^M"""
  353.   print #1, "waitfor ""User ID: """
  354.   print #1, "send lastconnectuserid"
  355.   print #1, "waitfor ""Password: """
  356.   print #1, "send lastconnectpassword"
  357. end sub
  358.  
  359. sub CreateCISTELNETScript
  360.   print #1, "striphibit on"
  361.   print #1, "waitfor ""Host Name:"""
  362.   print #1, "send ""cis^M"""
  363.   print #1, "waitfor ""Enter choice (LOGON, HELP, OFF):"""
  364.   print #1, "send ""logon^M"""
  365.   print #1, "waitfor ""Enter choice (300, 2400, 9600, 14400, OFF):"""
  366.   print #1, "send ""14400^M"""
  367.   print #1, "waitfor ""User ID: """
  368.   print #1, "send lastconnectuserid"
  369.   print #1, "waitfor ""Password: """
  370.   print #1, "send lastconnectpassword"
  371. end sub
  372.  
  373. '---------------------------------------------------------------------------=[ Main         ]=-
  374. MAIN:
  375.  
  376. if dialogbox(sl) = IDOK then
  377.   scriptname = GetUniqueScriptName("cis")
  378.   dim entry as phoneentry
  379.   open scriptname for output as #1
  380.   select case sl.service
  381.     case 0
  382.       CreateCISCPSScript
  383.       entry.name = "Compuserve"
  384.       entry.emulation = vt100
  385.     case 1
  386.       CreateCISTELScript
  387.       entry.name = "Compuserve via SprintNet"
  388.       entry.emulation = vt100
  389.     case 2
  390.       CreateCISTYMScript
  391.       entry.name = "Compuserve via TymNet"
  392.       entry.emulation = vidtex
  393.     case 3
  394.       CreateCISDPCScript
  395.       entry.name = "Compuserve via Canadian Datapac"
  396.       entry.emulation = vidtex
  397.     case 4
  398.       CreateCISLATScript
  399.       entry.name = "Compuserve via LATA"
  400.       entry.emulation = vidtex
  401.     case 5
  402.       CreateCISTELNETScript
  403.       entry.name = "Compuserve via TELNET"
  404.       entry.emulation = vidtex
  405.   end select
  406.   close #1
  407.   if (sl.service = 5) then
  408.     entry.useareacountry = 0
  409.     entry.connecttype = 2
  410.   else
  411.     entry.useareacountry = 1
  412.     entry.connecttype = 0
  413.   end if
  414.   entry.areacode = sl.areacode
  415.   entry.number(1) = sl.number
  416.   entry.userid = sl.userid
  417.   entry.password = sl.password
  418.   entry.scriptfile = scriptname
  419.   entry.macrofile = "cis.mac"
  420.   entry.protocol = bplus
  421.   entry.tapidevice = getmodemname (sl.modem)
  422.   entry.countryid   = val(mid(n,151,5))
  423.   entry.countrycode = val(mid(n,156,5))
  424.   entry.iconrespath = "bbsicons.dll"
  425.   entry.iconresid = 2
  426.   if updatephoneentry (entry) then
  427.     msgbox ("Compuserve Entry Modified With New Information")
  428.   else
  429.     addphoneentry (entry)
  430.     msgbox "Phone directory entry for CompuServe created."
  431.   end if
  432. end if
  433.  
  434. catch err_fileopen
  435.   msgbox "Could not create script: " + scriptname
  436.   goto main
  437.  
  438.  
  439.  
  440.  
  441.