I have a new project that I'm almost finished with. I have three different compiled MS scripts that need to pass variables back and forth to each other. When I have a small number of variables, I'm ok. But in one case, the variable is an array of three text elements, one short, one 20 chars and the other up to 100 characters. Generally there will be between 10- 20 items in the array whenever that needs to get passed.
I'm considering writing the contents of the array to a text file, and then having the receiving program read the file to get the input and do its thing.
I just wanted to ask if someone has experience with this sort of thing, and if there is another approach I should consider.
Thanks in advance.
Advice for passing variables
Moderators: JRL, Dorian (MJT support)
Advice for passing variables
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
- Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: Advice for passing variables
A text file is perfectly fine, I use the approach myself. But you could also pass data through a text field which the receiving script have as a dialog box with size 0, 0 and perhaps coordinates -9999, -9999 if you don't want them to be shown in the Windows GUI.
Re: Advice for passing variables
Thanks, I decided to go with the text file approach, one advantage that has is that there is a record of the values I'm passing, and that will help with debugging.
I appreciate your input.
I appreciate your input.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
Re: Advice for passing variables
Grovkillen!
So I had some serious problems with passing data through files: viewtopic.php?f=2&t=10909
It forced me to think about this question a little more, and I realized that there is indeed one method I had not considered: DATABASE
It is just as easy to do an HTTP call as it is to ReadLn or to WriteLn, and a database will give me historical data in a way that files cannot! It also nullifies the difficulty I have had, described in the post up above.
Just wanted to feed back to you in case you ever have the same kind of difficulty.
So I had some serious problems with passing data through files: viewtopic.php?f=2&t=10909
It forced me to think about this question a little more, and I realized that there is indeed one method I had not considered: DATABASE
It is just as easy to do an HTTP call as it is to ReadLn or to WriteLn, and a database will give me historical data in a way that files cannot! It also nullifies the difficulty I have had, described in the post up above.
Just wanted to feed back to you in case you ever have the same kind of difficulty.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
- Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: Advice for passing variables
Thanks for the feedback 

Re: Advice for passing variables
@mightycpa,
It seems like you are doing more work than is needed. You can pass info between macros by using command line.
ExecuteFile>YourPath\YourFilename.exe,YourParameters(you can just place your strings here.)
Like %string1%;%string2%;
Then in the called exe, you would import the parameters like this-
Let>MyString=%Command_Line%
***Rest Of Program ***
All your data is now in MyString.
Good Luck,
PepsiHog
It seems like you are doing more work than is needed. You can pass info between macros by using command line.
ExecuteFile>YourPath\YourFilename.exe,YourParameters(you can just place your strings here.)
Like %string1%;%string2%;
Then in the called exe, you would import the parameters like this-
Let>MyString=%Command_Line%
***Rest Of Program ***
All your data is now in MyString.
Good Luck,
PepsiHog
Windows 7
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
Re: Advice for passing variables
Thanks PH, I thought about doing it that way, and normally I do.
This time, it was the size (> 100 chars) of each potential string that was giving me some pause, and while I know the command line can probably handle them, still, I had my doubts. Also I'm dealing with multiple iterations of strings, so that affects the potential size of the variable being passed, depending on how I loop through them. Do I pass all of the records over at once? Do I repeatedly call my three programs over and over for every record I need to pass? Or do I call each program once, and let each one retrieve and save all the records in each run, and then call the downstream program to iterate though each of them? The latter seemed much cleaner.
Not sure that I made that clear in my original post.
At first, I decided to go with a file, but I had weird troubles with that
(viewtopic.php?f=2&t=10909)
so now I've moved on to doing it via HTTP calls to database-connected webpages. The one advantage that has over both passing and reading/writing text files is that I can easily archive my results, and use them to detect problems, unanticipated string handling, etc.
You're right, it was a little more work, but it's not hard work and the result is very orderly, very auditable.
I appreciate the help you suggested as well as the code to do it.
This time, it was the size (> 100 chars) of each potential string that was giving me some pause, and while I know the command line can probably handle them, still, I had my doubts. Also I'm dealing with multiple iterations of strings, so that affects the potential size of the variable being passed, depending on how I loop through them. Do I pass all of the records over at once? Do I repeatedly call my three programs over and over for every record I need to pass? Or do I call each program once, and let each one retrieve and save all the records in each run, and then call the downstream program to iterate though each of them? The latter seemed much cleaner.
Not sure that I made that clear in my original post.
At first, I decided to go with a file, but I had weird troubles with that
(viewtopic.php?f=2&t=10909)
so now I've moved on to doing it via HTTP calls to database-connected webpages. The one advantage that has over both passing and reading/writing text files is that I can easily archive my results, and use them to detect problems, unanticipated string handling, etc.
You're right, it was a little more work, but it's not hard work and the result is very orderly, very auditable.
I appreciate the help you suggested as well as the code to do it.
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey