Launching Catia from a web page and displaying who has a license

844 Views Asked by At

Just wondering is it possible to launch Catia from a web page. I also wanted the web page to be able to display a list of people who currently have a license. This web page will eventually be deployed on the company intranet. We currently have 19 Catia licenses in our office. Most of our users are using R19

any help much appreciated.

3

There are 3 best solutions below

0
On

You can launch CATIA from a hta application as already was mentioned here. With this you can handle specific CATSettings for licenses (also for different CATIA environments) but you have to convince your users to use the hta. You can find also some CATIA launchers already done on Internet.

In this way, you can avoid to let users to get a separate license which can be included also in another one (for example a separate MD2 and a HD2 - which has included a MD2 near some others).

The list of the peoples which are using a license and what license they have can be taken from LUM software but you need to read the documentation of that software (and this will not solve the problem of multiple taking of the licenses by users).

0
On

I wouldn't recommend hta for launching Catia. You can write a pretty simple launcher in C# with forms or wpf. On the license front you're on your own as well. There are a few products out there that cost money. If you're using LUM, you can write a script that queries the server and spits out the license information, and then write a webpage that shows that data.

I've written both and can give you more specific tactics.

0
On

If you are running this from an intranet (and you said you are) you can use VBscript from IE. I know it's not the best browser, but since in my company it's the official one, i provided some tools to my colleagues to do some actions like this. My best solution (the least worst I found), is to run a batch file, which call Catia

To run the batch file from VBscript (still works on intranet): shell.Run "C:\foo\startCatia.bat"

And the Batch File should contain CNEXT, which should open Catia

But then you might have issues with environment variables, and licence. I wasn't able to avoid this, until I found a way to write them in the batch file (of course this has to be done from Catia, so I create in the background of other macros, and it cannot work before the user has launch one of my tool to create this batch). Here is the code to run in Catia to write this batch file:

Sub catmain()
    Set oFileSys = CATIA.FileSystem

    temp = oFileSys.TemporaryDirectory.Path
    envpath = temp + "\env.txt"
    GetPath = temp + "\getenv.bat"
    runpath = CATIA.SystemService.Environ("USERPROFILE") + "\Desktop\StartCatia.bat"

    On Error Resume Next
    oFileSys.DeleteFile envpath
    oFileSys.DeleteFile GetPath
    oFileSys.DeleteFile runpath
    On Error GoTo 0

    Dim defaults(1111, 2) As String

    Set defaultslist = CreateObject("WScript.Shell").Environment

    Set GetFile = oFileSys.CreateFile(GetPath, False)
    Set getStream = GetFile.OpenAsTextStream("ForWriting")
    getStream.Write "set > " & envpath
    getStream.Write Chr(10)
    getStream.Close
    CATIA.SystemService.ExecuteProcessus (GetPath)

    Set RunFile = oFileSys.CreateFile(runpath, True)
    Set RunStream = RunFile.OpenAsTextStream("ForWriting")

    Set envfic = oFileSys.GetFile(envpath)
    Set envStream = envfic.OpenAsTextStream("ForReading")
    line = envStream.ReadLine
    While line <> ""
        l1 = InStr(line, "=")
        envvar = Left(line, l1 - 1)
        dest = Right(line, Len(line) - l1)
        defcontent = defaultslist.item(envvar)
        If defcontent <> dest Then
            'Set each environment variables
            RunStream.Write "set " & line & Chr(10)
        End If
        line = envStream.ReadLine
    Wend
    envStream.Close
    'Add a command to launch Catia
    RunStream.Write "CNEXT" & Chr(10)
    RunStream.Close

    On Error Resume Next
    oFileSys.DeleteFile envpath
    oFileSys.DeleteFile GetPath
    On Error GoTo 0
    MsgBox "StartCatia.bat created on your desktop", vbInformation, "hjn fast launcher"
End Sub