hexagon logo

Need help with my script

First i hope you will excuse my programming skills. Its been 17 years since i learned programming in Java, so this code i made here is parts from other people's programs i put togther for this.

Most of my program work, and do what is was intended for.

My current problem is that when i try to make a string "PRINT_PATH" with information where to save my report.
Then it does not get used in my Print command part. Seems that the PRINT_PATH only have a "0" and not the prober path i made in my script.

Hope this make any sence Slight smile


LØBENR2 =COMMENT/INPUT,NO,'Løbenr.'
ORDRENR2 =COMMENT/INPUT,NO,'Ordrenr.'
ASSIGN/LØBENR1=STR(LØBENR2.INPUT)
ASSIGN/ORDRE1=ORDRENR2.INPUT
ASSIGN/EMNE1="7427270"
ASSIGN/REVISION1="2"
Test_samle =SCRIPT/FILENAME= M:\SCRIPT\SAMLESCRIPT.BAS
FUNCTION/Main,SHOW=YES,ARG1=REVISION1,ARG2=LØBENR1,ARG3=EMNE1,ARG4=ORDRE1,,
STARTSCRIPT/
C1000 =COMMENT/INPUT,NO,'Initialer'
ASSIGN/INI=C1000.INPUT
ASSIGN/PRINT_PATH="O:\QA\TEST\PRL05555\7427270_2_MP_5555-.PDF"
ENDSCRIPT/
$$ NO,***************************** Statestik *************************************************
STATS/OFF
TRACEFIELD/NO_DISPLAY,LIMIT=15 ; : EMNE1.INPUT
TRACEFIELD/NO_DISPLAY,LIMIT=15 ; : REVISION1.INPUT
TRACEFIELD/NO_DISPLAY,LIMIT=15 ; : STR(LØBENR1.INPUT)
TRACEFIELD/NO_DISPLAY,LIMIT=25 ; Ordre : ORDRENR2.INPUT
TRACEFIELD/NO_DISPLAY,LIMIT=15 ; PROCESS : CTP
TRACEFIELD/NO_DISPLAY,LIMIT=15 ; Initialer : STR(INI)
$$ NO,********************************** Sættes ind i ende af program ******************
PRINT/REPORT,EXEC MODE=END,$
TO_FILE=ON,AUTO=PRINT_PATH,$
TO_PRINTER=OFF,$
TO_DMIS_REPORT=OFF,FILE_OPTION=OVERWRITE,FILENAME=,$
REPORT_THEORETICALS=ALL,REPORT_FEATURE_WITH_DIMENSIONS=YES,$
PREVIOUS_RUNS=DELETE_INSTANCES

Sub main(REVISION1 As String, LØBENR1 As String, EMNE1 As String, ORDRE1 As String) 'bring newpn In As ARG1 from PCDMIS
Dim DmisApp As Object
Dim DmisPart As Object
Dim DmisCommands As Object
Dim DmisCommand As Object


Set DmisApp = CreateObject("PCDLRN.Application")
Set DmisPart = DmisApp.ActivePartProgram
Set DmisCommands = DmisPart.Commands
CommandCount = DmisCommands.Count
Set DmisCommand = DmisCommands.Item(CommandCount)
DmisCommands.InsertionPointAfter DmisCommand

Dim C1000
' Set C1000 = "" A Null String
C1000 = ""

Set DmisCommand = DmisCommands.Add(SET_COMMENT, True)
DmisCommand.Marked = True

retval = DmisCommand.PutText ("C1000", ID, 0)
retval = DmisCommand.SetToggleString (3, COMMENT_TYPE, 0)
retval = DmisCommand.PutText ("Initialer", COMMENT_FIELD, 1)
retval = DmisCommand.SetToggleString (1, OUTPUT_TYPE, 0)

Set DmisCommand = DmisCommands.Add(ASSIGNMENT, True)
DmisCommand.Marked = True
retval = DmisCommand.PutText ("INI", DEST_EXPR, 0)
retval = DmisCommand.PutText ("C1000.INPUT", SRC_EXPR, 0)

Dim PARTNAME2 As String
PARTNAME2 = EMNE1 + "_" + REVISION1 + "_MP_" + LØBENR1

Dim JOB_PATH As String
JOB_PATH = "O:\QA\TEST"
Dim REPORT_PATH1 As String
REPORT_PATH1 = JOB_PATH + "" + ORDRE1
Dim REPORT_PATH2 As String
REPORT_PATH2 = REPORT_PATH1 + ""
Dim REPORT_NAME As String
REPORT_NAME = PARTNAME2 + "-"
Dim PRINT_PATH1
PRINT_PATH1 = """" + REPORT_PATH2 + REPORT_NAME + ".PDF" + """"

Set DmisCommand = DmisCommands.Add(ASSIGNMENT, True)
DmisCommand.Marked = True

retval = DmisCommand.PutText ("PRINT_PATH", DEST_EXPR, 0)
retval = DmisCommand.PutText (PRINT_PATH1, SRC_EXPR, 0)

DmisPart.PARTNAME=PARTNAME2 'make the new control number, the part number
DmisPart.SERIALNUMBER=LØBENR1
DmisPart.REVISIONNUMBER=REVISION1
DmisPart.statscount=PROCESS1
DmisPart.refreshpart
DmisPart.save ' save the part program so it has the latest part number
Dim repwin As Object
Set repwin = DmisPart.reportwindow
repwin.refreshreport 'refresh report; now the report shows the latest part number.

On Error Resume Next
MkDir REPORT_PATH1

End Sub
Parents
  • ?? You add two commands to your PC-DMIS program, then you read what you added in the second command, what are you expecting?

    The commands are not executed just by adding them (as far as I know), and the above is not the correct way to test user input (which probably hasn't had a chance to be given yet). What vpt meant above was to produce PC-DMIS code like below, and execute it.

    L_C1000    =LABEL/
    C1000      =COMMENT/INPUT,NO,FULL SCREEN=NO,
                Enter your value:
                IF/C1000.INPUT == ""
                GOTO/L_C1000
                END_IF/
    


    But beware! It seems PC-DMIS evaluates the empty string to 0, so the above doesn't work, at least not in 2017 R2 SP3. I need to change the IF to

                IF/C1000.INPUT == "0"
    


    to make it work. This will make it impossible to use this code to input the value 0!
Reply
  • ?? You add two commands to your PC-DMIS program, then you read what you added in the second command, what are you expecting?

    The commands are not executed just by adding them (as far as I know), and the above is not the correct way to test user input (which probably hasn't had a chance to be given yet). What vpt meant above was to produce PC-DMIS code like below, and execute it.

    L_C1000    =LABEL/
    C1000      =COMMENT/INPUT,NO,FULL SCREEN=NO,
                Enter your value:
                IF/C1000.INPUT == ""
                GOTO/L_C1000
                END_IF/
    


    But beware! It seems PC-DMIS evaluates the empty string to 0, so the above doesn't work, at least not in 2017 R2 SP3. I need to change the IF to

                IF/C1000.INPUT == "0"
    


    to make it work. This will make it impossible to use this code to input the value 0!
Children
No Data