spartacus
7th June 2013, 10:13
To play a little with C# and Baan a wrote a little Session-Launcher in C#.
The programm works find so far, but I can't start "ttaad4100", the same way I start the normal sessions.
I tried it that way:


private void btnttaad4100(object sender, EventArgs e)
{
object Baan = null;
Type t;
t = Type.GetTypeFromProgID(_system);
Baan = Activator.CreateInstance(t);
object[] Parameters = new Object[1];
Parameters[0] = 3600;
Baan.GetType().InvokeMember("Timeout",
BindingFlags.SetProperty,
null,
Baan,
Parameters
);

Parameters = new Object[2];
Parameters[0] = "ottstpstandard";
Parameters[1] = "start.main.session(" + (char)34 + "ttaad4100" + (char)34 + ")";
Baan.GetType().InvokeMember("ParseExecFunction",
BindingFlags.InvokeMethod,
null,
Baan,
Parameters
);
Baan.GetType().InvokeMember("Quit", BindingFlags.InvokeMethod, null, Baan, null);

}


But the code produces a BW-message like "object 44 in process 6 not found".

Is there any way to start ttaad4100 from c#?


Richard

bhushanchanda
7th June 2013, 10:47
I have never tried it, but I guess some object is missing.

Have you checked the log files? log.bshell may be.

spartacus
7th June 2013, 13:04
I just grepped the "log*" Files for "object 44" and didn't find anything :-(

mark_h
7th June 2013, 16:49
Have you tried launching ottaad4100?

spartacus
10th June 2013, 10:51
Hi Mark,

just tried it. Without success.

Are there any alternatives for the line:
Parameters[0] = "ottstpstandard";
I think ttaad4100 is more a tools, than a standard session!?

Richard

bhushanchanda
10th June 2013, 11:23
Hi,

Try to get the session info using:-

ttstpsessinfo

I guess it will give you some information.

May be you can call ottaad4100

spartacus
10th June 2013, 14:28
ttspsessionfo doesn't help really. I tried all combinations of "oaad4100", "ottaad4100" with some DLL's in Parameter[0].
The right name for the object should be "oaad4100", I think.
But "normal" sesions are also called by their sessioname and not by the name of the object.

But I still have no glue about Parameter[0]. Which dll, if any, has to be passed to the "ParseExecFunction"?

Richard

mark_h
10th June 2013, 16:13
Might not be the answer you are looking for but I think this would work. See this thread (http://www.baanboard.com/baanboard/showthread.php?t=24849&highlight=excel+call+baan+library) and it lonks to this thread (http://www.baanboard.com/baanboard/showthread.php?t=8929&highlight=call.session). I think what you can do is create a library which would call the session or maybe even a session. Then call this using the ottstpstandard.

It seems to me there should something that could be called to start the table maintenance session - I just can't think of anything.

spartacus
10th June 2013, 17:39
Hi Mark,

as last try, this will be an option. But I think it should possible without creating a DLL. The BaanClient and Worktop can do it also.

Richard

mark_h
10th June 2013, 20:34
My last thought on this was wondering if you could use "run program" or ttdsk2080m000 to run table maintenance sessions. Using ttaad4100 as a parameters. Not sure how your system works since it is a more current version.

spartacus
11th June 2013, 12:27
Hi Mark,

you mean "run program" or ttdsk2080m000 from the normal ttdskbrowser?
That works! It's my normal way to use it!

mark_h
11th June 2013, 15:10
So you got it to work? What does the code look like - I am curious how you formatted the calls.

Thanks!

spartacus
11th June 2013, 17:51
No Mark, sorry!

I tried to say that it works from the "normal" Baan environment, not from the c#-Programm.

mark_h
11th June 2013, 20:54
Darn... Sorry.

spartacus
12th June 2013, 10:55
I will keep it in my mind. Perhaps I will find a solution ... one day. But this small program is only a thing I do along the way, to learn a little c#.

Richard

EdHubbard
12th June 2013, 12:42
Probably not quite what you want but you could mimic calling a program as you do straight from the bwc configuration file.

example - if you enter ttaad4100 in the Bshell environment, Command box and press Run it tries to open the session (it behaves as normal and asks for the password)

spartacus
14th June 2013, 10:28
Hi Ed,

I think I know what you mean, and yes my intension is merely to work a little with c#. If I could solve that problem -and some more- I should be able to program my own "worktop" :-))

Richard