Page 1 of 1 1
Topic Options
#59817 - 2001-10-15 01:17 PM How do I get a string out of a string?
Jeroen Offline
Starting to like KiXtart

Registered: 2001-08-16
Posts: 180
Loc: Netherlands
Hi all,

Here's what I'm trying to do:

$Names="Name1,Name2,Name3"
$Name=
While $Name <> ""
SendMessage($Name,"Test")
$Name=
Loop

Any idea what the code after $Name= should be? I know it has been done before, but I can't remember where I saw it, and I don't know how to detect a , in a string and the length to this , etc... ?

_________________________
Regards, Jeroen. There are two ways to write error-free programs. Only the third one works.

Top
#59818 - 2001-10-15 03:05 PM Re: How do I get a string out of a string?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Jeroen,

You using KiXtart Version 3.63 or Version 4.00 (2001/RC3) ?

-Shawn

[ 15 October 2001: Message edited by: Shawn ]

Top
#59819 - 2001-10-15 03:22 PM Re: How do I get a string out of a string?
Jeroen Offline
Starting to like KiXtart

Registered: 2001-08-16
Posts: 180
Loc: Netherlands
I'm (still) using 3.63, untill the final of 2K is released...
_________________________
Regards, Jeroen. There are two ways to write error-free programs. Only the third one works.

Top
#59820 - 2001-10-15 03:50 PM Re: How do I get a string out of a string?
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Jeroen,

Well, there are probaly a few different ways to do this, but it really helps if one adds a "sentinal" to the end of the list ... helps with parsing quite a bit, here's an example:

code:

break on


$names="Name1,Name2,Name3"


$names = $names + ","


while instr($names,",")


$name = substr($names,1,instr($names,",")-1)


? 'NET SEND $NAME "HI THERE!"' ; fake a message


$names = substr($names,instr($names,",")+1,len($names))


loop


exit


-Shawn

Top
#59821 - 2001-10-15 05:05 PM Re: How do I get a string out of a string?
Jeroen Offline
Starting to like KiXtart

Registered: 2001-08-16
Posts: 180
Loc: Netherlands
Shawn: If you were a pretty girl, I'd ask you to marry me!...

Thanks for the help! Just tested it, and it works fine, now all I've got left is to try and figure out a way to force a shutdown or logoff without the possibility of the user cancelling it... (But that's another topic)

Thanks again!

_________________________
Regards, Jeroen. There are two ways to write error-free programs. Only the third one works.

Top
#59822 - 2001-10-15 05:40 PM Re: How do I get a string out of a string?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Jeroen,
Here's how I do a Wintendo reboot.

:OS95REBOOT
RUN "RUNDLL32.EXE SHELL.DLL,RestartDialog"
SENDKEYS ({ENTER})
:finish

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#59823 - 2001-10-15 09:26 PM Re: How do I get a string out of a string?
Jeroen Offline
Starting to like KiXtart

Registered: 2001-08-16
Posts: 180
Loc: Netherlands
Hmmm.. Interesting.. I'll give it a go tomorrow; I'm at home now and I need to go ...

Thanks!

_________________________
Regards, Jeroen. There are two ways to write error-free programs. Only the third one works.

Top
#59824 - 2001-10-16 09:07 AM Re: How do I get a string out of a string?
Jeroen Offline
Starting to like KiXtart

Registered: 2001-08-16
Posts: 180
Loc: Netherlands
Just tried it, using the following code:

code:

Cls
At (3,3) "Your computer will shut down automatically"
Sleep 3
Cls
Run "Rundll32.exe SHELL.DLL,RestartDialog"
SENDKEYS ({ENTER})
Exit

On Win95 OSR2.5 I get an illegal operation if Rundll is called (even if I do it using Start-Run), and on the Win98 1st edition I get a window telling me I have to close this program first, and then it gives me a choice to have windows do it, or cancel the operation and continue working in Windows...

_________________________
Regards, Jeroen. There are two ways to write error-free programs. Only the third one works.

Top
#59825 - 2001-10-16 09:22 AM Re: How do I get a string out of a string?
Jeroen Offline
Starting to like KiXtart

Registered: 2001-08-16
Posts: 180
Loc: Netherlands
Just thought of something;

What I could do, is put the reboot/logoff command in the RunOnce. (RUNDLL32.EXE user.exe,ExitWindows)

But, in order to do this, I need to know for sure if the policy files (config.pol) are read before or after the logon script runs, because of the synchronised execution of the logon script.. In other words, explorer should not start until after the logon script.. Anyone?

_________________________
Regards, Jeroen. There are two ways to write error-free programs. Only the third one works.

Top
#59826 - 2001-10-16 03:43 PM Re: How do I get a string out of a string?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Jeroen,
Forgot to mention... the kill resist in KiX may be giving you grief. Try adding Break On just above it.

Does the ExitWindows API call work on both 95 and 98? All my Wintendos are clones so my code works for me. I had better results with RestartDialog than ExitWindows.

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#59827 - 2001-10-16 05:00 PM Re: How do I get a string out of a string?
Jeroen Offline
Starting to like KiXtart

Registered: 2001-08-16
Posts: 180
Loc: Netherlands
It seems the Break on is doing the trick, I'll test it a bit more, and let you know..
I haven't tested the ExitWindows on all platforms yet, we only use it on Win98 computers that won't power down after shutdown, and that works...
_________________________
Regards, Jeroen. There are two ways to write error-free programs. Only the third one works.

Top
#59828 - 2001-10-18 05:03 PM Re: How do I get a string out of a string?
Jeroen Offline
Starting to like KiXtart

Registered: 2001-08-16
Posts: 180
Loc: Netherlands
Hi,

Just tested it, but it won't work...Rundll crashes if I do the following:

The batch file starts the script:

code:

$y=Open(1,"c:\End.chk",5)
$y=WriteLine(1,"Reboot")
$y=Close(1)
Break on
RUN "RUNDLL32.EXE SHELL.DLL,RestartDialog"
SENDKEYS ({ENTER})


After the script ends, it returns to the batch file, which checks if c:\End.chk exists. If it does, it deletes the file, and skips the rest of the batch, to ensue quick ending of the logon script..

Any ideas?

_________________________
Regards, Jeroen. There are two ways to write error-free programs. Only the third one works.

Top
Page 1 of 1 1


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

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.142 seconds in which 0.069 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