Page 1 of 1 1
Topic Options
#98874 - 2003-02-27 08:43 PM Loop Header issue with KiXstrip
Kdyer Offline
KiX Supporter
*****

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

Noticing a peculiar behavior with KiXstrip..

Consider the following code:
code:
             IF $profile_remove = 'YES'
$index = 0
:loop4
$keyname = ENUMKEY($profilelocation, $index)
IF @error = 0
IF $keyname <> @userid OR $keyname <> 'Sales'
$rc = DELTREE($profilelocation+'\'+$keyname)
$index = $index + 1
GOTO Loop4
ENDIF
ENDIF
ENDIF

Can we do something like?
code:
             IF $profile_remove = 'YES'
$index = 0
:loop4
$keyname = ENUMKEY($profilelocation, $index)
IF @error = 0
IF $keyname <> @userid OR $keyname <> 'Sales'
$rc = DELTREE($profilelocation+'\'+$keyname)
$index = $index + 1
GOTO Loop4
ENDIF
ENDIF
ENDIF

What are your thoughts with this?

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

Top
#98875 - 2003-02-27 09:02 PM Re: Loop Header issue with KiXstrip
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Kent,
Are you sure that code would even work? Looks bad, real bad!

Jumping out of one IF loop into the middle of another IF loop. Gives me the {{{shudders}}}.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#98876 - 2003-02-27 09:04 PM Re: Loop Header issue with KiXstrip
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
he was just lazy to code it with proper looping. [Razz]
_________________________
!

download KiXnet

Top
#98877 - 2003-02-27 09:07 PM Re: Loop Header issue with KiXstrip
Kdyer Offline
KiX Supporter
*****

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

Good point..

Lemme dig..

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

Top
#98878 - 2003-02-27 10:07 PM Re: Loop Header issue with KiXstrip
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
OK.. Trying to get some code together that will do this..

Also found another post from Rad (MapPrinter) that does this too.

OK.. Here is some code. Trying to think in terms of working with 3.63 and up..

code:
 IF $profile_remove = 'YES'
$index = 0
WHILE ENUMKEY($profilelocation, $index) AND @error = 0
IF $keyname <> @userid OR $keyname <> 'Sales'
$rc = DELTREE($profilelocation+'\'+$keyname)
$index = $index + 1
ELSE
$index = $index + 1
ENDIF
LOOP
ENDIF

Thanks,

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

Top
#98879 - 2003-02-27 10:22 PM Re: Loop Header issue with KiXstrip
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
that should not work at all [Eek!]

or where you get that $keyname?
_________________________
!

download KiXnet

Top
#98880 - 2003-02-28 01:27 AM Re: Loop Header issue with KiXstrip
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear Kent,

We agree with Les, that it isn't a nice way of programming but
sometimes such structure is necessary to make things possible. Things
possible which can be done in another way.

At this moment it doesn't high priority on our list. Reason: normally
it is a very bad habit to use labels. It aren't only GOTO labels, but
also GOSUB labels we have to deal with.

In your second example it can be very hard to find used labels back.
For that reason we put them always at the beginning of a line. In
most cases it was already at the beginning of that line.
greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#98881 - 2003-02-28 06:38 AM Re: Loop Header issue with KiXstrip
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and I have to agree with MCA on this one.
it surely is easier to follow when the break points are clearly visible.

what comes to loop, I suggest something like:
code:
IF $profile_remove = 'YES'
$index = 0
$keyname = ENUMKEY($profilelocation, $index)
while @error = 0 and $keyname <> @userid
$rc = DELTREE($profilelocation+'\'+$keyname)
$index=$index+1
$keyname = ENUMKEY($profilelocation, $index)
loop
ENDIF

notice, I removed the "sales" check as I have no idea what it was.
you can put it back if it is important.

also kent, if you could be online later, I need to discuss on one outlook manner...
_________________________
!

download KiXnet

Top
#98882 - 2003-02-28 07:48 AM Re: Loop Header issue with KiXstrip
Kdyer Offline
KiX Supporter
*****

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

You are right, Sales is not used. With your ideas, I removed the GOTO.

Starting to look better.

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

Top
#98883 - 2003-02-28 03:48 PM Re: Loop Header issue with KiXstrip
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Won't that remove all profiles or do you only want to remove roaming profiles?

Also, I would rather enumerate all profiles with ArrayEnumKey() and then delete the ones that fit my criteria.

I would not delete the profiles while in the process of enumerting them, it might confuse the enumartion index (haven't tested it as I went the safe route and kept enumeration/deletion separate).
_________________________
There are two types of vessels, submarines and targets.

Top
#98884 - 2003-02-28 07:28 PM Re: Loop Header issue with KiXstrip
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Was trying to code together a method to remove the "OEM User", "Microsoft Exchange Settings", etc. from the user's profile and then start fresh.

The looping structure has been updated in the Outlook/Exchange FAQ.

Thanks,

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

Top
Page 1 of 1 1


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

Who's Online
0 registered and 884 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.062 seconds in which 0.027 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