Bug? ScreenCapture with variables in filename.

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
Captive
Macro Veteran
Posts: 213
Joined: Sun Oct 20, 2002 8:37 pm
Location: Colorado, USA

Bug? ScreenCapture with variables in filename.

Post by Captive » Mon Jan 02, 2006 7:43 pm

Variables don't parse when using them in a filename for the ScreenCapture command.

Example
This works:
ScreenCapture>1,1,200,200,C:\SCTest.BMP

This fails:
Let>FName=C:\SCTest.BMP
ScreenCapture>1,1,200,200,%FName%

The returned error is "1", meaning "Invalid file type specified. Valid file types are .BMP or .JPG".

As presented in another post by someone else, I could force a filename, then rename it to whatever I wanted (the rename command will accept a %variable%). But this is prone to certain problems.

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 Jan 02, 2006 8:00 pm

I think you will find it will work without the %'s

Let>FName=C:\SCTest.BMP
ScreenCapture>1,1,200,200,FName

I recall that I have also come across another MS file command that only works this way.

User avatar
Captive
Macro Veteran
Posts: 213
Joined: Sun Oct 20, 2002 8:37 pm
Location: Colorado, USA

Post by Captive » Mon Jan 02, 2006 8:43 pm

You are indeed correct! FName will work, yet %FName% will not.

However, I almost always use:
Let>VAREXPLICIT=1
... which causes FName to not work. :(
I will have to keep (or set it back to 0) during any use of this command.

Still, in my opinion this should be fixed. Variables with %'s should be allowed to be used.

Do you remember what other command was like this?

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 Jan 02, 2006 9:29 pm

I'm trying to remember...

What usually happens at this point is that mtettmar shows up and points out the error we are making :lol:

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

Post by JRL » Mon Jan 02, 2006 9:57 pm

Its late, he might be sleeping.

See mtettmar's explanation for varexplicit here:
http://www.mjtnet.com/forum/viewtopic.p ... arexplicit

This fails for me whether varexplicit is 1 or 0.
Let>FName=C:\SCTest.BMP
ScreenCapture>1,1,200,200,%FName%
Edit---

Just tried the following and it worked:

- Varexplicit set to 0
- Removed the .BMP from the variable and stuck it on the end of the "ScreenCapture" parameters.

Let>FName=C:\SCTest
ScreenCapture>1,1,200,200,%FName%.bmp


Later,
Dick

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

Post by Marcus Tettmar » Mon Jan 02, 2006 11:44 pm

Not sure what's up with ScreenCapture. Will check it out.
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