Skip to main content
1-Visitor
Apr 17, 2016 2:02 PM UTC
Solved

Post CL file using VB.NET

            hi all,

        Is there any function to post the cl file using VB.NET

as a work around solution I have create the mapkey  , this mapkey work fine within the CREO , but when running thru vb.net I get following error ' Illegal characters in input. Re-enter:"

vb.net code below..

          mapkey1 = " mapkey pp @MAPKEY_LABELpostprocessor;~ Command `ProCmdMfgPostFile` ;\"
            mapkey1 = mapkey1 & "mapkey(continued) ~ Trail `UI Desktop` `UI Desktop` `DLG_PREVIEW_POST` `file_open`;\"
            mapkey1 = mapkey1 & "mapkey(continued) ~ Update `file_open` `Inputname` `op010`;\"
            mapkey1 = mapkey1 & "mapkey(continued) ~ Command `ProFileSelPushOpen@context_dlg_open_cmd` ;#DONE;#UNCL01.P02;\"
            mapkey1 = mapkey1 & "mapkey(continued) ~ Activate `texttool` `CloseButton`;"


            mfg_session.RunMacro(mapkey1)


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
14-Alexandrite
Apr 20, 2016 1:44 PM UTC

You are right. The culprit is the "\" character at the end of the lines.

Try:

mapkey1 = " ~ Command `ProCmdMfgPostFile` ;"
mapkey1 = mapkey1 & "~ Trail `UI Desktop` `UI Desktop` `DLG_PREVIEW_POST` `file_open`;"
mapkey1 = mapkey1 & "~ Update `file_open` `Inputname` `op010`;"
mapkey1 = mapkey1 & "~ Command `ProFileSelPushOpen@context_dlg_open_cmd` ;#DONE;#UNCL01.P02;"
mapkey1 = mapkey1 & "~ Activate `texttool` `CloseButton`;"

5 replies

14-Alexandrite
Apr 18, 2016 1:30 PM UTC

According to VB API documentation:

The method pfcSession.BaseSession.RunMacro runs a macro string. A VB API macro string is equivalent to a Creo Parametric mapkey minus the key sequence and the mapkey name.

Based on this your mapkey1 string should look like this:

          mapkey1 = " ~ Command `ProCmdMfgPostFile` ;\"
            mapkey1 = mapkey1 & "~ Trail `UI Desktop` `UI Desktop` `DLG_PREVIEW_POST` `file_open`;\"
            mapkey1 = mapkey1 & "~ Update `file_open` `Inputname` `op010`;\"
            mapkey1 = mapkey1 & "~ Command `ProFileSelPushOpen@context_dlg_open_cmd` ;#DONE;#UNCL01.P02;\"
            mapkey1 = mapkey1 & "~ Activate `texttool` `CloseButton`;"

Translate
pesau-21-VisitorAuthor
1-Visitor
Apr 19, 2016 4:27 PM UTC

hi,

I tried the code, I get the same error message

' Illegal characters in input. Re-enter:"

Translate
14-Alexandrite
Apr 20, 2016 1:44 PM UTC

You are right. The culprit is the "\" character at the end of the lines.

Try:

mapkey1 = " ~ Command `ProCmdMfgPostFile` ;"
mapkey1 = mapkey1 & "~ Trail `UI Desktop` `UI Desktop` `DLG_PREVIEW_POST` `file_open`;"
mapkey1 = mapkey1 & "~ Update `file_open` `Inputname` `op010`;"
mapkey1 = mapkey1 & "~ Command `ProFileSelPushOpen@context_dlg_open_cmd` ;#DONE;#UNCL01.P02;"
mapkey1 = mapkey1 & "~ Activate `texttool` `CloseButton`;"
Translate
1-Visitor
Apr 20, 2016 8:34 AM UTC

Print the finished mapkey1 to a textbox, textfile or whatever and compare the string character by character to the original mapkey.

Probably just a missing character, additional whitespace or something of that nature..

Translate
pesau-21-VisitorAuthor
1-Visitor
Apr 21, 2016 5:28 AM UTC

hi all

Thanks for you support,

Now the code is working fine after removing the  '"\"

Translate