Always looping

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Identis
Junior Coder
Posts: 26
Joined: Fri Mar 27, 2015 11:26 am

Always looping

Post by Identis » Thu Dec 01, 2016 11:06 am

Hello,

what's wrong with my script? Why it's always looping even "ini" is empty? In conf.ini I have only vieta1 and vieta2 not empty, but he is always going throw and 3,4,5,6,7,8......... It's not reacting to while>%ini%<>"".

Please help to solve it.

Thanks.

Code: Select all

ReadIniFile>%script_dir%\conf.ini,settings,old,dienos
ReadIniFile>%script_dir%\conf.ini,settings,path1,vieta1
ReadIniFile>%script_dir%\conf.ini,settings,path2,vieta2
ReadIniFile>%script_dir%\conf.ini,settings,path3,vieta3
ReadIniFile>%script_dir%\conf.ini,settings,path4,vieta4


Let>numeris=1
Label>go
Let>ini=vieta
ConCat>ini,numeris
while>%ini%<>""
GetFileList>%ini%,files1
Separate>files1,;,file_names1
If>file_names1_count>0
  Let>a=0
  Repeat>a
      Let>a=a+1
      Let>this_file1=file_names1_%a%
      IfFileChanged>this_file1,>%dienos%
      DeleteFile>this_file1
      Endif
  Until>a,file_names1_count
EndIf
Let>numeris=numeris+1
goto>go
EndWhile

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Always looping

Post by Marcus Tettmar » Mon Dec 05, 2016 9:16 am

ini is not empty, it is "vieta". There's no variable "vieta" so INI is equal to "vieta".

The debugger will show you.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
Djek
Pro Scripter
Posts: 148
Joined: Sat Feb 05, 2005 11:35 pm
Location: Holland
Contact:

Re: Always looping

Post by Djek » Mon Dec 05, 2016 9:25 am

yes i agree with Marcus that it a wrong use of expressions, and of the while loop.

but ini is empty if you get the value of the string

i broke your code down and managed to create a working one:
:D

Code: Select all


let>vieta1=c:\testdir11
let>vieta2=c:\testdir12
let>vieta3=
let>vieta4=

Let>numeris=1
let>ini=dummyvalue
label>go
  Let>ini=vieta
  ConCat>ini,numeris
  let>ini=%%ini%%
  if>{%ini%<>""}
    Message>do things with %ini%
    wait>1
    let>numeris=numeris+1
    goto>go
   else
    Message>no things to do
    wait>1
    goto>fini
  endif
  
label>fini
Message>ready

kind regards,
Djek

Identis
Junior Coder
Posts: 26
Joined: Fri Mar 27, 2015 11:26 am

Re: Always looping

Post by Identis » Mon Dec 05, 2016 9:36 am

Djek wrote:yes i agree with Marcus that it a wrong use of expressions, and of the while loop.

but ini is empty if you get the value of the string

i broke your code down and managed to create a working one:
:D

Code: Select all


let>vieta1=c:\testdir11
let>vieta2=c:\testdir12
let>vieta3=
let>vieta4=

Let>numeris=1
let>ini=dummyvalue
label>go
  Let>ini=vieta
  ConCat>ini,numeris
  let>ini=%%ini%%
  if>{%ini%<>""}
    Message>do things with %ini%
    wait>1
    let>numeris=numeris+1
    goto>go
   else
    Message>no things to do
    wait>1
    goto>fini
  endif
  
label>fini
Message>ready

kind regards,
Djek

Thank You :)

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts