Send SMS from Smart Office with Skype

To send an SMS text message to a mobile phone from a Personalized Script in Lawson Smart Office using Skype do:

skype.SendSms("+18472874945", "Hello World", null)


A simple script that sends an SMS would be:

import System;
import System.Reflection;

package MForms.JScript {
    class SendSms {
         public function Init(element: Object, args: Object, controller : Object, debug : Object) {
             try {
                 var assembly: Object = Assembly.LoadFrom('C:\\Program Files\\Skype\\SEHE\\Interop.SKYPE4COMLib.dll');
                 var skype = assembly.CreateInstance('SKYPE4COMLib.SkypeClass');
                 skype.Attach(8, false);
                 skype.SendSms('+18472874945', 'Hello World!', null);
             } catch (ex: Exception) {

Note: The programming language for scripts in Smart Office is JScript.NET.


Follow these steps to run the script above:

  1. Download and install Skype on the computer that is running Smart Office (the script must communicate with Skype locally). Then sign in to Skype (the script will not work if you are not signed in). Also, your Skype account must have credit (USD, EUR, etc.) to be able to send SMS.
  2. Download and unzip Skype4COMsomewhere in your computer, for example C:\Program Files\Skype\skype4com-1.0.36\ . Skype4COM is the API used to send/receive Skype commands. Then register the DLL Skype4COM.dll with the following command:
    regsvr32 Skype4COM.dll

  3. Download and install SEHE and place the file Interop.SKYPE4COMLib.dll somewhere in your computer or somewhere on the network so that it is accessible by the Smart Office computer, for example C:\Program Files\Skype\SEHE\Interop.SKYPE4COMLib.dll or http://host/path/Interop.SKYPE4COMLib.dll . That DLL contains the Interop code to be able to call Skype4COM from the .NET framework.
  4. Launch Smart Office, and log in.
  5. For the Script Tool it is necessary to have an M3 program open, so open for example Customer. Open – CRS610.
  6. Open the Script Tool with the following command:
  7. Copy/paste the sample script above into the Script Tool
  8. Change the path to the DLL. In my example I used C:\\Program Files\\Skype\\SEHE\\Interop.SKYPE4COMLib.dll . Make sure to escape the backslashes in the String with double backslashes.
  9. Change the phone number. It must be in international notation. In my example I used +18472874945.
  10. Click Compile
  11. Click Run
  12. Skype will show the message “LawsonClient.exe wants to use Skype”. Click Allow access; Skype will only ask once.
  13. Skype will now send the SMS. Check in your mobile phone that you received it. That’s it!

Note: I tested this on Windows XP and on Windows 7 32-bit with success. It doesn’t seem to work on Windows 64-bit. Also, I tested this in Smart Office 9.x.

More advanced script

A more elaborated script with an editable SMS text message in a pop-up looks like:

Published by


ex- M3 Technical Consultant

18 thoughts on “Send SMS from Smart Office with Skype”

  1. Hi Thibaud,

    Can we use this assembly all the time ? Trying to use a .dll (PdfSharp.dll stored in a folder under C:/) to test the merge feature on .pdf files. The script compiles well but miserably crashes during execution.

    var assembly : Object = Assembly.LoadFrom(‘C:\maxric\PdfSharp.dll’);
    var as1 = assembly.CreateInstance(‘PdfSharp.Pdf’);
    var docs_0 = new as1.PdfDocument(“C:/….”);

    Error on line as1.PdfDocument()
    –> Microsoft.JScript.JScriptException: Object required

    Am i out of sorts ? 😉

    Should i install the .dll somewhere in the ISO server ?

    Yes, this post is 5 years old but better late then never. Thank you !


    1. Hello Maxime. Yes, that post is five years old, and about a year after it, the solution didn’t work anymore; I don’t remember if because Skype had changed something, or because Smart Office had changed something. Anyway, it should still be possible to load assemblies. Try with another assembly. For example, try one of the Smart Office assemblies, it should say “already loaded” or something. Or try with one of the Smart Office applications not yet loaded, like the Process Automation Inbasket that I think doesn’t get loaded if the ProcessFlow checkbox is unchecked in the Profile Editor; that shouldn’t throw an error. Proceed like that until you find what’s happening with your DLL. I see you’re trying to use the PdfSharp DLL. If you get it to work, come write about it on the blog, it will certainly help others. Also, check out Karin’s post on printing from Smart Office; I don’t remember the link. I think there’s some View As Pdf now in Smart Office, so there may already be an assembly available. Hope it helps.


      1. Hello Thibaud,

        I tried another approach. Was able to create a MEC mapping that :
        1) retrieves the .pdf files in IDM (Infor Document Managment) through a query (using IDM API provided by Infor). You can XQuery the database and retrieve for example delivery note + invoice + whatever document for a given DLIX number

        2) Merge the .pdf files into one by using PDFBox-app.2.0.2.jar
        – that’s so cool !

        Next step :
        – create a widget in SmartOffice to trigger the mapping. The user will choose which documents to retrieve (checkboxes) and will enter the DLIX number as filtering criteria. The OnClick event will create an XML file in MEC /input directory
        – run mapping and send the merged.pdf file into user’s mailbox


          1. Greetings. Just posted a short demo on yt. Tell me what you think about it. Main drawback at the moment is that we generate 1 CMR document in IDM each time the user launch a “print” command in M3 (from MWS260). We have duplicates. There is no “flag copy” on the CMR doc in standard; maybe will do a bit of MAK on MWS610 header to force the user to check the CMR as “final version” in order to write one copy only in IDM. Maybe you have an idea on this one ? I am sure we can select the last record through IDM API query but my poor java skills do not allow me to go deeper into the code.


              1. Thank you ! CMR (lettre de voiture) is a document for the forwarding agent : we use it for customs. The combined .pdf is send by email to the user so he can check what is inside before forwarding by email to the forwarding agent’s mailbox.
                I will write a word document to present the solution + code and send it to you.


              2. Hello Thibaud. Did not remember you gave me access to articles. Made a draft. Can you have a look please ? Don’t find it easy to read, to many lines of code. Maybe we can enhance this. Thanks!


                1. Maxime, I just read your draft, and it looks good. Please write your name at the bottom of your post so people can tell us apart (even though it’s already in the author further below). I would explain why you chose MEC (I think because you couldn’t find how to load a .NET assembly at runtime), because otherwise it doesn’t make sense to me to use MEC for a client-side operation that can be done in .NET. I would also show a screenshot of the result (email with attachment). Then click Publish 🙂


                  1. Hi Thibaud. I have added what you suggested but never found the “publish” button. Could you please publish the post or give me access to this functionnality ? Thanks !


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s