Combining string variables and numeric variables

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
TimTom
Newbie
Posts: 18
Joined: Mon Oct 10, 2005 3:05 pm

Combining string variables and numeric variables

Post by TimTom » Mon Oct 10, 2005 3:08 pm

I haven't been able to combine a string variable with a numeric variable, which I desperately need for automatic file saving. Any help with the following will be greatly appreciated.

press ALT
press Shift
press CTRL
send>s
release ALT
release Shift
release CTRL
wait>2
press Enter
waitwindowopen>Save Optimized As*
Let>SK_DELAY=10
Let>VAREXPLICIT=1
let>GroupName=C:\HfBooks\eBayPhotos\group-
let>GroupName=GroupName+%GroupNumber%
send>%GroupName%

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Oct 10, 2005 3:49 pm

Should be:

let>GroupName=%GroupName%%GroupNumber%
MJT Net Support
[email protected]

TimTom
Newbie
Posts: 18
Joined: Mon Oct 10, 2005 3:05 pm

Combining Variables

Post by TimTom » Mon Oct 10, 2005 4:10 pm

Didn't work. The result was:
C:\HfBooks\eBayPhotos\group-%GoupNumber%

Trying to get something that looks like this: C:\HfBooks\eBayPhotos\group-113, where the "113" is from the GroupNumber variable.

The code I used was this:

press ALT
press Shift
press CTRL
send>s
release ALT
release Shift
release CTRL
wait>2
press Enter
waitwindowopen>Save Optimized As*
Let>SK_DELAY=10
Let>VAREXPLICIT=1
let>GroupName=C:\HfBooks\eBayPhotos\group-
let>GroupName=%GroupName%%GroupNumber%
send>%GroupName%

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

Post by Me_again » Mon Oct 10, 2005 4:16 pm

What code are you using to generate GroupNumber?

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 » Mon Oct 10, 2005 4:17 pm

You have not defined a %GroupNumber% variable.

Where/how do you expect to get the 113 that you referenced??
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
JRL
Automation Wizard
Posts: 3503
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Oct 10, 2005 4:23 pm

C:\HfBooks\eBayPhotos\group-%GoupNumber%
Is the "%GoupNumber%" typo in the forum or is the typo in your code?

You don't explain how you're defining "GroupNumber" or what else may be happening to it between definition and use. When I have odd results like this I find it useful to plug in a MessageModal just ahead of where I want to use the variable so that I can temporarily see what variable's real value is.

press ALT
press Shift
press CTRL
send>s
release ALT
release Shift
release CTRL
wait>2
press Enter
waitwindowopen>Save Optimized As*
Let>SK_DELAY=10
Let>VAREXPLICIT=1
let>GroupName=C:\HfBooks\eBayPhotos\group-

MDL>%GroupNumber%

let>GroupName=%GroupName%%GroupNumber%
send>%GroupName%

Hope this is helpful,
Dick

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 » Mon Oct 10, 2005 4:58 pm

Also note that there is no SetFocus before doing Send.

Would be good to see all code that can affect your results.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

TimTom
Newbie
Posts: 18
Joined: Mon Oct 10, 2005 3:05 pm

Post by TimTom » Mon Oct 10, 2005 5:46 pm

Boy, thank you all very much for your replies.

I set the GroupNumber variable in another macro just for that purpose. Guess the question is, are variables global in Scheduler? Can I set a variable in one macro and use it in another?

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Mon Oct 10, 2005 6:00 pm

No, a variable set in one macro is not visible in another unless you pass it to it. The Macro> command can be used to run another macro and you can pass a variable to it:

Macro>path\macrofile.scp /variablea=somevalue
MJT Net Support
[email protected]

TimTom
Newbie
Posts: 18
Joined: Mon Oct 10, 2005 3:05 pm

Post by TimTom » Mon Oct 10, 2005 7:23 pm

I am not having any luck at all with this, but I really appreciate all the help.

Let me back up here and describe what I am trying to do. I need to automatically create the path to save various photo files to my hard drive. The path will look something like this (with the variables I need to input in brackets): C:\HfBooks\eBayPhotos\group-[113]\[Poe]-[01].jpg.

The first variable, shown as "113" here, will remain the same for each work session. The second variable, shown as "Poe," will change a few times in each work session. The third variable, shown as "01," will change with each photo I save to disk.

The macro will NOT, however, be running throughout the entire process; rather, it will be started and ended for each photo. So I am looking for a way to automatically retrieve the correct group number (the "113" exampe), to automatically retrive the title (the "Poe" example) and to automatically increment the photo number (the "01" example).

Can you point me towards the code which will enable me to do this?

With abject apologies if I am testing your patience.

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

Post by Me_again » Mon Oct 10, 2005 11:50 pm

I think the best solution to this would be to use an .ini file to store the values between uses. There's a similar example here http://www.mjtnet.com/usergroup/viewtop ... ditinifile

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