Page 2 of 2 <12
Topic Options
#41195 - 2003-06-10 12:45 AM Re: call out a VBscript from a kixtart script
ktodi Offline
Getting the hang of it

Registered: 2002-03-29
Posts: 60
In my last post I mentioned the script was displaying the body to the screen that was my error and I fixed it. Now nothing appears on the screen when I run the script and I am still not receiving the e-mail.
Top
#41196 - 2003-06-10 01:02 AM Re: call out a VBscript from a kixtart script
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Have any idea which line is having the trouble ? What happens if you display @SERROR after every property and method call, which one is failing ?

[ 10. June 2003, 01:02: Message edited by: Shawn ]

Top
#41197 - 2003-06-10 06:35 AM Re: call out a VBscript from a kixtart script
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
did you have that original vbs code working for you or was it just example what you want?
afaik, you need proper environment for cdo to work anyway [Wink]
_________________________
!

download KiXnet

Top
#41198 - 2003-06-10 07:44 AM Re: call out a VBscript from a kixtart script
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Don't know if this going to help you, but give this a go.

Picked up the quoting information from -
http://www.experts-exchange.com/Databases/MS_Access/Q_20504381.html

Here is the changed code (I am at home now)..
code:
$objEmail=CreateObject("CDO.Message")
$objEmail.From="scripterror@mydomain.com"
$objEmail.To="myname@mydomain.com"
$objEmail.Subject="subject"
$objEmail.Textbody="The User: "+@userid+" on Worksation: "+@wksta+" could not get to subject"
"$objEmail.Configuration.Fields.Item"("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
"$objEmail.Configuration.Fields.Item"("http://schemas.microsoft.com/cdo/configuration/smtpserver")="mail.mydomain.com"
"$objEmail.Configuration.Fields.Item"("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
"$objEmail.Configuration.Fields.Update"
$objEmail.Send

I hope I am not wrong while trying to illustrate this point. [Smile]

If we look at the following script - ADSearch() - Search for name or account name in Active Directory

We see the following work fine -
$AdoCommand.ActiveConnection = $AdoCon
^ Sect 1 ^ ^ Section 2 ^

There appears to be an issue with (maybe a bug?) -
$objEmail.Configuration.Fields.Item
^ Sect 1^ ^ Section 2 ^ ^sct3^ ^s4^

Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#41199 - 2003-06-10 07:10 PM Re: call out a VBscript from a kixtart script
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Anybody have some results from this? [Wink]

Kent

[ 10. June 2003, 19:11: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#41200 - 2003-06-10 07:21 PM Re: call out a VBscript from a kixtart script
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Kent, did you add the Value property to the end of those statements ? Like this:

$objEmail.Configuration.Fields.Item("whatever").Value = aNumber

Kixtart DOES have one very important COM limitation, one cannot write (set/put) data in a "open-ended" fashion like this:

$objEmail.Configuration.Fields.Item("whatever") = aNumber

The above statement is actually using default properties here, and support for those is somewhat limited and restricted in Kixtart ... but basically when setting properties, a COM expression has to "end" with a specific settable property value.

Most COM object use the "Value" property as the default value. But to make it work for scripting languages like Kixtart, it also has to support the Value property explicity - most do but some dont (for example, some Excel properties) ...

Top
#41201 - 2003-06-12 10:39 PM Re: call out a VBscript from a kixtart script
ktodi Offline
Getting the hang of it

Registered: 2002-03-29
Posts: 60
When i run the following script I get "The command completed successfully reported back using the @serror macro for everyline but still receive no emial. The vbscript version of this works correctly.

REDIRECTOUTPUT ("c:\output.txt",0)

$objEmail = CreateObject("CDO.Message") @serror
$objEmail.From = "scripterror@mydomain.com" @serror
$objEmail.To = "me@mydomain.com" @serror
$objEmail.Subject = "Subject" @serror
$objEmail.Textbody = "body" @serror
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") .Value = 2 @serror
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") .Value = "mail.myddomain.com" @serror
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") .Value = 25 @serror
$objEmail.Configuration.Fields.Update @serror
$objEmail.Send @serror

EXIT

[ 12. June 2003, 22:40: Message edited by: ktodi ]

Top
#41202 - 2003-06-13 02:40 PM Re: call out a VBscript from a kixtart script
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Is Howard around?

I think he has done some work with CDO and Kix..

Sorry to keep beating the drum here, but I have a suspicion that we should be able do this with KiXtart.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#41203 - 2003-06-13 02:56 PM Re: call out a VBscript from a kixtart script
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Not sure, but maybe if the @ signs in the kixtart strings were "doubled-up", this might work [Wink] example:

$objEmail.From = "scripterror@@mydomain.com" @serror

[ 13. June 2003, 14:57: Message edited by: Shawn ]

Top
#41204 - 2003-06-13 11:05 PM Re: call out a VBscript from a kixtart script
ktodi Offline
Getting the hang of it

Registered: 2002-03-29
Posts: 60
Doubling up the @ symbols fixed my problem. That is straight out of the manual too. Thanks for all you help everything is working correctly now.
Top
Page 2 of 2 <12


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 548 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.188 seconds in which 0.154 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org