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

  1. '
  2. ' This script is used to automatically create and add new dialing directory
  3. ' entry for GEnie.
  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 "GENie Script Maker"
  25.   groupbox "User Information", -1, 10, 10, 185, 55
  26.   rtext "Your User Id", -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 "GEnie Script Generator is used to automatically create a script to call GENie.", -1, 10, 10, 170, 25
  69.   ltext "Macro Keys are also defined with common GEnie Functions, Use the A,AC,AS,ASC button to toggle.", -1, 10, 35, 170, 25
  70.   ltext "Fill in User Name, Password, Area Code, Number, Country Code, and Modem.", -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.  
  84. '-----------------------------------------------------------------------=[ Variables         ]=-
  85. dim readstring as string
  86. dim cinfo as countryinfo
  87. dim sl as Generator
  88. dim found as integer
  89. dim count as integer
  90. dim scriptname as string
  91. dim n as string
  92. dim search as phonesearch
  93. dim searchname as string
  94.  
  95. '-----------------------------------------------------------------------=[ Functions         ]=-
  96. function phonesearch.id(507) as integer
  97.   n = spc(255)
  98.   SendDlgItemMessageText (hwindow,507,LB_GETTEXT,sresult,n)
  99.   dialogresult = IDOK
  100. end function
  101.  
  102. function phonesearch.id(606) as integer
  103.   dim sendmess as integer, totalfound as integer
  104.   dim sfound as boolean
  105.     
  106.   if not ((scode = "") and (srate = "") and (sstate = "")) then 
  107.     totalfound = 0
  108.     sendmess = SendDlgItemMessageInt (hwindow,507,LB_RESETCONTENT,0,0)
  109.     if exists (searchname) then
  110.       open searchname for input as #1
  111.       do while not (eof (1))
  112.         sfound = false
  113.         input #1,readstring
  114.         if (scode <> "") then
  115.           if (srate <> "") then
  116.             if (sstate <> "") then
  117.               if (left (readstring,3) = scode) and (instr (mid (readstring,38,23),srate) <> 0) and (mid (readstring,35,2) = sstate) then sfound = true
  118.             else
  119.               if (left (readstring,3) = scode) and (instr (mid (readstring,38,23),srate) <> 0) then sfound = true
  120.             end if
  121.           else
  122.             if (sstate <> "") then
  123.               if (left (readstring,3) = scode) and (mid (readstring,35,2) = sstate) then sfound = true
  124.             else
  125.               if (left (readstring,3) = scode) then sfound = true
  126.             end if
  127.           end if
  128.         else
  129.           if (srate <> "") then
  130.             if (sstate <> "") then
  131.               if (instr (mid (readstring,38,23),srate) <> 0) and (mid (readstring,35,2) = sstate) then sfound = true
  132.             else
  133.               if (instr (mid (readstring,38,23),srate) <> 0) then sfound = true
  134.             end if
  135.           else
  136.             if (sstate <> "") then
  137.               if (mid (readstring,35,2) = sstate) then sfound = true
  138.             end if
  139.           end if
  140.         end if
  141.         if sfound then
  142.           readstring = left (readstring,12)+chr(9)+mid(readstring,14,20)+chr(9)+mid(readstring,35,2)+chr(9)+mid(readstring,38,25)
  143.           addlistboxitem (hwindow,507,readstring)
  144.           totalfound = totalfound + 1
  145.           sfound = false
  146.         end if
  147.       loop
  148.       close #1
  149.     end if
  150.     if totalfound = 0 then
  151.       addlistboxitem (hwindow,507,"No Records Found Matching Search Criteria!")
  152.     end if
  153.   else
  154.     msgbox "You must select an Area Code, Baud Rate, and/or State to search"
  155.   end if    
  156.   scode = ""
  157.   srate = ""
  158.   sstate = ""
  159. end function
  160.  
  161. function GetUniqueScriptName(prefix as string) as string
  162.   dim scrname as string
  163.   scrname = ConfigScriptPath + "\" + prefix + ".QSC"
  164.   dim i as integer
  165.   i = 0
  166.   do while exists(scrname)
  167.     i = i + 1
  168.     scrname = ConfigScriptPath + "\" + prefix + str(i) + ".QSC"
  169.   loop
  170.   GetUniqueScriptName = scrname
  171. end function
  172.  
  173. function Generator.id(113) as integer
  174.   dim help as ServicesHelp
  175.   dialogbox help
  176. end function
  177.  
  178. function Generator.id(112) as integer
  179.   if sl.service = 0 then searchname = configscriptpath+"\geniereg.dat"
  180.   if sl.service = 1 then searchname = configscriptpath+"\geniespr.dat"
  181.   if sl.areacode <> "" then search.scode = sl.areacode
  182.   if dialogbox (search) = IDOK then
  183.     if n <> "" then
  184.       sl.areacode = left (n,3)
  185.       sl.number   = mid  (n,5,8)
  186.     end if
  187.   end if
  188. end function
  189.  
  190. function Generator.id(114) as integer
  191.   if userid = "" then
  192.     msgbox "You need to fill in your User ID."
  193.     exit function
  194.   end if
  195.  
  196.   if password = "" then
  197.     msgbox "You need to fill in your password."
  198.     exit function
  199.   end if
  200.  
  201.   if (number = "") or (areacode = "") then
  202.     msgbox "You need to fill in a phone number."
  203.     exit function
  204.   end if
  205.   
  206.   if (country < 0) then
  207.     msgbox "You need to pick a country."
  208.     exit function
  209.   end if
  210.  
  211.   DialogResult = IDOK
  212.   n = spc(255)
  213.   SendDlgItemMessageText (hwindow,105,CB_GETLBTEXT,sl.country,n)
  214. end function
  215.  
  216. '---------------------------------------------------------------------------=[ Subroutines  ]=-
  217. sub phonesearch.init
  218.   dim t as tabrecord, result1 as integer
  219.   t.tabs(1) =  60
  220.   t.tabs(2) =  140
  221.   t.tabs(3) =  160
  222.   result1 = SendDlgItemMessageTab (HWindow, 507, LB_SETTABSTOPS, 3, t)
  223. end sub
  224.  
  225. sub Generator.init
  226.   userid   = ""
  227.   password = ""
  228.   areacode = ""
  229.   number   = ""
  230.   for count = 1 to getmodemcount
  231.     addcomboboxitem (hwindow,106,getmodemname (count - 1))
  232.   next count
  233.   modem = 0
  234.   addcomboboxitem (hwindow,107,"Standard GENie Connection")
  235.   addcomboboxitem (hwindow,107,"GENie Connection Using SprintNet")
  236.   service = 0
  237.   if getfirstcountry (cinfo) then
  238.     do
  239.       readstring = pad (cinfo.name,150)+pad(str(cinfo.countryid),5)+pad(str(cinfo.countrycode),5)
  240.       addcomboboxitem (hwindow,105,readstring)
  241.     loop until not (getnextcountry (cinfo))
  242.   end if
  243. end sub
  244.  
  245. sub CreateGEnieScript
  246.   print #1, "striphibit on"
  247.   print #1, "duplex off"
  248.   print #1, "delay 2"
  249.   print #1, "send ""HHH"";"
  250.   print #1, "waitfor ""U#="""
  251.   print #1, "send lastconnectuserid + "","" + lastconnectpassword"
  252. end sub
  253.  
  254. '---------------------------------------------------------------------------=[ Main         ]=-
  255. MAIN:
  256.  
  257. if dialogbox(sl) = IDOK then
  258.   scriptname = GetUniqueScriptName("genie")
  259.   open scriptname for output as #1
  260.   CreateGEnieScript
  261.   close #1
  262.   dim entry as phoneentry
  263.   entry.name = "GEnie"
  264.   entry.areacode = sl.areacode
  265.   entry.number(1) = sl.number
  266.   entry.userid = sl.userid
  267.   entry.password = sl.password
  268.   entry.scriptfile = scriptname
  269.   entry.macrofile = "genie.mac"
  270.   entry.emulation = ansi
  271.   entry.protocol = zmodem
  272.   entry.iconrespath = "bbsicons.dll"
  273.   entry.iconresid = 3
  274.   entry.useareacountry = 1
  275.   entry.tapidevice = getmodemname (sl.modem)
  276.   entry.countryid   = val(mid(n,151,5))
  277.   entry.countrycode = val(mid(n,156,5))
  278.   if updatephoneentry (entry) then
  279.     msgbox ("GEnie Entry Modified With New Information")
  280.   else
  281.     addphoneentry (entry)
  282.     msgbox ("Phone directory entry for GEnie created.")
  283.   end if
  284. end if
  285.  
  286. catch err_fileopen
  287.   msgbox "Could not create script: " + scriptname
  288.   goto main
  289.