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


  • I only use those when breaking string directory paths i.e. "C:\Users\Public\Documents\WAI\PC-DMIS\2015.1" + Variable + "\\FolderName". Never had to use double \\ in between everything...strange.


    Double \\ is only needed in front of some special characters, as the combination of a single backslash and the special character means PC-DMIS should do something else.

    Specifically, if you end a string with a backslash, like "C:\Programs\" PC-DMIS will read the combination \" to mean "add a quotation mark to the string", and signal the line as an error because there is no end quote. Here you must write "C:\Programs\\" to get the backslash into the string, and the end quote interpreted in the normal way.

    There were some other characters that also got special treatment, but I don't remember right now which they were.

    Edit1: OK, this forum is doing the same thing - it seems I need to double the double backslashes to see them...
    Edit2: Aaaargh! This forum drives me crazy sometimes!
Reply


  • I only use those when breaking string directory paths i.e. "C:\Users\Public\Documents\WAI\PC-DMIS\2015.1" + Variable + "\\FolderName". Never had to use double \\ in between everything...strange.


    Double \\ is only needed in front of some special characters, as the combination of a single backslash and the special character means PC-DMIS should do something else.

    Specifically, if you end a string with a backslash, like "C:\Programs\" PC-DMIS will read the combination \" to mean "add a quotation mark to the string", and signal the line as an error because there is no end quote. Here you must write "C:\Programs\\" to get the backslash into the string, and the end quote interpreted in the normal way.

    There were some other characters that also got special treatment, but I don't remember right now which they were.

    Edit1: OK, this forum is doing the same thing - it seems I need to double the double backslashes to see them...
    Edit2: Aaaargh! This forum drives me crazy sometimes!
Children
  • The only *sane* way to implement such a thing is to *always* replace <backslash><any char> with something else, and *always* convert <backslash><backslash> to a single <backslash>. Not doing different things depending on where in the text/string it occurs!

    (Now, don't tell me this forum is eating angular brackets too!)