Page 1 of 1 1
Topic Options
#75814 - 2003-07-11 08:51 PM Newbie w/ problems
khaunani Offline
Fresh Scripter

Registered: 2003-07-10
Posts: 12
Loc: Iowa, USA
Well, I'm wreaking havoc in the Starters forum, why not here?

I have batch file that checks for kix files on each PCs hard drive. Once they are copied, it will then call a kix program. In this program I am trying to delete existing drives and map the appropriate ones for that user.

I am using the Select...Case to do all of this, but for some reason, it is not going thru the list. Here is a sample of my script:

SELECT
CASE @USERID = "CARRK"
USE * /Delete
USE F: "\\DSMNT2\RECMONTHLY"
USE G: "\\DSMNT2\FMAGIC"
USE S: "\\DSMNT4\PVSW$"
USE T: "\\DSMNT4\DRIVE_S$"
USE H: "\\DSMNT2\CARRK"
USE I: "\\DSMNT2\NETLOGON\IT"
USE J: "\\DSMNT2\RECORDERS"
USE O: "\\DSMNT2\DP MY FILES$"
USE F: "\\DSMNT2\RECMONTHLY"
Sleep(3)
Call "AddressWarning.txt"
CASE @USERID = "CALVINM"
USE * /Delete
USE F: "\\DSMNT2\RECMONTHLY"
USE G: "\\DSMNT2\FMAGIC
USE H: "\\DSMNT2\CALVINM$"
USE J: "\\DSMNT2\OPTISERV1"
USE L: "\\DSMNT2\COPELANDC"
USE M: "\\DSMNT2\MCVEYC"
Sleep(3)
Call "AddressWarning.txt"
ENDSELECT

When I login (CARRK), as long as my CASE is first, it has no problem. But, if I put my CASE anywhere else, it does not do anything. If I check my mapped drives, they all have red X's on them.

The program "AddressWarning.txt" also has a CASE...SELECT, but it seems to have no problem sifting thru them. The only difference that I can see is that there aren't as many tasks connected to each one:

SELECT

CASE @USERID = "CALVINM"
$NAME = "MISHELLE HAMILTON"
CASE @USERID = "ERICKSONG"
$NAME = "GINA ERICKSON"
CASE @USERID = "LEVINSONK"
$NAME = "KAY LEVINSON"
CASE @USERID = "CARRK"
$NAME = "KIM CARR"

ENDSELECT
I then use $NAME in a MessageBox string.
Also, with the above program, I have 2 variables declared before doing the CASE. In the first program, the CASE/SELECT is the very first thing.

I'm using Windows2000 server and the PCs are Windows2000 as well. I am using the most recent version of Kixtart.

What am I missing?
[Frown]
Thanks,
Khaunani

Top
#75815 - 2003-07-11 09:04 PM Re: Newbie w/ problems
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Please post scripts in between [CODE] tags and use the .KIX extension for scripts instead of the .TXT extension. This is explained in the FAQ Forum and the KiXtart Manual.

The '$' signs need to be doubled up unless you are using SETOPTION('NoVarsInStrings','on') at the beginning of your code.

You should ratehr put the Addresswarning into it's own function and include the fnction at the end of your script. This is explained in the FAQ forum under How to use UDFs and How to write a UDF

Use DEBUG ON in the first line of your code to step through the code for debugging purposes. Alos, please be aware that in a SELECT-CASE-ENDSELECT statement only the first true statement will be triggered.

Otherwise, the code fragmentlooks okay but you might beomitting other important parts of your code. Please use DEBUG ON before reporting back.
_________________________
There are two types of vessels, submarines and targets.

Top
#75816 - 2003-07-11 10:39 PM Re: Newbie w/ problems
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Why are you doing this?

$NAME = "MISHELLE HAMILTON"

You really should be using the macro @FULLNAME as you are with @USERID.. If you specify the name in script, this will become a headache as you will have to maintain it.

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

Top
#75817 - 2003-07-11 10:57 PM Re: Newbie w/ problems
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I bet your problem is:
code:
USE G: "\\DSMNT2\FMAGIC 

you are missing quote.
_________________________
!

download KiXnet

Top
#75818 - 2003-07-11 10:58 PM Re: Newbie w/ problems
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
oh... and ignore the red x's they effectively mean nothing.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#75819 - 2003-07-11 11:21 PM Re: Newbie w/ problems
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
quote:

oh... and ignore the red x's they effectively mean nothing.

True - to a point. Windows 2000 and better tries to not establish a connection unless "called upon." When you ask for Drive L: for example, it then asks to get a connection and then removes the red "X".

HTH,

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

Top
#75820 - 2003-07-11 11:24 PM Re: Newbie w/ problems
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
which is bad for many applications.

anyway, corrected the missing quote and did some layout fix...
I also took the liberty to remove the sleep as there is no need what so ever for it.
now PostPrep seems to accept it as functional:
SELECT 
CASE @USERID = "CARRK"
USE "*" /Delete /persistent
USE F: "\\DSMNT2\RECMONTHLY"
USE G: "\\DSMNT2\FMAGIC"
USE S: "\\DSMNT4\PVSW$$"
USE T: "\\DSMNT4\DRIVE_S$$"
USE H: "\\DSMNT2\CARRK"
USE I: "\\DSMNT2\NETLOGON\IT"
USE J: "\\DSMNT2\RECORDERS"
USE O: "\\DSMNT2\DP MY FILES$$"
USE F: "\\DSMNT2\RECMONTHLY"
Call "AddressWarning.txt"
CASE @USERID = "CALVINM"
USE "*" /Delete /persistent
USE F: "\\DSMNT2\RECMONTHLY"
USE G: "\\DSMNT2\FMAGIC"
USE H: "\\DSMNT2\CALVINM$$"
USE J: "\\DSMNT2\OPTISERV1"
USE L: "\\DSMNT2\COPELANDC"
USE M: "\\DSMNT2\MCVEYC"
Call "AddressWarning.txt"
ENDSELECT


[ 11. July 2003, 23:50: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#75821 - 2003-07-11 11:29 PM Re: Newbie w/ problems
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Does the $ vs $$ matter here?
code:
USE T: "\\DSMNT4\DRIVE_S$$"
USE O: "\\DSMNT2\DP MY FILES$"

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

Top
#75822 - 2003-07-11 11:51 PM Re: Newbie w/ problems
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
basically not, but that is not best practise.
ruud still insists on handling single dollar differently than normal vars.
it might change in the future and thus updated the post above.
_________________________
!

download KiXnet

Top
#75823 - 2003-07-14 05:23 PM Re: Newbie w/ problems
khaunani Offline
Fresh Scripter

Registered: 2003-07-10
Posts: 12
Loc: Iowa, USA
Thank you for all the suggestions. Now to just sift through them.

I will attempt the debugging. I haven't figured that out quite yet. Is there anyplace on the bulletin board that will step me through it? I don't know what to do once the debug menu comes up.

The $ signs in my mapped drives are for hidden shares. I haven't had any problems mapping to them the way I have them written.

Thanks,
Khaunani

Top
#75824 - 2003-07-14 05:46 PM Re: Newbie w/ problems
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
sure.
we have had no problems either.
but what comes to kixtart rules, that is basically not good.
think about it.

you have variable "$" valued to something.
it will then translate to that and it would not work anymore...
like said, ruud has kept it the way it is currently but that might change.

anyway, think there is something about debugging in the manual.

there is no better reference that I know.
and for wkix32 I have decided to skip debugging with kixtart debugger totally as what more complex your scripts become, that less it has power.
_________________________
!

download KiXnet

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.071 seconds in which 0.034 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