Using a gradually increasing variable that gets saved on...

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Frank

Using a gradually increasing variable that gets saved on...

Post by Frank » Fri Aug 20, 2004 9:24 am

Hey Guys,

Basically, I have a macro that hasa variable, lets say 100. It adds +1, uses the variable and does this 50 times. On the 50th time it stops, so it is now at 150. The next time I load the macro, I want it to start on what it left off at, so in this case, 150.


How can I do this? Is there some sort of "write" feature in a macro? I also thought of opening a notepad file and copying and pasting it and then saving the variable, but i cant think of a way to take whats being copied and "+1" it without it being a variable..

Any help would be greatly appreciated =)
Thanks

Lumumba

Post by Lumumba » Fri Aug 20, 2004 2:45 pm

Why not use a specialized text file called ini-file :wink:
Let>k=0
Let>maxk=50
Let>inifile=C:\MyKLoops.ini

ReadIniFile>%inifile%,Ks,Loops,k
Add>maxk,%k%
If>k=0, Loop
Message># of previous loops taken from the INI = %k%

Label>Loop
Add>k,1
If>k=%maxk%, KeepIt, Loop

Label>KeepIt
EditINIFile>EditIniFile>%inifile%,Ks,Loops,%k%
Message>Done. Finished with %k% loops today.%CRLF%Bye !

-----

Filename: MyKLoops.ini
Filecontent:

[Ks]

Loops=0
Untested :!:

Lumumba

Post by Lumumba » Fri Aug 20, 2004 2:48 pm

You've to correct the following line:

EditINIFile>EditIniFile>%inifile%,Ks,Loops,%k%

to become

EditINIFile>%inifile%,Ks,Loops,%k%

:roll:

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Aug 20, 2004 5:16 pm

And now there's one for you too! :D :D

Tuff being so good, makes for an easy target!

May I suggest that you also edit the original so that it can be cut/pasted or used in future by anyone who may not catch the following correction? Might see it in a search, and not read the entire thread.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Lumumba

Post by Lumumba » Fri Aug 20, 2004 6:29 pm

Marcus,
please edit my previous posting as suggested from Bob.
Thx.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Aug 20, 2004 7:37 pm

You cannot edit yourself?

Check icons on right side. Should not need to bother Marcus....
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

The status of a

Post by The status of a » Fri Aug 20, 2004 7:44 pm

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Aug 20, 2004 8:04 pm

Never noticed the Guest status under your name.

If registered user, I think you should request Marcus to upgrade if possible.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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