How do you get MS to use the XP variable %username% ??

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
mileage

How do you get MS to use the XP variable %username% ??

Post by mileage » Tue Nov 23, 2004 12:25 am

I'm trying to schedule a KEA (unix session) to run at a certain time. I also want it to run for all the 20 users that will be doing this task. The session is stored at different places depending on who is logged on. In XP you can specify a directory using the variable %username% but MS appears to be taking this literally and not using the XP variable. Any ideas brain boxes ?


Here is the path of the Kea session I want kicked off :

C:\Documents and Settings\%username%\Application Data\Attachmate\Keavt\KEA sessions\BACS_Generation.KTC


Cheers guys.

mileage

Don't worry, I've only gone and done it.

Post by mileage » Tue Nov 23, 2004 12:50 am

Just to let you all know, I had 3 of us searching for %username% in the forum, and managed to find the MS variable USER_NAME, it seems to hold the windows variable. Cool.

mileage

Arrgghhhh

Post by mileage » Wed Nov 24, 2004 4:00 am

O.K I though I had it but there appears to be a problem, here it is. I copy the entire Scheduler to a shared area on a network drive, everytime users start it up they kick off a batch script which copies it to their profile, the idea being that they are idiots that don't know what they are doing, and if they need macros I make them and they have them downloaded when they start the next time. No I have set the scene, here is the strange stuff :-

executefile>C:\Documents and Settings\%user_name%\Application Data\Attachmate\Keavt\Nivara-rmg_err.KTC

This line runs a session in C:\Documents and Settings\willim1011\Application Data\Attachmate\Keavt\Nivara-rmg_err.KTC

When my colleague tests it the scheduler seems to try and start C:\Documents and Settings\willim1011\Application Data\Attachmate\Keavt\Nivara-rmg_err.KTC also !

It should realise that he is logged onto XP as whit_cw and replace %user_name% with that, not willim1011.

Hope that is clear, what am I doing wrong ? I would have thought MS would reload the windows environment variables when it starts.

Any advice would be great.

Cheers.

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 » Wed Nov 24, 2004 4:24 am

It sounds like you are trying to have local workstations run Macro Scheduler program from a network location. (I think that may not comply with licensing, but that is an issue you can discuss with MJT). But I suspect that the %user_name% is coming from the system where the Macro Scheduler program is stored.

Rather then downloading scripts, I keep all scripts on a shared source on the network. Each workstation has a licensed copy of Macro Scheduler and the Groups are all mapped to the folder on the server where the macros are located.

If too many licenses are required then make compiled versions of the scripts and have them distributed.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

mileage

Arrgghhhh

Post by mileage » Wed Nov 24, 2004 6:19 am

O.K I though I had it but there appears to be a problem, here it is. I copy the entire Scheduler to a shared area on a network drive, everytime users start it up they kick off a batch script which copies it to their profile, the idea being that they are idiots that don't know what they are doing, and if they need macros I make them and they have them downloaded when they start the next time. No I have set the scene, here is the strange stuff :-

executefile>C:\Documents and Settings\%user_name%\Application Data\Attachmate\Keavt\Nivara-rmg_err.KTC

This line runs a session in C:\Documents and Settings\willim1011\Application Data\Attachmate\Keavt\Nivara-rmg_err.KTC

When my colleague tests it the scheduler seems to try and start C:\Documents and Settings\willim1011\Application Data\Attachmate\Keavt\Nivara-rmg_err.KTC also !

It should realise that he is logged onto XP as whit_cw and replace %user_name% with that, not willim1011.

Hope that is clear, what am I doing wrong ? I would have thought MS would reload the windows environment variables when it starts.

Any advice would be great.

Cheers.

mileage

good idea

Post by mileage » Wed Nov 24, 2004 6:40 am

Sorry for the repeat post...I'm tired.

Thanks for the reply :

When making a shared macro area, what else other than the actual .txt macros do I need to put there ? When I make a new macro, and upload it how does their scheduler know all the "run when" details, I assume there is an ini file or the equivilant of a schedule file that MS needs to gets it's hands on.

We have 2 machines with it installed, a copy backed up on a network drive, and 3 licenses, as there are 4 shifts of 2 we only have 2 people using it at a time. The compiling thigng only comes with Pro, dispite the company making several billion euros a year they would only let me have the cooking model of MS. :-(

Thanks again for the replies to my posts it makes this program even better. The help on this forum is outstanding.

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 » Wed Nov 24, 2004 3:45 pm

Each local copy of Macro Scheduler has the ini files needed in the same folder as the program. All you need to do is make a folder for each Group on the server. Store the*.scp files only in those Group folders. List the Macro on the main screen for the local copy of Macro Scheduler and designate the server folders as the location for the groups. This is done in the Group Properties for existing Groups, and can be designated as the path for new Groups.

Once the path is defined, you may need to Import files to that group for them to show up on the list of macros. This also allows you to have separate folders and common folders to control who has access to which macros.
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