hexagon logo

Creation of a script for a toolbar button to insert a command line

Hello all!!

How to create a script to insert this command lines in a program?
In the end i want to create a button for a toolbar that runs this script.


C1 =COMMENT/INPUT,NO,FULL SCREEN=NO,
Dimensional Numero: ?
C2 =COMMENT/INPUT,NO,FULL SCREEN=NO,
Molde Numero: ?
C3 =COMMENT/INPUT,NO,FULL SCREEN=NO,
Nome do Molde (Cliente): ?
C4 =COMMENT/INPUT,NO,FULL SCREEN=NO,
Referencia das peças: ?
C5 =COMMENT/INPUT,NO,FULL SCREEN=NO,
Quantidade de Peças: ?
C6 =COMMENT/INPUT,NO,FULL SCREEN=NO,
Teste Numero: ?
C7 =COMMENT/INPUT,NO,FULL SCREEN=NO,
Revisão do Relatório: ?
C8 =COMMENT/INPUT,NO,FULL SCREEN=NO,
Elaborado por: ?



Thank you in advanced for the help.

Lionheart1º
  • You will have to add a TextBox (EditBox_1) to display the requested info.
    Example:

    'D D D
    'Create Dialog With these Input items:
    Begin Dialog DIALOG_1 50,10, 206, 80, "Save report"
    Text 20,6,104,12, "Total measured dimensions:"
    Text 20,20,124,12, "Do you want save measured data?"
    OKButton 35,40,48,26
    CancelButton 120,40,48,26
    TextBox 118,5,37,12, .EditBox_1
    End Dialog

    ' Set the Dialog For Access:
    Dim Dialg As DIALOG_1

    Dialg.EditBox_1 = "Text"

    button1 = Dialog(Dialg)
    ' Declar VB variables:
    Dim Progtype As String
    'Quit If Dialog got canceled, Or go On To take the operator inputs And Put them into VB variables:
    If button1 = 0 Then
    Progtype= "END"
    Else
    'D D D
    End If
  • to davehocum,

    Your adjusted code (code below) working in direction dialog to script I need direction script to dialog.

    ['D D D
    'Create Dialog With these Input items:
    Begin Dialog DIALOG_1 50,10, 206, 80, "Save report"
    Text 20,6,104,12, "Total measured dimensions:"
    Text 20,20,124,12, "Do you want save measured data?"
    OKButton 35,40,48,26
    CancelButton 120,40,48,26
    TextBox 118,5,37,12, .EditBox_1
    End Dialog

    ' Set the Dialog For Access:
    Dim Dialg As DIALOG_1

    Dialg.EditBox_1 = "Text"

    button1 = Dialog(Dialg)
    ' Declar VB variables:
    Dim Progtype As String
    'Quit If Dialog got canceled, Or go On To take the operator inputs And Put them into VB variables:
    If button1 = 0 Then
    Progtype= "END"
    Else
    'D D D
    End If]


    In the best case scenario script should count dimensions in/out of tolerance and results display in dialog. |So I need pass variable script to dialog or if it isn't possible then pc dmis to dialog.

    ['D D D
    If Not OutTolValue is Nothing Then
    OutTolValue.LongValue = 0
    InTolValue =0
    For Each Cmd In Cmds
    If Cmd.Marked Then
    If Cmd.IsDimension Then
    If Cmd.Type <> DIMENSION_START_LOCATION And _
    Cmd.Type <> DIMENSION_END_LOCATION And _
    Cmd.Type <> DIMENSION_TRUE_START_POSITION And _
    Cmd.Type <> DIMENSION_TRUE_END_POSITION Then
    Set DCmd = Cmd.DimensionCommand
    CheckDim = Cmd.GetText ( OUTPUT_TYPE, 0)
    If CheckDim <> "" Then
    ReportDim = CheckDim
    End If
    If ReportDim = "BOTH" Or ReportDim = "REPORT" Then
    InTolValue= InTolValue +1
    If (DCmd.OutTol ) > 0.00005 Then
    OutTolValue.LongValue = OutTolValue.LongValue + 1
    End If
    ElseIf Cmd.Type = FEATURE_CONTROL_FRAME Then ' FCF
    I = 1
    FCFOT = Cmd.GetText (LINE2_OUTTOL, I)
    While (Not OutOfTol) And (FCFOT <> "")
    InTolValue= InTolValue +1
    If Val(FCFOT) > 0.00005 Then
    OutTolValue.LongValue = OutTolValue.LongValue + 1
    End If
    I = I + 1
    FCFOT = Cmd.GetText (LINE2_OUTTOL, I)
    Wend
    I = 1
    FCFOT = Cmd.GetText (LINE3_OUTTOL, I)
    While (Not OutOfTol) And (FCFOT <> "")
    InTolValue= InTolValue +1
    If Val(FCFOT) > 0.00005 Then
    OutTolValue.LongValue = OutTolValue.LongValue + 1
    End If
    I = I + 1
    FCFOT = Cmd.GetText (LINE3_OUTTOL, I)
    Wend
    End If
    End If
    End If
    End If
    Next Cmd
    'MsgBox OutTolValue.LongValue
    If Not OutTolValue is Nothing Then
    Program.SetVariableValue OutTolVar, OutTolValue
    End If
    Else
    MsgBox "Variabeln " + OutTolVar + " saknas i PCDMIS-programmet!"
    End If
    MsgBox "Total measured dimensions: " & InTolValue & " Out of tolerance: " & OutTolValue.LongValue
    'CountOutOfTol "OT"
    'D D D
    'Create Dialog With these Input items:
    Begin Dialog DIALOG_1 50,10, 200, 80,"Save report", .Enable
    'Text 20,10,200,12, "Total measured dimensions: & InTolValue"
    Text 20,20,200,12, "Do you want save measured data?"
    OKButton 35,40,48,26
    CancelButton 120,40,48,26
    End Dialog
    ' Set the Dialog For Access:
    Dim Dialg As DIALOG_1
    button1 = Dialog(Dialg)
    ' Declar VB variables:
    Dim Progtype As String
    'Quit If Dialog got canceled, Or go On To take the operator inputs And Put them into VB variables:
    If button1 = 0 Then
    Progtype= "END"
    Else
    'D D D]

    Any Ideas?
  • How I possibly could pass variable from main script to dialog and show variable as text?