pitfloner
28th February 2006, 11:16
I don't know so much about how ttstpcreatdll works. E.g.:
1. How to execute choice.print.data
2. How to call a subsession
3. How to close the session
and so on.

Does anyone know if it exist any manual about this subject?

Thank you,

Joan

mark_h
28th February 2006, 15:32
See the sticky thread at the top of this forum. Basically all ttstpcreatdll does is create a library of stpapi commands for the session. This library does not always contain all of the commands. I used this early on just to get an idea of what commands you could use on a session. Again, keep in mind it may not contain all of the commands. Also how sessions react may vary from system to system. Also see my signature for my latest mantra. Now for your questions.

(1) Usually stpapi.continue.process does the trick. But this may vary from session to session.
(2) You only have to worry about handling the sub-sessions. So once you have control of the sub-sessions you just send the stpapi commands to the sub-session.
(3) stpapi.end.session closes a session. Below is just a sample subroutine I use to delete outbound. You can search this forum for other examples. You might even find code for the session you are looking at automating.


function extern delete_outbound_seqn( domain tcmcs.str12 runnumber,
domain tdilc.kooa order.type,
domain tcorno order.number,
domain tcpono order.position,
domain tcmcs.long order.serb,
ref string msg())
{
msg = ""
stpapi.handle.subproc("tdilc4101m000","tdilc4102s000","add")
stpapi.put.field("tdilc4101m000","runnumber",runnumber)
stpapi.put.field("tdilc4101m000","k.o.order",str$(order.type))
stpapi.put.field("tdilc4101m000","ordernr",str$(order.number))
stpapi.continue.process("tdilc4101m000",msg)
if not isspace(msg) then
stpapi.end.session("tdilc4101m000")
return
endif
stpapi.enum.answer("tdilc4102s000","ttstpq0100",tcyesno.yes)
stpapi.put.field("tdilc4102s000","tdilc401.koor",str$(order.type))
stpapi.put.field("tdilc4102s000","tdilc401.orno",str$(order.number))
stpapi.put.field("tdilc4102s000","tdilc401.pono",str$(order.position))
stpapi.put.field("tdilc4102s000","tdilc401.sera","0")
stpapi.put.field("tdilc4102s000","tdilc401.serb",str$(order.serb))
rc = stpapi.find("tdilc4102s000",msg)
if rc = 1 then
stpapi.delete("tdilc4102s000",true,msg)
else
msg = "Position not found on tdilc4101m000 for delete."
endif
stpapi.end.session("tdilc4513s000")
stpapi.end.session("tdilc4102s000")
stpapi.end.session("tdilc4101m000")
}

pitfloner
1st March 2006, 13:23
After creating the dll with ttstpcreatdll, a new llibrary is created.

If I want to user the session, do I have to use the functions saved in the dll, instead of stpapi?

Thanks,

Juan

mark_h
1st March 2006, 15:29
You do not have to use the library created by the DLL. I usually just generate the libraries to look at. I then use the stpapi commands in the program or in a library like my example. I prefer using the stpapi commands versus the library - I think it makes it easier to see what is happening in the code. Plus - remember my warning, not all of the commands may be created by ttstpcreatdll. Also some of the libraries may not compile - usually because of duplicate function names. Another reason to use stpapi code directly is because when you have problems, you can cut and paste the code directly into a post in this forum. That will make it easier for others to see what could be causing the problem.

dzorrilla
27th February 2009, 09:18
Thank you so much for this theard.

David.