Sign in to follow this  
Followers 0
kaotkbliss

Question about While/Wend loop

8 posts in this topic

I have some code that is something like this:

$variable=0

filecopy("oldpath","newpath")

if fileexists("oldpath") then $variable=1

while $variable=1

if not fileexists("newpath") then $variable=1

if fileexists("newpath") then $variable=0

wend

So basically if the file doesn't exist, will it skip the loop (because $variable won't = 1)?


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites



well sometimes the file won't exist in the old path. (depends on how many files are created for the day)


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

Could you explain the requirements of this snippet in English?

Example:

It must wait until the old file is deleted or until the new file exists

Share this post


Link to post
Share on other sites

I just need to know if a loop will be skipped if the condition is not met

example: if $variable=0 and the loop is for $variable=1

the actual code is this:

$kyncon1=0
    $kyncon2=0
    $kyncon3=0
    $emailtext=WinGetText("Inbox - Microsoft Outlook", "")
    $string3=StringInStr($emailtext,"LKYN",0)
    While $string3<>0
        If $string3<>0 Then FileCopy("G:\CLIENT\IDMI\GMC\PNT WFD\KYN\OMR\LKYN_"&@YEAR&@MON&@MDAY&"*.ps","C:\lkyn print\")
        If FileExists("G:\CLIENT\IDMI\GMC\PNT WFD\KYN\OMR\LKYN_"&@YEAR&@MON&@MDAY&"_ConsumerBatch_3.ps") Then $kyncon3=1
        If FileExists("G:\CLIENT\IDMI\GMC\PNT WFD\KYN\OMR\LKYN_"&@YEAR&@MON&@MDAY&"_ConsumerBatch_2.ps") Then $kyncon2=1
        If FileExists("G:\CLIENT\IDMI\GMC\PNT WFD\KYN\OMR\LKYN_"&@YEAR&@MON&@MDAY&"_ConsumerBatch_1.ps") Then $kyncon1=1
        While $kyncon1=1
            If Not FileExists("C:\lkyn print\LKYN_"&@YEAR&@MON&@MDAY&"_ConsumerBatch_1.ps") Then $kyncon1=1
            If FileExists("C:\lkyn print\LKYN_"&@YEAR&@MON&@MDAY&"_ConsumerBatch_1.ps") Then $kyncon1=0 
            Sleep(100)
        WEnd
        While $kyncon2=1
            If Not FileExists("C:\lkyn print\LKYN_"&@YEAR&@MON&@MDAY&"_ConsumerBatch_2.ps") Then $kyncon2=1
            If FileExists("C:\lkyn print\LKYN_"&@YEAR&@MON&@MDAY&"_ConsumerBatch_2.ps") Then $kyncon2=0
            Sleep(100)
        WEnd
        While $kyncon3=1
            If Not FileExists("C:\lkyn print\LKYN_"&@YEAR&@MON&@MDAY&"_ConsumerBatch_3.ps") Then $kyncon3=1
            If FileExists("C:\lkyn print\LKYN_"&@YEAR&@MON&@MDAY&"_ConsumerBatch_3.ps") Then $kyncon3=0
            Sleep(100)
        WEnd

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Yes.

Edit: Ofcourse this is all documented in the help file. In the pages about while, and do .. until .. Actually it's documented pretty much everywhere, why is this topic here?

Edited by Manadar

Share this post


Link to post
Share on other sites

I didn't recall seeing it in the help file (which I pretty much have it open when scite is open... maybe I should write a script to auto open the help file when scite is opened... lol)


010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0