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

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