Code snippets? embedding other languages

going to probe some of you for some information:
I'm looking for some code snippets to load, into a c program, another language module, and execute a function by name...
any language will do, I'm just looking for a point of reference...
if possible, and you know how, I'd like to know how to convert a simple native type in the language, to a C struct...
i'll make up a language to demonstrate what I'm looking for:
# !/usr/bin/env phrak
#phrak-script
string hello_whirled()
string s = "hello";
return s + " whirled";
#include <phrak-script.h>
phrakscript_init();
phrakscript* s = phrak_script_load("test.phrak");
phrakscript_obj* o = s->get_symbol("hello_whirled");
if(o->is_callable())
std::cout << o->call().to_string();
phrakscript_free_obj(o);
phrakscript_free(s);

no, the scripting language was a demo... I'm not writing one...
Right now I'm going to work on an indepth module framework... the core of the WM is pretty easy, if I have it conceptualized correctly... it's not hard to make a C/C++ only module framework, but I'd like to understand how one accesses external languages so I can design it properly...
right now, I'm torn between the following styles of "linking" modules to the core:
apache style: precisely named C structures which contain function pointers
xchat style: precisely named functions, loaded individually
misc ideas: one single "switch" type function which calls the appropriate module function (??)
basically, before I finalize the "glue", I'd like to know if that glue is extensible...

Similar Messages

  • Code Snippets in MEF Editor extension VS2012

    I am trying to implement code snippets with a MEF editor extension, I followed the walkthrough "Implementing Code Snippets" from the link: http://msdn.microsoft.com/en-us/library/ff926100(v=vs.110).aspx
    The implementation is based on the walkthrough Displaying Statement Completion. This feature works fine.
    The first section of "Implementing Code Snippets" is "Creating and Registering Code Snippets" which does not work. At the end of the section is the step 8:
    Build and run the project. In the experimental instance of Visual Studio that starts when the project is run, the snippet you just registered
    should be displayed in the Code Snippets Manager under
    the TestSnippets language.
    There are no errors, but the Code Snippets Manager does not display the TestSnippets language, and as a consequence the snippets are not there. I have been stuck for a few weeks now with this, and could not find resources to understand the issue.
    Any idea on how to overcome this issue will be much appreciated.
    Thanks

    Hi,
    I have to say that I can reproduce your issue on my machine via the steps provided in the walkthrough. However, I finally add that code snippets to C# language not that custom TestSnippets language.
    Here are some modifications which are made on my side, maybe these listed items can be helpful for you to trouble-shoot your issue:
    1). Delete the following line from the test.snippet file.
    <?xml version="1.0" encoding="utf-8" ?>
    2). Edit the test.snippet file, set <Code Language="CSharp">
    3). Edit the SnippetIndex.xml file, set  <Language Lang="CSharp" Guid="{694DD9B6-B865-4C5B-AD85-86356E9C88DC}">
    4). Edit the SnippetUtilities class, and set
    internal const string LanguageServiceGuidStr = "694DD9B6-B865-4C5B-AD85-86356E9C88DC";
    5). Then build and run your project again. And this time you should get the snippet under C# language.
    Thanks.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Other Language Support

    Hi Friends,
    May i know how to write code to support other languages?
    Ex Google news is avaliable in may languages..
    How we can show other languages in web page using Java?
    May i know any tutorials available?
    Thanking You

    I have never got a chance to work on it but Java supports localization.
    Looking at your need guess these can help.
    See here: [http://java.sun.com/developer/technicalArticles/Intl/MultilingualJSP/|http://java.sun.com/developer/technicalArticles/Intl/MultilingualJSP/]
    [http://download.oracle.com/docs/cd/B10501_01/server.920/a96529/ch9.htm|http://download.oracle.com/docs/cd/B10501_01/server.920/a96529/ch9.htm]
    On DB side, you may have UTF-8 encoding to store non-standard characters.

  • Difficulty in finding the "Code Snippets" panel on my Flash Pro CS5.5

    I have tried window/code snippets but the panel doesn't appear.

    click window>workspace>animator and then click window>code snippets.

  • Audio captcha is not working in mac safari 5.1.7. We used below code snippet that is working in other browser like IF 7,8,9, crome and firefox. Audio refresh is also not happening. When submit Audio Captcha then jcapcha framework giving InvocationTargetEx

    Audio captcha is not working in mac safari 5.1.7.
    We used a code snippet that is working in other browser like IF 7,8,9, crome and firefox.
    Audio refresh is also not happening.
    When submit Audio Captcha then jcapcha framework giving InvocationTargetException.
    <Edited By Host>

    Audio captcha is not working in mac safari 5.1.7.
    We used a code snippet that is working in other browser like IF 7,8,9, crome and firefox.
    Audio refresh is also not happening.
    When submit Audio Captcha then jcapcha framework giving InvocationTargetException.
    <Edited By Host>

  • How to translate english into other language in codes?

    Hi Experts,
    Is there any API in ABAP to translate one language into another?
    Thanks

    Hi Vincent,
    There are different ways to translate into other languages.
    For text elements in reports, Menu GOTO -> translation.
    SE63 also you can use depends on the type object/text.
    Let me know if you want more info.
    Regards,
    Manju

  • Add code snippets iBooks author

    How can I add code snippets to an iBooks author project?
    Is there a way to format a piece of text so that it would recognize Objective-C language?
    Or is there a way to insert a code snippet in some sort of box that will make it stand out from the rest of the text?

    ...is there a way to insert a code snippet in some sort of box that will make it stand out from the rest of the text?
    Have you tested the new pop-up widget?

  • Code snippets

    To all the programmers out there, where do you keep your code snippets?

    I have a simple snippet directory, which is a git-repository, in my home-directory. This directory contains subdirectories for a few programming languages I'm using (e.g. ruby, python, c, c++, ...) in which the snippets are stored. I'm using only a single PC for development, so I have no real synchronization issues. But otherwise you might consider storing your snippets on GitHub or another Git-server with which you can easily synchronize the snippets.
    But frankly I don't use this kind of "static" snippets very often. I'm using TextMate-like snippets very often these days, with which you can type e.g. for<Tab> and the expression will be expanded to a for-loop. For Vim I'm used to use snippetsEmu very often. It's a really great plugin and if you're using Vim you should give it a try. At the moment I'm using snip-fu, which is an experimental Vim plugin I've written, which is similar to snippetsEmu. But there is no official release yet, so you might be better off using snippetsEmu .
    If you aren't using Vim but Gedit or SciTe, you can use a plugin as well to enable snippet support.

  • Support for Code Snippets in Visual Studio Lanuage Service

    I need to add support for Code Snippets to my Lanuage Service(which I am writing using MPF). I am doing all according to this MSDN
    article.
    First I've added attribute to my package class, like:
    [ProvideLanguageCodeExpansion(typeof(MyLanguageService), "My Language", 0, "My Language",
    @"C:\My\SnippetsIndex.xml", // Path to snippets index
    SearchPaths = @"C:\My\Snippets\")] // Path to snippets
    SnippetsIndex.xml file content is following:
    <?xml version="1.0" encoding="utf-8" ?>
    <SnippetCollection>
    <Language Lang="My Language" Guid="{1c9caaac-65b9-40f8-9f39-ab77a824d351}">
    <SnippetDir>
    <OnOff>On</OnOff>
    <Installed>true</Installed>
    <Locale>%LCID%</Locale>
    <DirPath>C:\My\Snippets\</DirPath>
    <LocalizedName>Snippets</LocalizedName>
    </SnippetDir>
    </Language>
    </SnippetCollection>
    And in this folder there is one file with default snippet, like:
    <?xml version="1.0" encoding="utf-8"?>
    <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
    <Header>
    <SnippetTypes>
    <SnippetType>Expansion</SnippetType>
    </SnippetTypes>
    <Title>SnippetFile1</Title>
    <Author>dd</Author>
    <Description>
    </Description>
    <HelpUrl>
    </HelpUrl>
    <Shortcut>
    </Shortcut>
    </Header>
    <Snippet>
    <Code Language="My Language" Delimiter="$"><![CDATA[TEST TEST]]></Code>
    </Snippet>
    </CodeSnippet>
    </CodeSnippets>
    I've added method for detecting installed snippets from this article to
    LanguageService class:
    private void _GetSnippets(Guid languageGuid,
    ref ArrayList expansionsList)
    IVsTextManager textManager = (IVsTextManager)Package.GetGlobalService(typeof(SVsTextManager));
    if (textManager != null)
    IVsTextManager2 textManager2 = (IVsTextManager2)textManager;
    if (textManager2 != null)
    IVsExpansionManager expansionManager = null;
    textManager2.GetExpansionManager(out expansionManager);
    if (expansionManager != null)
    // Tell the environment to fetch all of our snippets.
    IVsExpansionEnumeration expansionEnumerator = null;
    expansionManager.EnumerateExpansions(languageGuid,
    0, // return all info
    null, // return all types
    0, // return all types
    1, // include snippets without types
    0, // do not include duplicates
    out expansionEnumerator);
    if (expansionEnumerator != null)
    // Cache our expansions in a VsExpansion array
    uint count = 0;
    uint fetched = 0;
    VsExpansion expansionInfo = new VsExpansion();
    IntPtr[] pExpansionInfo = new IntPtr[1];
    // Allocate enough memory for one VSExpansion structure. This memory is filled in by the Next method.
    pExpansionInfo[0] = Marshal.AllocCoTaskMem(Marshal.SizeOf(expansionInfo));
    expansionEnumerator.GetCount(out count);
    for (uint i = 0; i < count; i++)
    expansionEnumerator.Next(1, pExpansionInfo, out fetched);
    if (fetched > 0)
    // Convert the returned blob of data into a structure that can be read in managed code.
    expansionInfo = (VsExpansion)Marshal.PtrToStructure(pExpansionInfo[0], typeof(VsExpansion));
    if (!string.IsNullOrEmpty(expansionInfo.shortcut))
    expansionsList.Add(expansionInfo);
    Marshal.FreeCoTaskMem(pExpansionInfo[0]);
    If I call this method from package initializing method I got count
    == 0 in line
    expansionEnumerator.GetCount(out count);
    And if I call it from method ParseSource in LanguageService class
    as MSDN recommends, I've just got expansionEnumerator
    == null.
    I've spent much time trying to understand whats going on, but still got this strange result. Could anybody tell me what am I doing wrong?

    Your XML files look good. Maybe it is necessary to add a shortcut to the snippet.
    In my ViewFilter, I also react on the VSStd2KCmdID.INSERTSNIPPET command in HandlePreExec():
    case VSConstants.VSStd2KCmdID.INSERTSNIPPET:
    ExpansionProvider ep = this.GetExpansionProvider();
    if (ep != null) {
    ep.DisplayExpansionBrowser(this.TextView, "Snippets", null, false, null, false);
    return true;

  • JSAPI - other languages than English; MIDlet - settings loading; JSAPI - al

    Hello!
    I need to create application which uses speech recognition. At first I thought about using CMU Sphinx (PocketSphinx or, possibly, Sphinx4). Later I thought about JSAPI. (Sphinx somehow uses JSAPI but I don't know what is the difference between JSAPI and Sphinx).
    I have read almost all (up to 6.7.9) of the following tutorial: http://java.sun.com/products/java-media/speech/forDevelopers/jsapi-guide.pdf. Unfortunately I couldn't've found one important thing, i.e. how to create acoustic model for other language than English?
    Thanks in advance for your answers :-)!
    PS There are some other things which I'd like to know:
    1) How to load some settings from file (I guess nowadays configuration files are created with the use of XML but I dunno)?
    2) How to maintain algorithm which is used by MIDlet which involves JSAPI? I mean there are some different things which my MIDlet needs to do. I guess it is good habit to divide different goals into separate parts of code (due to object-oriented programming).
         In my case there are some different things:
         a) speech recognition of audio input, i.e. changing input audio stream into output text string
         b) analysis of that text string and according to this string choosing the proper transition in my algorithm
         In general I have written my algorithm on sheet of paper and it takes about ten A4 sheets of paper. Because of it I thought there should be some way to write this algoritm maybe outside the code, in some kind of file which would contain this algorithm. Maybe there is other good way to implement this algorithm, not necesarilly in the code.
         c) sending of results through httpconnection with the use of POST method
         d) receiving in on TomCat on server
    3) Which method should I use to receive the recognized speech? I found these:
         a) FinalRuleResult, b) Result -> getBestToken, c) getSpokenText, d) ResultToken of RuleGrammar
    4) Can you give me any full examples of JSAPI usage? (Not just short parts of code like in this JSAPI guide)?
    Greetins :-)!

    Praveen, Yes the infoobject is language dependent.  The problem did not happen in BWQ but came up in BWP.  so I am not sure at this time what is causing in production that didn't happen in BWQ.
    Thanks,
    Syed.

  • Working code snippet for JSSE 1.0.2

    This code works only with JSSE 1.0.2. JSSE 1.0.1 has a bug I believe which give null cert chain
    error when using client authorization.
    Below is a java code snippet to create a SSL server and client sockets.
    SocketsFactory.java
    This class is an utility class which gets you the Secure Socket for server and the client.
    It reads from the properties file.
    public class SocketsFactory{
    /** Creates a SSL client socket. It uses the properties obtained from the
    * sslPropsFile to create the client socket.
    * @param sslPropsFile The ssl properties file that contains information about the provider etc.
    * @param host The host to connect to.
    * @param port The port on which this socket should attempt to connect
    * @throws IOException if there was any exceptions in creating the sockets or if the properties file
    * was not found or corrupted.
    * @return returns the socket that was created.
         public static Socket createSecureSocket(final String sslPropsFile, String host,int port)throws IOException{
              Properties props = readPropertiesFile(sslPropsFile);
              SSLSocketFactory factory = null;
              System.setProperty("javax.net.ssl.trustStore",(String)props.get("com.ibm.idmg.ssl.keyStore"));
              //Getting a secure client socket using sun..
              try {
                   addProvider(props);
                   // Set up a key manager for client authentication
                   // if asked by the server. Use the implementation's
                   // default TrustStore and secureRandom routines.
                   SSLContext ctx = getSSLContext(props);
                   factory = ctx.getSocketFactory();
              catch (Exception e) {
                   e.printStackTrace();
                   throw new IOException(e.getMessage());
              SSLSocket client =(SSLSocket)factory.createSocket(host, port);
              client.startHandshake();
              return client;
    /** Creates a SSL server socket based on sun's implementation using JSSE. Uses the
    * sslPropsFile to get the keystore used for validating certificates and their
    * passwords.
    * @param sslPropsFile The properties file containing SSL provider, key passwords etc.,
    * @param port The port to which this socket should listen at.
    * @throws IOException If the properties file was not found or it was corrupted or if there was any
    * other errors while socket creation.
    * @return the serversocket object.
         public static ServerSocket createSecureServerSocket(final String sslPropsFile,int port) throws IOException{
              Properties props = readPropertiesFile(sslPropsFile);
              String trustStore = (String)props.get("com.ibm.idmg.ssl.keyStore");
              System.setProperty("javax.net.ssl.trustStore",trustStore);
              //     Getting a sun secure server socket
              SSLServerSocketFactory ssf = null;
              try {
                   addProvider(props);
                   // set up key manager to do server authentication
                   SSLContext ctx = getSSLContext(props);
                   ssf = ctx.getServerSocketFactory();
              } catch (Exception e) {
                   e.printStackTrace();
                   throw new IOException(e.getMessage());
              SSLServerSocket socket = (SSLServerSocket)ssf.createServerSocket(port);
              socket.setNeedClientAuth(true);
              return socket;          
         * Internally used function to read a provider from the properties and
         * add it as the current ssl provider. The properties should have the
         * property <i>com.ibm.idmg.ssl.sslProvider</i> defined. Otherwise
         * throws NullPointerException.
         private static void addProvider(Properties props) throws Exception{
              String provider = (String)props.get("com.ibm.idmg.ssl.sslProvider");
              if (provider == null)
                   throw new NullPointerException("com.ibm.idmg.ssl.sslProvider is not specified!");
              java.security.Security.addProvider((java.security.Provider)Class.forName(provider).newInstance());
         * Internally used function to read a file and return it as java properties.
         * It uses java.util.Properties. Throws FileNotFoundException if the file
         * was not found. Otherwise returns the properties.
         private static Properties readPropertiesFile(final String file) throws IOException{
              if (file == null)
                   throw new IOException("SSL Context File name not specified!");
              FileInputStream in = new FileInputStream(file);
              Properties properties = new Properties();
              properties.load(in);
              in.close();
              in = null;
              return properties;
         * Internal function used to retrieve a SSLContext object. It is used primarily
         * for creating SSL sockets that can authenticate each other based on the
         * keystores specified using the properties.
         private static SSLContext getSSLContext(Properties props) throws Exception{
              SSLContext ctx;
              KeyManagerFactory kmf;
              KeyStore ks;
              String password = (String)props.get("com.ibm.idmg.ssl.keyStorePassword");
              if (password == null)
                   password = System.getProperty("javax.net.ssl.keyStorePassword");
              char[] passphrase = password.toCharArray();
              ctx = SSLContext.getInstance("TLS");
              kmf = KeyManagerFactory.getInstance("SunX509");
              ks = KeyStore.getInstance("JKS");
              String keyStoreFile = (String)props.get("com.ibm.idmg.ssl.keyStore");
              if (keyStoreFile == null)
                   keyStoreFile = System.getProperty("javax.net.ssl.keyStore");
              FileInputStream in = new FileInputStream(keyStoreFile);
              ks.load(in, passphrase);
              in.close();
              in = null;
              //     All keys in the KeyStore must be protected by the same password.
              String keyPassword = (String)props.get("com.ibm.idmg.ssl.keyPassword");
              if (keyPassword != null)
                   passphrase = keyPassword.toCharArray();
              kmf.init(ks, passphrase);
              ctx.init(kmf.getKeyManagers(), null, null);
              return ctx;
    The Server properties file looks like this.
    #     Specify the SSL provider here.
    #     Using sun's reference implementation for testing..
    com.ibm.idmg.ssl.sslProvider=com.sun.net.ssl.internal.ssl.Provider
    #     Specify the keystore file that this ssl socket should use
    com.ibm.idmg.ssl.keyStore=server.ks
    #     Specify the password for this keystore file
    com.ibm.idmg.ssl.keyStorePassword=servercanpass
    #     Specify the password used to protect the keys in the keystore
    #     Note: all the keys should have the same password
    com.ibm.idmg.ssl.keyPassword=icanpass
    The client properties file
    #     Specify the SSL provider here.
    #     Using sun's reference implementation for testing..
    com.ibm.idmg.ssl.sslProvider=com.sun.net.ssl.internal.ssl.Provider
    #     Specify the keystore file that this ssl socket should use
    com.ibm.idmg.ssl.keyStore=client.ks
    #     Specify the password for this keystore file
    com.ibm.idmg.ssl.keyStorePassword=clientshouldpass
    #     Specify the password used to protect the keys in the keystore
    #     Note: all the keys should have the same password
    com.ibm.idmg.ssl.keyPassword=canipass
    Now to create the certificates..
    Its a 5 step process
    1) Create the keystore file.
         keytool -genkey -alias mohan -dname "CN=Mohan Tera OU=IS O=IM L=sanjose S=NY C=US" -keystore server.ks -storepass servercanpass -validity 180 -keypass icanpass
    2) Create a self signed certificate. If you need to get it signed from
         verisign then you have to create a certificate request. For testing purposes,
         you can create a self signed certificate.
         keytool -selfcert -alias mohan -dname "CN=Mohan Tera OU=IS O=IM L=sanjose S=NY C=US" -keystore server.ks -storepass servercanpass -validity 180 -keypass icanpass
    3) Export the public key from the keystore to a certificate file that is to be imported to the client keystore.
         keytool -export -alias mohan -file fromserver.cer -keystore server.ks -storepass servercanpass
    4) Repeat the above steps for the client also..
         a)
         keytool -genkey -alias moks -dname "CN=Jennifer Poda OU=Javasoft O=Sun L=Edison S=NJ C=US" -keystore client.ks -storepass clientshouldpass -validity 180 -keypass canipass
         b)
         keytool -selfcert -alias moks -dname "CN=Jennifer Poda OU=Javasoft O=Sun L=Edison S=NJ C=US" -keystore client.ks -storepass clientshouldpass -validity 180 -keypass canipass
         c)
         keytool -export -alias moks -file fromclient.cer -keystore client.ks -storepass clientshouldpass
    5) Import the certificates that were exported in steps 3 and 4c in client and server keystore respectively.
         keytool -import -trustcacerts -alias new -file fromserver.cer -keypass keypass -storepass clientshouldpass -keystore client.ks
         keytool -import -trustcacerts -alias new -file fromclient.cer -keypass keypass -storepass servercanpass -keystore server.ks
    And voila you are all set to go..
    Hope this explains to all the people who are struggling with JSSE..
    Regards,
    Moks

    when i using your method in my code i get the following exception
    pl. help me.
    java.security.UnrecoverableKeyException: Cannot recover key
    at sun.security.provider.KeyProtector.recover(KeyProtector.java:301)
    at sun.security.provider.JavaKeyStore.engineGetKey(JavaKeyStore.java:103
    at java.security.KeyStore.getKey(KeyStore.java:289)
    at com.sun.net.ssl.internal.ssl.X509KeyManagerImpl.<init>(DashoA6275)
    at com.sun.net.ssl.internal.ssl.KeyManagerFactoryImpl.engineInit(DashoA6
    275)
    at javax.net.ssl.KeyManagerFactory.init(DashoA6275)
    at ClassFileServer.getServerSocketFactory(ClassFileServer.java:145)
    at ClassFileServer.main(ClassFileServer.java:115)
    Exception in thread "main" java.lang.NullPointerException
    at ClassFileServer.main(ClassFileServer.java:117)

  • How do I create a drop down menu with Code Snippets and Flash CS5?

    Hi
    I am wondering how to create a drop down menu using the Code Snippets and CS5?
    There are some older tutorials out there and it would be nice if someone could create an updated drop down menu tutorial, and it might be me doing this after I have figured out the best and easiest way to create one, but before that I need some pointers.
    Thanks!
    Have a great day!
    Paal Joachim

    You can use panel widget to create manual menu where set to show target on rollover.
    Something like this :
    http://muse.adobe.com/exchange-library/menu-vertical-accordion-widget-1
    http://muse.adobe.com/exchange-library/tiptop-navigation-menu
    Thanks,
    Sanjit

  • Is there a way to remove a code snippet  from the library of my snippets in Edge Animate CC2014?

    Is there a way to remove a code snippet  from the library of my snippets in Edge Animate CC2014?

    When you click on "My Snippets", it will list down all saved user snippets, which you can right-click and click on "delete" to delete it.

  • OLE2 Doc/Code snippet to assist in creating a word doc with underlined text

    I would like to use OLE2 to create a simple Word document. I would like some of the text to be bold/underlined and the rest of the text to be regular. There seems to be a serious dearth of information regarding OLE2 in conjunction with PS/SQL in Word applications. We're running Forms 6 and Oracle 9i.
    I don't believe that I need to use the techniques described in the Forms Manual (OLE2 containers, etc.). I have managed to create a Word doc and write some text to it but I've been unable to find out/guess at the syntax that I'd need to control bolding and underlining. It would be a big help if I could just find the syntax for Word OLE2 commands. During my documentation search, I seem to remember a post that mentioned 'Reference 2' and maybe 'Reference 3' as a source of information related to OLE2 in PL/SQL code. If anyone can give me a shove in the right direction I'm more than willing to read the manuals. I won't be too disappointed if someone could send me a code snippet either!
    Thanks,
    Ron Walker

    Hi Ron,
    Office ships with a number of resources that you will find indispensable for the sort of work you're doing. Take a look at the VBA IDE (Visual Basic for Applications IDE). You may already be familiar with it, if you've ever written a Word macro, but to call it a macro editor sells it short -- it is a full-blown development environment. Its Object Browser allows you to browse Word's object model, search by keyword, and view call syntax.
    In case you aren't familiar with the VBA IDE, try this:
    1. Open Word
    2. Switch between Word and the VBA IDE by pressing <Alt><F11>
    3. Open the Object Browser by pressing <F2>
    Spend some time familiarizing yourself with the Object Browser. Constrain its scope by selecting the Word library instead of <All Libraries> (the default). Learn to search by keyword. Click on items within your results for details. If Visual Basic Help is installed, pressing <F1> will raise help on a selected item.
    Visual Basic Help may not be part of the Compact or Typical install. Running Office Setup, either from the install CD, or through Add/Remove Programs under Control Panel, will allow you to add the feature. (The Office installer lists Visual Basic Help in the Office Tools section.)
    I have found the VBA IDE to be the perfect place for prototyping and testing automated processes. It is a far friendlier environment for learning Office automation, as it offers code completion and context-driven help. Once the process works, I manually translate my VBA routine into Forms PL/SQL, which is fairly painless. I've written a short tutorial, that I will post shortly -- I didn't want to bury it in this thread!
    Hope this helps,
    Eric Adamson
    Lansing, Michigan

  • Problem in sending the smartform as email for other language except english

    Hi Experts,
    I could not send the smartform as an attachment for other languages, but where as i could send it in english.
    The program is working fine with print priview but not when sending the SF as an attachment
    (in other languages except english).
    Please do find the below code which i used to send the smartform as an attachment.
    Please let me know if there is any mistake in the code.
        wa_ctrlop-LANGU = nast-spras.
        wa_ctrlop-getotf = 'X'.
        wa_ctrlop-no_dialog = 'X'.
        wa_compop-tdnoprev = 'X'.
        CALL FUNCTION lf_fm_name                  "'/1BCDWB/SF00000197'
          EXPORTING
            control_parameters = wa_ctrlop
            output_options     = wa_compop
            user_settings      = 'X'
            is_ekko            = l_doc-xekko
            is_pekko           = l_doc-xpekko
            is_nast            = l_nast
            iv_from_mem        = l_from_memory
            iv_druvo           = iv_druvo
            iv_xfz             = iv_xfz
          IMPORTING
            job_output_info    = wa_return
          TABLES
            it_ekpo            = l_doc-xekpo[]
            it_ekpa            = l_doc-xekpa[]
            it_pekpo           = l_doc-xpekpo[]
            it_eket            = l_doc-xeket[]
            it_tkomv           = l_doc-xtkomv[]
            it_ekkn            = l_doc-xekkn[]
            it_ekek            = l_doc-xekek[]
            it_komk            = l_xkomk[]
          EXCEPTIONS
            formatting_error   = 1
            internal_error     = 2
            send_error         = 3
            user_canceled      = 4
            OTHERS             = 5.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    *Convert the data from OTF to PDF format
        it_otf[] = wa_return-otfdata[].
        CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            format                = 'PDF'
            max_linewidth         = 132
          IMPORTING
            bin_filesize          = l_len_in
            bin_file              = lp_xcontent
          TABLES
            otf                   = it_otf
            lines                 = it_tline
          EXCEPTIONS
            err_max_linewidth     = 1
            err_format            = 2
            err_conv_not_possible = 3
            OTHERS                = 4.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        TRY.
      ---------- create persistent send request ----------------------
            send_request = cl_bcs=>create_persistent( ).
            len = XSTRLEN( lp_xcontent ).
    transform to solix tab
            lt_solix =
              cl_document_bcs=>xstring_to_solix(
                ip_xstring = lp_xcontent ).
    Create Body to the E-mail.
            APPEND Text-005 TO l_text.
    Attachment Name
            l_ponumber = text-004.
            CONCATENATE l_ponumber l_doc-xekko-ebeln INTO l_ponumber.
    Subject for the E-Mail.
            l_subject = text-001.
            CONCATENATE l_subject l_doc-xekko-ebeln INTO l_subject.
    *create document E-Mail.
    *TRY.
    CALL METHOD cl_document_bcs=>create_document
      EXPORTING
        i_type        = 'RAW'
        i_subject     = l_subject
        i_length      = '13'
        i_language    = nast-spras
       i_importance  =
       i_sensitivity =
        i_text        = l_text
       i_hex         =
       i_header      =
       i_sender      =
      receiving
        RESULT        = l_email_object
    CATCH cx_document_bcs .
    *ENDTRY.
           CALL METHOD cl_document_bcs=>create_document
             EXPORTING
               i_type    = 'RAW'
               i_subject = l_subject
               i_length  = '13'
               i_text    = l_text
             RECEIVING
               result    = l_email_object.
    *Create PDF Document
            bcs_doc =  cl_document_bcs=>create_document(
                                            i_type     = 'PDF'
                                            i_subject  = l_ponumber
                                            i_length   = len
                                            i_language = nast-spras
                                            i_hex     = lt_solix
    *Type casting
            obj_pdf_file ?= bcs_doc.
    Add PDF document as an attachment
            CALL METHOD l_email_object->add_document_as_attachment
              EXPORTING
                im_document = obj_pdf_file.

    hi,
    i tried with ur problem.but i am able send mail in other languages also.actaullly i wrote a msg whether the mail has been sent or not.i got success message. i am placing my code here please go thorugh it,and do relavant modifications.
    *& Report  ZPPS_SMARTFORM_TO_PDF
    REPORT  ZPPS_SMARTFORM_TO_PDF.
    PARAMETER: p_date LIKE sy-datum.
    PARAMETER: p_rea TYPE char255.
    DATA: t_otfdata TYPE ssfcrescl,
          t_lines LIKE tline OCCURS 0 WITH HEADER LINE,
          t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
          t_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
    Objects to send mail.
    DATA:T_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
         T_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
         T_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
         T_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
    DATA: w_filesize TYPE i,
          w_bin_filesize TYPE i,
          wa_ctrlop TYPE ssfctrlop,
          wa_outopt TYPE ssfcompop,
          WA_BUFFER TYPE STRING,          "To convert from 132 to 255
          WA_OBJHEAD TYPE SOLI_TAB,
          WA_DOC_CHNG TYPE SODOCCHGI1,
          W_DATA TYPE SODOCCHGI1.
    DATA: form_name TYPE rs38l_fnam,
          V_LINES_TXT TYPE I,
          V_LINES_BIN TYPE I,
          nast-spras type sy-langu value 'DE'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        FORMNAME                 = 'ZSR_DEMO1'
      VARIANT                  = ' '
      DIRECT_CALL              = ' '
    IMPORTING
       FM_NAME                  = form_name
    EXCEPTIONS
       NO_FORM                  = 1
       NO_FUNCTION_MODULE       = 2
       OTHERS                   = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    wa_ctrlop-LANGU = nast-spras.
    wa_ctrlop-getotf = 'X'.
    wa_ctrlop-no_dialog = 'X'.
    wa_outopt-tdnoprev = 'X'.
    CALL FUNCTION form_name
      EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       CONTROL_PARAMETERS         = wa_ctrlop
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       OUTPUT_OPTIONS             = wa_outopt
       USER_SETTINGS              = 'X'
        MYDATE                     = p_date
        REASON                     = p_rea
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       JOB_OUTPUT_INFO            = t_otfdata
      JOB_OUTPUT_OPTIONS         =
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 4
       OTHERS                     = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    t_otf[] = t_otfdata-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
       FORMAT                      = 'PDF'
       MAX_LINEWIDTH               = 132
      ARCHIVE_INDEX               = ' '
      COPYNUMBER                  = 0
      ASCII_BIDI_VIS2LOG          = ' '
      PDF_DELETE_OTFTAB           = ' '
    IMPORTING
       BIN_FILESIZE                = w_bin_filesize
      BIN_FILE                    =
      TABLES
        OTF                         = t_otf
        LINES                       = t_lines
    EXCEPTIONS
       ERR_MAX_LINEWIDTH           = 1
       ERR_FORMAT                  = 2
       ERR_CONV_NOT_POSSIBLE       = 3
       ERR_BAD_OTF                 = 4
       OTHERS                      = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    loop at t_lines.
    TRANSLATE t_lines USING '~'.
      CONCATENATE WA_BUFFER T_LINES INTO WA_BUFFER.
    ENDLOOP.
    TRANSLATE WA_BUFFER USING '~'.
    DO.
      t_RECORD = WA_BUFFER.
      APPEND t_RECORD.
      SHIFT WA_BUFFER LEFT BY 255 PLACES.
      IF WA_BUFFER IS INITIAL.
        EXIT.
      ENDIF.
    ENDDO.
    Attachment
    REFRESH: T_RECLIST,
    T_OBJTXT,
    T_OBJBIN,
    T_OBJPACK.
    CLEAR WA_OBJHEAD.
    T_OBJBIN[] = T_RECORD[].
    Create Message Body Title and Description
    T_OBJTXT = 'test with pdf-Attachment!'.
    APPEND T_OBJTXT.
    DESCRIBE TABLE T_OBJTXT LINES V_LINES_TXT.
    READ TABLE T_OBJTXT INDEX V_LINES_TXT.
    WA_DOC_CHNG-OBJ_NAME = 'smartform'.
    WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
    WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
    WA_DOC_CHNG-SENSITIVTY = 'F'.
    WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
    Main Text
    CLEAR T_OBJPACK-TRANSF_BIN.
    T_OBJPACK-HEAD_START = 1.
    T_OBJPACK-HEAD_NUM = 0.
    T_OBJPACK-BODY_START = 1.
    T_OBJPACK-BODY_NUM = V_LINES_TXT.
    T_OBJPACK-DOC_TYPE = 'RAW'.
    APPEND T_OBJPACK.
    Attachment (pdf-Attachment)
    T_OBJPACK-TRANSF_BIN = 'X'.
    T_OBJPACK-HEAD_START = 1.
    T_OBJPACK-HEAD_NUM = 0.
    T_OBJPACK-BODY_START = 1.
    DESCRIBE TABLE T_OBJBIN LINES V_LINES_BIN.
    READ TABLE T_OBJBIN INDEX V_LINES_BIN.
    T_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
    T_OBJPACK-BODY_NUM = V_LINES_BIN.
    T_OBJPACK-DOC_TYPE = 'PDF'.
    T_OBJPACK-OBJ_NAME = 'smart'.
    T_OBJPACK-OBJ_DESCR = 'test'.
    APPEND T_OBJPACK.
    CLEAR T_RECLIST.
    T_RECLIST-RECEIVER = 'MAIL-ID'.
    T_RECLIST-REC_TYPE = 'U'.
    APPEND T_RECLIST.
    CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
      EXPORTING
        DOCUMENT_DATA              = WA_DOC_CHNG
        PUT_IN_OUTBOX              = 'X'
        COMMIT_WORK                = 'X'
      TABLES
        PACKING_LIST               = T_OBJPACK
        OBJECT_HEADER              = WA_OBJHEAD
        CONTENTS_BIN               = T_OBJBIN
        CONTENTS_TXT               = T_OBJTXT
        RECEIVERS                  = T_RECLIST
      EXCEPTIONS
        TOO_MANY_RECEIVERS         = 1
        DOCUMENT_NOT_SENT          = 2
        DOCUMENT_TYPE_NOT_EXIST    = 3
        OPERATION_NO_AUTHORIZATION = 4
        PARAMETER_ERROR            = 5
        X_ERROR                    = 6
        ENQUEUE_ERROR              = 7
        OTHERS                     = 8.
    IF SY-SUBRC <> 0.
      WRITE:/ 'Error When Sending the File', SY-SUBRC.
    ELSE.
      WRITE:/ 'Mail sent'.
    ENDIF.
    and i thought of one more soluyion u can write
    wa_ctrlop-langu = T002-spras. i think it will also help for u.
    revert back if any questions.
    please reward me if helpful.
    gupta.pullipudi

Maybe you are looking for

  • How to block Windows update services?

    We have a need to prevent windows update traffic to flow thru our network on certain dates. Basically this type of traffic will clog our mpls bandwidth preventing other type of traffic to flow. We are using up to some part QoS on out routers but it n

  • How do I get my apps from my old ipod to my iphone?

    I have had an ipod touch for years. It has on it all my music and over 50 apps. I just got a new iphone. So, I just synced the iphone and it put all my music onto the iphone. This was easy, but now I can't get my apps onto the phone. What do I do?

  • BPC delta flat file upload possible?

    Hi experts, Ive been trying to find an answer of whether or not it is possible to retain member data on manual flat file upload into a dimension. We have created a dimension (employee) and have created some dummy nodes member data and would like to d

  • Invalid Operation on F

    Hi, I got the ff exception when I tried to call data.beforeFirst(). EXCEPTION DESCRIPTION: java.sql.SQLException: Invalid operation for forward only resultset : last INTERNAL EXCEPTION: java.sql.SQLException: Invalid operation for forward only result

  • How do I upgrade aperterure photo library?

    I have previous libraries saved to external drives that i can no longer open with my upgraded version of Aperture 3.2. It suggests that I upgrade my previous library before trying to import or open (version 3.1) How do I upgrade the version in a file