An idea of procedure call, will it work?

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
OlgaFB
Pro Scripter
Posts: 58
Joined: Mon Nov 01, 2004 3:04 pm
Contact:

An idea of procedure call, will it work?

Post by OlgaFB » Tue Oct 03, 2006 2:33 pm

Hi Marcus,

I just looked at many procedure calls I had with different values of r, the dialog response I get from GetDialogAction.

So I go

if>r=1,OpenThis
if>r=2,LoadThat
etc.

But I just thought, what if I just give the procedures names like r values: 1, 2 etc. and write it like

GoSub>r

should it rightfully work?

I just tried to create a couple of functions with number names, and it was ok, but what's on the background? Are there any rules preventing this?

Thank you very much,
Olga.

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

Post by Marcus Tettmar » Tue Oct 03, 2006 2:58 pm

Yes, you can do that, but it might be better to do something like:

GoSub>Sub_%r%

SRT>Sub_1
..
End>Sub_1

SRT>Sub_2
..
End>Sub_2

etc.
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
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Tue Oct 03, 2006 5:20 pm

I would caution you about using any single letter (or any valid key, for that matter) as a variable. Just in case your application then needs to do something like Send>r and you want to really send the letter r ...you might actually be sending the value of the variable r instead....

a lesson learned through experience.

OlgaFB
Pro Scripter
Posts: 58
Joined: Mon Nov 01, 2004 3:04 pm
Contact:

Post by OlgaFB » Tue Oct 03, 2006 6:09 pm

ooo, thank you!! a very good tip.

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