home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pc3270sa.zip / vbdde / fsesexsk.frm < prev    next >
Text File  |  2002-02-28  |  12KB  |  377 lines

  1. VERSION 4.00
  2. Begin VB.Form FormSessExMacroSendKey 
  3.    Caption         =   "Send Key"
  4.    ClientHeight    =   5244
  5.    ClientLeft      =   3636
  6.    ClientTop       =   2304
  7.    ClientWidth     =   4704
  8.    BeginProperty Font 
  9.       name            =   "MS Sans Serif"
  10.       charset         =   0
  11.       weight          =   700
  12.       size            =   7.8
  13.       underline       =   0   'False
  14.       italic          =   0   'False
  15.       strikethrough   =   0   'False
  16.    EndProperty
  17.    ForeColor       =   &H80000008&
  18.    Height          =   5568
  19.    Left            =   3588
  20.    LinkMode        =   1  'Source
  21.    LinkTopic       =   "Form1"
  22.    ScaleHeight     =   5244
  23.    ScaleWidth      =   4704
  24.    Top             =   2028
  25.    Width           =   4800
  26.    Begin VB.TextBox TempText 
  27.       BackColor       =   &H00FFFFC0&
  28.       Height          =   372
  29.       Left            =   2400
  30.       MaxLength       =   255
  31.       TabIndex        =   17
  32.       Top             =   4800
  33.       Visible         =   0   'False
  34.       Width           =   252
  35.    End
  36.    Begin VB.ComboBox SessionIdList 
  37.       BackColor       =   &H00FFFFC0&
  38.       ForeColor       =   &H00000000&
  39.       Height          =   288
  40.       ItemData        =   "FSESEXSK.frx":0000
  41.       Left            =   1200
  42.       List            =   "FSESEXSK.frx":0052
  43.       Sorted          =   -1  'True
  44.       Style           =   2  'Dropdown List
  45.       TabIndex        =   2
  46.       Top             =   480
  47.       Width           =   492
  48.    End
  49.    Begin VB.CommandButton ExitDlg 
  50.       Cancel          =   -1  'True
  51.       Caption         =   "E&xit"
  52.       Height          =   372
  53.       Left            =   2880
  54.       TabIndex        =   15
  55.       Top             =   4800
  56.       Width           =   852
  57.    End
  58.    Begin VB.CommandButton Execute 
  59.       Caption         =   "&Execute"
  60.       Default         =   -1  'True
  61.       Height          =   372
  62.       Left            =   960
  63.       TabIndex        =   14
  64.       Top             =   4800
  65.       Width           =   852
  66.    End
  67.    Begin VB.Frame SendkeyFrame 
  68.       Caption         =   "Input Parameters"
  69.       ForeColor       =   &H80000008&
  70.       Height          =   4572
  71.       Left            =   120
  72.       TabIndex        =   0
  73.       Top             =   120
  74.       Width           =   4452
  75.       Begin VB.Frame Frame2 
  76.          Caption         =   "Outgoing Text, Commands and Macros"
  77.          Height          =   852
  78.          Left            =   120
  79.          TabIndex        =   12
  80.          Top             =   3480
  81.          Width           =   4212
  82.          Begin VB.TextBox TotalSendKeyText 
  83.             BackColor       =   &H00FFFFC0&
  84.             Height          =   492
  85.             Left            =   120
  86.             Locked          =   -1  'True
  87.             MaxLength       =   255
  88.             MultiLine       =   -1  'True
  89.             ScrollBars      =   1  'Horizontal
  90.             TabIndex        =   13
  91.             TabStop         =   0   'False
  92.             Text            =   "FSESEXSK.frx":00A4
  93.             Top             =   240
  94.             Width           =   3972
  95.          End
  96.       End
  97.       Begin VB.ComboBox CommandCombo 
  98.          BackColor       =   &H00FFC0C0&
  99.          Height          =   288
  100.          ItemData        =   "FSESEXSK.frx":00B2
  101.          Left            =   1440
  102.          List            =   "FSESEXSK.frx":0227
  103.          Style           =   2  'Dropdown List
  104.          TabIndex        =   7
  105.          Top             =   1680
  106.          Width           =   2772
  107.       End
  108.       Begin VB.OptionButton MacroOption 
  109.          Caption         =   "&Macro"
  110.          Height          =   252
  111.          Left            =   240
  112.          TabIndex        =   8
  113.          Top             =   2280
  114.          Width           =   1212
  115.       End
  116.       Begin VB.OptionButton CommandOption 
  117.          Caption         =   "&Command"
  118.          Height          =   252
  119.          Left            =   240
  120.          TabIndex        =   6
  121.          Top             =   1680
  122.          Value           =   -1  'True
  123.          Width           =   1212
  124.       End
  125.       Begin VB.OptionButton StringOption 
  126.          Caption         =   "&String"
  127.          Height          =   252
  128.          Left            =   240
  129.          TabIndex        =   4
  130.          Top             =   1080
  131.          Width           =   1212
  132.       End
  133.       Begin VB.TextBox MacroText 
  134.          BackColor       =   &H00FFC0C0&
  135.          Enabled         =   0   'False
  136.          Height          =   492
  137.          Left            =   1440
  138.          MaxLength       =   255
  139.          MultiLine       =   -1  'True
  140.          ScrollBars      =   1  'Horizontal
  141.          TabIndex        =   9
  142.          Top             =   2280
  143.          Width           =   2772
  144.       End
  145.       Begin VB.TextBox SendkeyText 
  146.          BackColor       =   &H00FFC0C0&
  147.          Enabled         =   0   'False
  148.          BeginProperty Font 
  149.             name            =   "System"
  150.             charset         =   0
  151.             weight          =   700
  152.             size            =   9.6
  153.             underline       =   0   'False
  154.             italic          =   0   'False
  155.             strikethrough   =   0   'False
  156.          EndProperty
  157.          ForeColor       =   &H00000000&
  158.          Height          =   492
  159.          Left            =   1440
  160.          MaxLength       =   255
  161.          MultiLine       =   -1  'True
  162.          ScrollBars      =   1  'Horizontal
  163.          TabIndex        =   5
  164.          Top             =   1080
  165.          Width           =   2772
  166.       End
  167.       Begin VB.Frame Frame1 
  168.          Caption         =   "Choose One or More"
  169.          Height          =   2532
  170.          Left            =   120
  171.          TabIndex        =   3
  172.          Top             =   840
  173.          Width           =   4212
  174.          Begin VB.CommandButton Clear 
  175.             Caption         =   "&Delete All"
  176.             Height          =   372
  177.             Left            =   2280
  178.             TabIndex        =   11
  179.             Top             =   2040
  180.             Width           =   972
  181.          End
  182.          Begin VB.CommandButton Command1 
  183.             Caption         =   "&Add "
  184.             Height          =   372
  185.             Left            =   840
  186.             TabIndex        =   10
  187.             Top             =   2040
  188.             Width           =   1092
  189.          End
  190.       End
  191.       Begin VB.Label Label1 
  192.          Caption         =   "Session &Id"
  193.          Height          =   252
  194.          Left            =   120
  195.          TabIndex        =   1
  196.          Top             =   360
  197.          Width           =   972
  198.       End
  199.    End
  200.    Begin VB.TextBox DataText 
  201.       BackColor       =   &H00C0FFFF&
  202.       Height          =   372
  203.       Left            =   2040
  204.       TabIndex        =   16
  205.       Text            =   "Text2"
  206.       Top             =   4800
  207.       Visible         =   0   'False
  208.       Width           =   204
  209.    End
  210. End
  211. Attribute VB_Name = "FormSessExMacroSendKey"
  212. Attribute VB_Creatable = False
  213. Attribute VB_Exposed = False
  214.  
  215. Private Sub Clear_Click()
  216.   TempText.Text = ""
  217.   TotalSendKeyText.Text = "[SENDKEY()]"
  218. End Sub
  219.  
  220.  
  221. Private Sub Command1_Click()
  222.  
  223.   If StringOption.Value = True Then
  224.     If TempText.Text = "" Then
  225.       temp$ = """" & SendkeyText.Text & """"
  226.     Else
  227.       temp$ = TempText.Text & "," & """" & SendkeyText.Text & """"
  228.     End If
  229.     If Len(temp$) > (255 - Len("[SENDKEY()]")) Then
  230.       MsgBox "Total string can only be 255 characters."
  231.       Exit Sub
  232.     End If
  233.     TempText.Text = temp$
  234.     TotalSendKeyText.Text = "[SENDKEY(" + TempText.Text + ")]"
  235.   
  236.   ElseIf CommandOption.Value = True Then
  237.     If TempText.Text = "" Then
  238.       temp$ = CommandCombo.Text
  239.     Else
  240.       temp$ = TempText.Text & "," & CommandCombo.Text
  241.     End If
  242.     If Len(temp$) > (255 - Len("[SENDKEY()]")) Then
  243.       MsgBox "Total string can only be 255 characters."
  244.       Exit Sub
  245.     End If
  246.     TempText.Text = temp$
  247.     TotalSendKeyText.Text = "[SENDKEY(" + TempText.Text + ")]"
  248.   
  249.   Else ' MacroOption.Value = True
  250.     If TempText.Text = "" Then
  251.       temp$ = MacroText.Text
  252.     Else
  253.       temp$ = TempText.Text & "," & MacroText.Text
  254.     End If
  255.     
  256.     If Len(temp$) > (255 - Len("[SENDKEY()]")) Then
  257.       MsgBox "Total string can only be 255 characters."
  258.       Exit Sub
  259.     End If
  260.     TempText.Text = temp$
  261.     TotalSendKeyText.Text = "[SENDKEY(macro " + TempText.Text + ")]"
  262.   End If
  263.  
  264. End Sub
  265.  
  266. Private Sub CommandOption_Click()
  267.   SendkeyText.Enabled = False
  268.   CommandCombo.Enabled = True
  269.   MacroText.Enabled = False
  270. End Sub
  271.  
  272.  
  273. Private Sub Execute_Click()
  274. On Error GoTo ErrHandler
  275.    FunctionComp = True
  276.    
  277.    OldMousePointer = MousePointer
  278.    MousePointer = 11 ' Hour Glass Mouse Pointer
  279.    
  280.    DisplayType$ = GetDisplayType$(SessionIdList.Text)
  281.    
  282.    If DisplayType$ = "NONE" Then
  283.       MousePointer = OldMousePointer
  284.       MsgBox MSG_INVALID_PSID + SessionIdList.Text, 48, MSG_SAMPLE_PROG
  285.       Exit Sub
  286.    End If
  287.    
  288.    temp$ = LTrim$(RTrim$(SessionIdList.Text))
  289.    If Len(temp$) > 0 Then
  290.       Topic$ = "Session" + SessionIdList.Text
  291.    Else
  292.       MousePointer = OldMousePointer
  293.       MsgBox MSG_PARA_ERROR, 48, MSG_SAMPLE_PROG
  294.       Exit Sub
  295.    End If
  296.  
  297.    If Len(TotalSendKeyText.Text) <> Len("[SENDKEY()]") Then
  298.      CommandString$ = TotalSendKeyText.Text
  299.    Else ' Nothing to Send
  300.      MousePointer = OldMousePointer
  301.      MsgBox "Add Text, Commands and Macros to send."
  302.      Exit Sub
  303.    End If
  304.    
  305.    rc = DoEvents()              'If you use VisualBasic V2.0, call
  306.                                 'DoEvents function each time before
  307.                                 'starting DDE conversation.
  308.    DataText.LinkTimeout = -1
  309.    DataText.LinkTopic = APPLICATION_NAME + "|" + Topic$
  310.    DataText.LinkMode = COLD
  311.    DataText.LinkExecute CommandString$
  312.    DataText.LinkMode = NONE
  313.  
  314.    MousePointer = OldMousePointer
  315.    If FunctionComp = True Then
  316.       MsgBox MSG_FUNCTION_COMP, 64, MSG_SAMPLE_PROG
  317.       EndStatus$ = MSG_OK
  318.    Else
  319.       MsgBox MSG_DDE_ERROR, 48, MSG_SAMPLE_PROG
  320.       EndStatus$ = MSG_NG
  321.    End If
  322.    TempLogData$ = Time$ + ":Session Execute Macro : " + EndStatus$ + Chr$(13) + Chr$(10) + Chr$(9)
  323.    TempLogData$ = TempLogData$ + MSG_APPLICATION + APPLICATION_NAME + """""" + Chr$(13) + Chr$(10) + Chr$(9)
  324.    TempLogData$ = TempLogData$ + MSG_TOPIC + """" + Topic$ + """" + Chr$(13) + Chr$(10) + Chr$(9)
  325.    TempLogData$ = TempLogData$ + "Command = " + """" + CommandString$ + """" + Chr$(13) + Chr$(10)
  326.    LogData$(LogEnd) = TempLogData$
  327.    UpdateLogPointer
  328.    Loged = True
  329.    Exit Sub
  330.  
  331. ErrHandler:
  332.    FunctionComp = False
  333.    Resume Next
  334. End Sub
  335.  
  336. Private Sub ExitDlg_Click()
  337.    DataText.LinkMode = NONE
  338.    Hide
  339. End Sub
  340.  
  341.  
  342. Private Sub UpdateLogPointer()
  343.     LogEnd = LogEnd + 1
  344.     If LogEnd = MAXLOGNUM + 1 Then
  345.        LogEnd = 0
  346.     End If
  347.  
  348.     If LogTop = LogEnd Then
  349.        LogTop = LogTop + 1
  350.        If LogTop = MAXLOGNUM + 1 Then
  351.           LogTop = 0
  352.        End If
  353.     End If
  354. End Sub
  355.  
  356. Private Sub Form_Load()
  357.   SessionIdList.ListIndex = 0
  358.   CommandCombo.ListIndex = 8
  359.   TotalSendKeyText.Text = "[SENDKEY()]"
  360.   AdjustForNT351 FormSessExMacroSendKey
  361. End Sub
  362.  
  363.  
  364. Private Sub MacroOption_Click()
  365.   SendkeyText.Enabled = False
  366.   CommandCombo.Enabled = False
  367.   MacroText.Enabled = True
  368. End Sub
  369.  
  370. Private Sub StringOption_Click()
  371.   SendkeyText.Enabled = True
  372.   CommandCombo.Enabled = False
  373.   MacroText.Enabled = False
  374. End Sub
  375.  
  376.  
  377.