passing variables to other macros

General Macro Scheduler discussion

Moderators: JRL, Dorian (MJT support)

Post Reply
goose1888
Newbie
Posts: 3
Joined: Thu Jul 01, 2004 9:20 pm

passing variables to other macros

Post by goose1888 » Thu Jul 01, 2004 9:23 pm

Hi there,

New to this Macro scheduler so any help would be appreciated.

What the problem is. I have one marco that will accept a variable called price (this macro will work when a key is hit). The hotkey enables the user to input a price.

I then want this variable (price) to be used 6 other separate macros. These macros will be called by a series of of seperate HOTKEYS.

Is it possible to pass the variable I've accepted from the user to these other macros? Think it must be able to be done, but haven't had much luck trying to work it out.

Maybe could be done by the use of some subroutines but don't know if hotkeys can trigger these? Any help appreciated. :)


RG
let the people sing!

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 Jul 02, 2004 12:24 am

If the other macros are being called by a master macro, then you can pass the variable along as long as the second macro already has the variable defined.

If the other macros are not being called by a master macro, then I would suggesd that you have the first, master macro get the variable and then write it to an INI file. Now the secondary macros can read the value from the INI file. That value will stay there until you rerun the master to prompt for another input value.

See the Help sections on EditIniFile and ReadIniFile.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Guest

Post by Guest » Sun Jul 04, 2004 9:20 am

Bob Hansen wrote:If the other macros are being called by a master macro, then you can pass the variable along as long as the second macro already has the variable defined.

If the other macros are not being called by a master macro, then I would suggesd that you have the first, master macro get the variable and then write it to an INI file. Now the secondary macros can read the value from the INI file. That value will stay there until you rerun the master to prompt for another input value.

See the Help sections on EditIniFile and ReadIniFile.
Thanks for that. Managed to get it working :)

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 » Sun Jul 04, 2004 4:35 pm

Glad you got it working.

How about explaining how you got it working so others can benefit from your experience.

How did you make it work, and why did you choose that method vs. any other method?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Guest

Post by Guest » Mon Jul 05, 2004 1:52 pm

Bob Hansen wrote:Glad you got it working.

How about explaining how you got it working so others can benefit from your experience.

How did you make it work, and why did you choose that method vs. any other method?

No probs. I'll try and explain what I did and hope it makes sense.
Used the EditIniFile and ReadIniFile method. Pretty simple and worked just about the first time.
First of I created a blank notepad document and named myfile.ini and saved it. Don't know if that was the correct thing to do - but seemed to work.
It was a matter creating a macro that used EditIniFile to change the variable. Got the exact syntax from the HELP menu.
Then created a separate macro with the ReadIniFile command to read it. To test it I set up a command to display the new value and make sure it had worked. 8)

miles

passing values to other macros

Post by miles » Thu Jul 22, 2004 9:21 am

I use things like this :

Macro>remcreate.scp /PRODUCT=%PRODUCT% /FAULT=%FAULT% /PRIORITY=%PRIORITY% /FTC=%FTC% /LOCATION=%LOCATION%

But this will only work if you are sending the variables to one macro, you could daisy chain them though putting this line in each sub macro (changing the name of the macro you are passing the variables to in each case)

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