cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Post CL file using VB.NET

pesau-2
2-Guest

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.
1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

5 REPLIES 5

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

hi,

I tried the code, I get the same error message

' Illegal characters in input. Re-enter:"

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`;"
huggre
1-Newbie
(To:pesau-2)

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

hi all

Thanks for you support,

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

Top Tags