Page 1 of 4 1234>
Topic Options
#30278 - 2002-10-07 09:11 PM If...else...endif statement
professor Offline
Fresh Scripter

Registered: 2002-10-02
Posts: 34
Loc: Bartow, Florida
I want to insert a LOOP into an If else statement.This is what I have so far:

WHILE @ERROR = 0
"Project Folder Number:" ?
GETS $projfile
IF EXIST ("$workingdir\$projfile\*.dgn")
SHELL "XCOPY $workingdir\$projfile $DestDir\$projfile /E /I /Q" ?
ELSE
***want to loop back to WHILE but simple LOOP doesn't work***
ENDIF
LOOP

I kinda need this ASAP, so anything will help.

Top
#30279 - 2002-10-07 09:24 PM Re: If...else...endif statement
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you could turn it upside down:
code:
"Project Folder Number:" ?
GETS $projfile
WHILE 0=EXIST ("$workingdir\$projfile\*.dgn")
"does not exist. give existing one" ?
GETS $projfile
loop
SHELL "XCOPY $workingdir\$projfile $DestDir\$projfile /E /I /Q" ?

_________________________
!

download KiXnet

Top
#30280 - 2002-10-07 09:36 PM Re: If...else...endif statement
professor Offline
Fresh Scripter

Registered: 2002-10-02
Posts: 34
Loc: Bartow, Florida
I don't understand what you're doing there. I just want to make an endless loop, no matter if the given file exists or not, I want it to go back to asking for the Proj Folder Number.

[ 07. October 2002, 21:41: Message edited by: professor ]

Top
#30281 - 2002-10-07 09:45 PM Re: If...else...endif statement
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
So, what is wrong with what you have? It doesn't work?
_________________________
There are two types of vessels, submarines and targets.

Top
#30282 - 2002-10-07 09:45 PM Re: If...else...endif statement
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
It's a scary thought...

code:
BREAK OFF
$done=0
$projfile=0
DO
? "Project Folder Number:" ?
GETS $projfile
IF $projfile=0
;$done=1 ;finite loop
$done=0 ;infinite loop
ENDIF
IF NOT $done
IF EXIST ("$workingdir\$projfile\*.dgn")
SHELL "XCOPY $workingdir\$projfile $DestDir\$projfile /E /I /Q" ?
ENDIF
ENDIF
UNTIL $done



[ 07. October 2002, 23:11: Message edited by: Waltz ]
_________________________
We all live in a Yellow Subroutine...

Top
#30283 - 2002-10-07 09:46 PM Re: If...else...endif statement
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
endless you want and endless you got.
remember to set the "break on"!
code:
WHILE 1=1
"Project Folder Number:" ?
GETS $projfile
if EXIST ("$workingdir\$projfile\*.dgn")
SHELL "XCOPY $workingdir\$projfile $DestDir\$projfile /E /I /Q" ?
endif
loop

_________________________
!

download KiXnet

Top
#30284 - 2002-10-07 09:52 PM Re: If...else...endif statement
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
You say:

quote:

I want to insert a LOOP into an If else statement.This is what I have so far:


Yet I believe your example shows the exact opposite it is an "if else" inside a "while loop". Just what are you trying to do? It is not clear to me.

[ 07. October 2002, 21:54: Message edited by: Jack Lothian ]
_________________________
Jack

Top
#30285 - 2002-10-07 10:10 PM Re: If...else...endif statement
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Finite prompt for keyboard input?
quote:
no matter if the given file exists or not, I want it to go back to asking for the Proj Folder Number.

_________________________
We all live in a Yellow Subroutine...

Top
#30286 - 2002-10-07 10:13 PM Re: If...else...endif statement
professor Offline
Fresh Scripter

Registered: 2002-10-02
Posts: 34
Loc: Bartow, Florida
Thanks Lonkero, that does it!
Top
#30287 - 2002-10-07 10:15 PM Re: If...else...endif statement
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, I think the idea was in this line:
quote:
I just want to make an endless loop, no matter if the given file exists or not
 

{edit}
prof,
    you're welcome.
 

[ 07. October 2002, 22:16: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#30288 - 2002-10-07 10:21 PM Re: If...else...endif statement
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Don't forget to include Break Off...
_________________________
We all live in a Yellow Subroutine...

Top
#30289 - 2002-10-07 10:23 PM Re: If...else...endif statement
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
Right,

I missed the second post.
_________________________
Jack

Top
#30290 - 2002-10-07 10:48 PM Re: If...else...endif statement
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
waltz, break off?
you mean to make it actually endless?

heh, I thought that he might want to end it after 3-4 years and that's why I said "break on"...
 
_________________________
!

download KiXnet

Top
#30291 - 2002-10-07 10:49 PM Re: If...else...endif statement
professor Offline
Fresh Scripter

Registered: 2002-10-02
Posts: 34
Loc: Bartow, Florida
Alright, solved that problem, but now I've got another. In the exist statement, only the files in the immediate directory are searched. I need to have every subfolder included in that search. How do I do that?

if EXIST ("$workingdir\$projfile\*.dgn")

Top
#30292 - 2002-10-07 10:52 PM Re: If...else...endif statement
professor Offline
Fresh Scripter

Registered: 2002-10-02
Posts: 34
Loc: Bartow, Florida
This is my entire script as it is now if you need to look at the whole thing.
code:
 
BREAK ON
"Source Directory:" ?
GETS $workingdir ;enter source directory
"Destination Directory:" ?
GETS $destdir ;enter destination dirctory

WHILE 1=1
"Project Folder Number:" ?
GETS $projfile
if EXIST ("$workingdir\$projfile\*.dgn")
SHELL "XCOPY $workingdir\$projfile $DestDir\$projfile /E /I /Q" ?
endif
LOOP


Top
#30293 - 2002-10-07 11:00 PM Re: If...else...endif statement
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Lonkero...
I guess your version and mine end up with the same net result [Wink] It's only 'endless' until you end it!
I have enough nightmares about unintended endless loops that the mere thought of actually creating one puts me into another mind space...
_________________________
We all live in a Yellow Subroutine...

Top
#30294 - 2002-10-07 11:04 PM Re: If...else...endif statement
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
professor...
You need to look at this gem...DIRPLUS()

[ 07. October 2002, 23:04: Message edited by: Waltz ]
_________________________
We all live in a Yellow Subroutine...

Top
#30295 - 2002-10-07 11:07 PM Re: If...else...endif statement
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
waltz, I love the for loops the best.

for $=0 to 2
"heh" ?
$=0
next

then if you nest them with some executions and internal function calls... sweet!

sadly kix gets pretty quickly stack overflow...
even though my stack can handle that really easily [Big Grin]
 
_________________________
!

download KiXnet

Top
#30296 - 2002-10-07 11:09 PM Re: If...else...endif statement
Jack Lothian Offline
MM club member
*****

Registered: 1999-10-22
Posts: 1169
Loc: Ottawa,Ontario, Canada
It not enough you want to search endlessly for the same file but you now want to find endless directories to search endlessly for your file? Interesting!

You might look at this UDF. It has several of the features you might need.

Find all large folders

Jooel,

You are naughty! [Wink]

[ 07. October 2002, 23:13: Message edited by: Jack Lothian ]
_________________________
Jack

Top
#30297 - 2002-10-07 11:19 PM Re: If...else...endif statement
Waltz Offline
Seasoned Scripter

Registered: 2002-08-01
Posts: 485
Loc: Waterloo, Ontario, Canada
Lonkero...
Will this will make your phone ring off the hook endlessly? [Eek!]
code:
for $=0 to 2
sendmail
$=0
next



[ 09. October 2002, 02:42: Message edited by: Waltz ]
_________________________
We all live in a Yellow Subroutine...

Top
Page 1 of 4 1234>


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

Who's Online
0 registered and 628 anonymous users online.
Newest Members
Raoul, Timothy, Jojo67, MaikSimon, kvn317
17875 Registered Users

Generated in 0.169 seconds in which 0.099 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