Calling other scripts

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
mnaeem
Junior Coder
Posts: 29
Joined: Wed Mar 10, 2021 5:05 pm

Calling other scripts

Post by mnaeem » Sun Mar 14, 2021 6:31 pm

Hello,
I have a main script named as main from this script I want to call another script named validateConfigs. Simply trying to isolate functionality into multiple scripts so that I can easily debug or maintain. Is it possible?

If the above requirement is do able then please also guide or share some link that how can I pass the arguments and get the values returned from the script.

Otherwise please advise what is the recommended way to isolate script code ?

Thanks

mnaeem
Junior Coder
Posts: 29
Joined: Wed Mar 10, 2021 5:05 pm

Re: Calling other scripts

Post by mnaeem » Sun Mar 14, 2021 6:51 pm

I guess this is what I am looking for https://www.mjtnet.com/manuals/v15/HTML/macro.html

mightycpa
Automation Wizard
Posts: 343
Joined: Mon Jan 12, 2004 4:07 pm
Location: Vienna, VA

Re: Calling other scripts

Post by mightycpa » Sun Mar 14, 2021 7:31 pm

Hi mnaeem,

As far as I've been able to figure out so far, you've got four choices:

1) Most popular choice, the link that you answered your own question with. Pepsi Hog has a nice writeup here: viewtopic.php?f=2&t=10907#p46399 and I'll just add that if your variables are REQUIRED, then you ought to use the Assigned> command at the beginning of your target script.

2) If you have a lot of data, you might want to think about putting the data in a text file, and reading it in from your downstream scripts. Either free form text, or ini files would work too. They are a little more structured.

3) A database connection is another way to go. One advantage this has over the others is you automatically keep a history of variables you pass, and your data is orderly. Can be useful for debugging. If you don't have a local database, Microsoft has an ODBC driver for text files, so you can read/write to a text file as if it were a db table.

4) A database connection via HTTP webpage. Same as #3, except your data is on the cloud, and in a real database.

Good luck!
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey

mnaeem
Junior Coder
Posts: 29
Joined: Wed Mar 10, 2021 5:05 pm

Re: Calling other scripts

Post by mnaeem » Mon Mar 15, 2021 9:41 am

Hello mightycpa,

Appreciate the great ideas you have shared about how to share the data between scripts. I have looked at it and yes to me also database option seems quiet affordable as it will also help avoid file locking issues etc incase your macro is doing some heavy processing.

Thanks

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