Skip to main content
1-Visitor
April 17, 2016
Solved

Post CL file using VB.NET

  • April 17, 2016
  • 3 replies
  • 2168 views

            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.
Best answer by GabrielZaha

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`;"

3 replies

14-Alexandrite
April 18, 2016

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`;"

pesau-21-VisitorAuthor
1-Visitor
April 19, 2016

hi,

I tried the code, I get the same error message

' Illegal characters in input. Re-enter:"

14-Alexandrite
April 20, 2016

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`;"
1-Visitor
April 20, 2016

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..

pesau-21-VisitorAuthor
1-Visitor
April 21, 2016

hi all

Thanks for you support,

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