Some variables not expanding

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kneighbour
Newbie
Posts: 4
Joined: Tue Feb 20, 2007 1:56 am

Some variables not expanding

Post by kneighbour » Tue Feb 20, 2007 2:06 am

LET>backup_path = f:\backups\MySQL
Month>the_month
Year>the_year
Let>filename = test_%the_year%%the_month%
Let>runcommand ="C:\Program Files\winrar\rar.exe" a -r %BACKUP_PATH%\%FILENAME% "C:\Program Files\Navicat MySQL\SecureDoc\*.*"

Let>MSG_STAYONTOP=1
MessageModal>filename

This script does not work. The problem is the variables do not expand.

If I single step through the script, Let>filename is ok - it gets assigned ok. But then it is not expanded in the line Let>runcommand=etc..

Even the message dialog MessageModal>filename does not work. It simply shows the word 'filename' in the dialog box - not the contents of the variable %filename%.

If I try the line
MessageModal>%filename%

what i see displayed is %filename%
Kerry

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Tue Feb 20, 2007 2:15 am

You need to remove the spaces from either side of the "="

LET>backup_path = f:\backups\MySQL
Let>filename = test_%the_year%%the_month%

(It doesn't break it but it's less confusing if you stick the the same case for the variable names too.)

kneighbour
Newbie
Posts: 4
Joined: Tue Feb 20, 2007 1:56 am

Post by kneighbour » Tue Feb 20, 2007 2:30 am

Me_again wrote:You need to remove the spaces from either side of the "="

LET>backup_path = f:\backups\MySQL
Let>filename = test_%the_year%%the_month%

(It doesn't break it but it's less confusing if you stick the the same case for the variable names too.)
Yes - thanks. I just worked that out also. You would think that the editor would fix these sorts of problems. But now I know, it is no problem.

And as for the case of variables - I understand what you are saying - I was changing case trying to see if that was the problem.
Kerry

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

Post by Marcus Tettmar » Tue Feb 20, 2007 8:36 am

Me_again wrote:You need to remove the spaces from either side of the "="

LET>backup_path = f:\backups\MySQL
Let>filename = test_%the_year%%the_month%

(It doesn't break it but it's less confusing if you stick the the same case for the variable names too.)
Or with v9, if you like spaces, use Let>IGNORESPACES=1

See the help file topic "Ignoring Spaces - IGNORESPACES"
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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