ScreenCapture and spaces in file names?
Moderators: JRL, Dorian (MJT support)
- Dorian (MJT support)
- Automation Wizard
- Posts: 1417
- Joined: Sun Nov 03, 2002 3:19 am
ScreenCapture and spaces in file names?
Hi guys,
The new ScreenCapture> is just what the doctor ordered, and will enable me to cut down the time used by my daily image cropping macro.
However, I need to save the jpg's with spaces in the name, but it gives me an error 1*
The following works like a charm when %nm% is, e.g "john", but throws an error is %nm% is "john smith".
ScreenCapture>245,61,837,777,d:\wheels01\%nm%.jpg
Obviously the space is causing it to think the filetype is wrong - is there any way around this?
* Error 1: Invalid file type specified. Valid file types are .BMP or .JPG
The new ScreenCapture> is just what the doctor ordered, and will enable me to cut down the time used by my daily image cropping macro.
However, I need to save the jpg's with spaces in the name, but it gives me an error 1*
The following works like a charm when %nm% is, e.g "john", but throws an error is %nm% is "john smith".
ScreenCapture>245,61,837,777,d:\wheels01\%nm%.jpg
Obviously the space is causing it to think the filetype is wrong - is there any way around this?
* Error 1: Invalid file type specified. Valid file types are .BMP or .JPG
- Dorian (MJT support)
- Automation Wizard
- Posts: 1417
- Joined: Sun Nov 03, 2002 3:19 am
Oh, hold on, I kind of figured out a bodge. If there is a proper way I'd like to know, but in the meantime I used this and it works :
ScreenCapture>245,61,837,777,d:\wheels01\123qaz.jpg
movefile>d:\wheels01\123qaz.jpg,d:\wheels01\%nm%.jpg
Give it a fixed name then rename it to what I really needed it to be.
ScreenCapture>245,61,837,777,d:\wheels01\123qaz.jpg
movefile>d:\wheels01\123qaz.jpg,d:\wheels01\%nm%.jpg
Give it a fixed name then rename it to what I really needed it to be.
All,
I'm having problems where Horoscopes states the script is functioning
all right by him.
Below are a few combinations using and not using the
% for the string.
What I'm doing is reading an Excel .csv file. My goal is to
take a screen shot of each URL. The code below is in a loop
and I have no problem creating/realizing standard.jpg.
(In my testing I always manually delete standard.jpg from c:\MyDir)
My problem is when I try to rename it to [web page URL].com
to [web page URL].jpg as a file name. No can do ... standard.jpg
remains unnamed. Of course if I 'hardcode' the name on the
move it works perfectly. Any suggestions? Anybody else have/had
the same issue(s)?
Please notice I set MF_RENAME to 1 as directed it the objective is
a rename. My "RowHold' works perfectly for the DDERequest.
Also, you can see the stringreplace is to truncate or crop the .com
of the URL to put on a .jpg Also the URL's I'm using have no slashes. I would use the Macro Scheduler stringreplace if there may be any in the
future.
Thanks for any help.
Joel.
1.)
Let>MF_RENAME=1
.
.
.
DDERequest>Excel,c:\MyDir\url_list-1.csv,R%RowHold%C1,%HoldPage%,60
.
.
.
StringReplace>%HoldPage%,.com,,%HoldPage%
ScreenCapture>20,1,599,699,c:\MyDir\standard.jpg
MoveFile>c:\MyDir\standard.jpg,c:\MyDir\%HoldPage%.jpg
MessageModal>%HoldPage%
2.)
Let>MF_RENAME=1
.
.
.
DDERequest>Excel,c:\MyDir\url_list-1.csv,R%RowHold%C1,%HoldPage%,60
.
.
.
StringReplace>%HoldPage%,.com,,HoldPage
ScreenCapture>20,1,599,699,c:\MyDir\standard.jpg
MoveFile>c:\MyDir\standard.jpg,c:\MyDir\%HoldPage%.jpg
MessageModal>%HoldPage%
3.)
Let>MF_RENAME=1
.
.
.
DDERequest>Excel,c:\MyDir\url_list-1.csv,R%RowHold%C1,%HoldPage%,60
.
.
.
StringReplace>%HoldPage%,.com,,%HoldPage2%
ScreenCapture>20,1,599,699,c:\MyDir\standard.jpg
MoveFile>c:\MyDir\standard.jpg,c:\MyDir\%HoldPage2%.jpg
MessageModal>%HoldPage2%
I'm having problems where Horoscopes states the script is functioning
all right by him.
Below are a few combinations using and not using the
% for the string.
What I'm doing is reading an Excel .csv file. My goal is to
take a screen shot of each URL. The code below is in a loop
and I have no problem creating/realizing standard.jpg.
(In my testing I always manually delete standard.jpg from c:\MyDir)
My problem is when I try to rename it to [web page URL].com
to [web page URL].jpg as a file name. No can do ... standard.jpg
remains unnamed. Of course if I 'hardcode' the name on the
move it works perfectly. Any suggestions? Anybody else have/had
the same issue(s)?
Please notice I set MF_RENAME to 1 as directed it the objective is
a rename. My "RowHold' works perfectly for the DDERequest.
Also, you can see the stringreplace is to truncate or crop the .com
of the URL to put on a .jpg Also the URL's I'm using have no slashes. I would use the Macro Scheduler stringreplace if there may be any in the
future.
Thanks for any help.
Joel.
1.)
Let>MF_RENAME=1
.
.
.
DDERequest>Excel,c:\MyDir\url_list-1.csv,R%RowHold%C1,%HoldPage%,60
.
.
.
StringReplace>%HoldPage%,.com,,%HoldPage%
ScreenCapture>20,1,599,699,c:\MyDir\standard.jpg
MoveFile>c:\MyDir\standard.jpg,c:\MyDir\%HoldPage%.jpg
MessageModal>%HoldPage%
2.)
Let>MF_RENAME=1
.
.
.
DDERequest>Excel,c:\MyDir\url_list-1.csv,R%RowHold%C1,%HoldPage%,60
.
.
.
StringReplace>%HoldPage%,.com,,HoldPage
ScreenCapture>20,1,599,699,c:\MyDir\standard.jpg
MoveFile>c:\MyDir\standard.jpg,c:\MyDir\%HoldPage%.jpg
MessageModal>%HoldPage%
3.)
Let>MF_RENAME=1
.
.
.
DDERequest>Excel,c:\MyDir\url_list-1.csv,R%RowHold%C1,%HoldPage%,60
.
.
.
StringReplace>%HoldPage%,.com,,%HoldPage2%
ScreenCapture>20,1,599,699,c:\MyDir\standard.jpg
MoveFile>c:\MyDir\standard.jpg,c:\MyDir\%HoldPage2%.jpg
MessageModal>%HoldPage2%
Here's another couple of combinations
Joel.
4.)
Let>MF_RENAME=1
.
.
.
DDERequest>Excel,c:\MyDir\url_list-1.csv,R%RowHold%C1,HoldPage,60
.
.
.
StringReplace>HoldPage,.com,,HoldPage
ScreenCapture>20,1,599,699,c:\MyDir\standard.jpg
MoveFile>c:\MyDir\standard.jpg,c:\MyDir\%HoldPage%.jpg
MessageModal>%HoldPage%
5.)
Let>MF_RENAME=1
.
.
.
DDERequest>Excel,c:\MyDir\url_list-1.csv,R%RowHold%C1,HoldPage,60
.
.
.
StringReplace>HoldPage,.com,,%HoldPage%
ScreenCapture>20,1,599,699,c:\MyDir\standard.jpg
MoveFile>c:\MyDir\standard.jpg,c:\MyDir\%HoldPage%.jpg
MessageModal>%HoldPage%
Joel.
4.)
Let>MF_RENAME=1
.
.
.
DDERequest>Excel,c:\MyDir\url_list-1.csv,R%RowHold%C1,HoldPage,60
.
.
.
StringReplace>HoldPage,.com,,HoldPage
ScreenCapture>20,1,599,699,c:\MyDir\standard.jpg
MoveFile>c:\MyDir\standard.jpg,c:\MyDir\%HoldPage%.jpg
MessageModal>%HoldPage%
5.)
Let>MF_RENAME=1
.
.
.
DDERequest>Excel,c:\MyDir\url_list-1.csv,R%RowHold%C1,HoldPage,60
.
.
.
StringReplace>HoldPage,.com,,%HoldPage%
ScreenCapture>20,1,599,699,c:\MyDir\standard.jpg
MoveFile>c:\MyDir\standard.jpg,c:\MyDir\%HoldPage%.jpg
MessageModal>%HoldPage%
One more note in addedum to the %string% issue I'm having
with the movefile ... it seems to be the same issue when I tried
to use the string in the Macro Scheduler ScreenCapture command
directly:
ScreenCapture>20,1,599,699,c:\ESNagel\%HoldPage%.jpg
where doing a:
MessageModal>%HoldPage% immediately after the screen capture
would show say the string: yahoo
I have a feeling if Horoscopes had got the following to work as he
said he did in his post:
ScreenCapture>245,61,837,777,d:\wheels01\123qaz.jpg
movefile>d:\wheels01\123qaz.jpg,d:\wheels01\%nm%.jpg
The %nm% string would/should work directly in the ScreenCapture.
Also, in my DDERequests combination attempts using
DDERequest>Excel,c:\MyDir\url_list-1.csv,R%RowHold%C1,HoldPage,60
DDERequest>Excel,c:\MyDir\url_list-1.csv,R%RowHold%C1,%HoldPage%,60
If I "pack" or "populate" HoldPage with the %'s or without on
the MessageModal I still get the string from the Excel .csv file
on the MeesageModal>%HoldPage%
It's like the data is in HoldPage and/or HoldPage points to the
string: yahoo (or wahtever) but it is just not being recognized.
Joel.
Joel.
with the movefile ... it seems to be the same issue when I tried
to use the string in the Macro Scheduler ScreenCapture command
directly:
ScreenCapture>20,1,599,699,c:\ESNagel\%HoldPage%.jpg
where doing a:
MessageModal>%HoldPage% immediately after the screen capture
would show say the string: yahoo
I have a feeling if Horoscopes had got the following to work as he
said he did in his post:
ScreenCapture>245,61,837,777,d:\wheels01\123qaz.jpg
movefile>d:\wheels01\123qaz.jpg,d:\wheels01\%nm%.jpg
The %nm% string would/should work directly in the ScreenCapture.
Also, in my DDERequests combination attempts using
DDERequest>Excel,c:\MyDir\url_list-1.csv,R%RowHold%C1,HoldPage,60
DDERequest>Excel,c:\MyDir\url_list-1.csv,R%RowHold%C1,%HoldPage%,60
If I "pack" or "populate" HoldPage with the %'s or without on
the MessageModal I still get the string from the Excel .csv file
on the MeesageModal>%HoldPage%
It's like the data is in HoldPage and/or HoldPage points to the
string: yahoo (or wahtever) but it is just not being recognized.
Joel.
Joel.
Just one more addendum of information re: my string issue.
I tried a:
Let>HoldName2=HoldName
What I didn't do is any String Len analysis. Is it possible
I have some non-printing characters that is messing up
my string and ruining my day?? If I do a straight transfer
from one variable to another I see in hindsight I'm not buying
anything. If this is indeed the case or the issue do I need to
do my own alphanumeric string filter or is there something
less complex I'm missing? Just wondering out loud.
Joel.
I tried a:
Let>HoldName2=HoldName
What I didn't do is any String Len analysis. Is it possible
I have some non-printing characters that is messing up
my string and ruining my day?? If I do a straight transfer
from one variable to another I see in hindsight I'm not buying
anything. If this is indeed the case or the issue do I need to
do my own alphanumeric string filter or is there something
less complex I'm missing? Just wondering out loud.
Joel.
- Dorian (MJT support)
- Automation Wizard
- Posts: 1417
- Joined: Sun Nov 03, 2002 3:19 am
It's a long time since I wrote that macro so it's not too fresh in my mind. I still use it on a daily basis, with that renaming workaround, and it works fine.
Capture using a fixed name and rename to the intended name works perfectly.
Maybe it's because you're dealing with an unusual file extension? I am not entirely clear on what you're doing, so I'm sorry for not being too helpful.
Capture using a fixed name and rename to the intended name works perfectly.
Maybe it's because you're dealing with an unusual file extension? I am not entirely clear on what you're doing, so I'm sorry for not being too helpful.
Horoscopes2000 - Thanks for your reply perhaps I explained it
in too complicated a manner ....
Take the following 4 lines of code:
1 DDERequest>Excel,c:\MyDir\url_list-1.csv,R1C1,HoldPage,60
2 StringReplace>HoldPage,.com,,HoldPage
3 ScreenCapture>20,1,599,699,c:\MyDir\standard.jpg
4 MoveFile>c:\MyDir\standard.jpg,c:\MyDir\%HoldPage%.jpg
5 MessageModal>%HoldPage%
In line 1 HoldPage is "packed" with string: yahoo.com from an
Excel .csv file.
In Line 2 the objective is if the string packed in HoldPage contains
a substring of .com it will be replaced or substituted by a "Null string"
thus yahoo.com becomes yahoo
In Line 3 I'm screen capturing http://www.yahoo.com which is fully
loaded up in Internet Explorer browser and saving the
capture to a standard named file: standard.jpg
In Line 4 my objective is to rename the standard file:
standard.jpg to the modified string (from Line 2) concatenated
by: .jpg
Line Line 5 the MessageModal shows HoldFile contains the
string: yahoo
In Line 4 if I don't surround HoldFile with %'s I know I'm
going to realize a standard file renaming of standard.jpg to:
HoldPage.jpg in MyDir so in Line 4 I don't try different
combinations of HoldFile surrounded/not surrounded by
%'s but in Lines 1,2 and 3 I have (e.g.
1 DDERequest>Excel,c:\MyDir\url_list-1.csv,R1C1,%HoldPage%,60)
I hope this defines my problem more succinctly.
Thanks again.
Joel.
in too complicated a manner ....
Take the following 4 lines of code:
1 DDERequest>Excel,c:\MyDir\url_list-1.csv,R1C1,HoldPage,60
2 StringReplace>HoldPage,.com,,HoldPage
3 ScreenCapture>20,1,599,699,c:\MyDir\standard.jpg
4 MoveFile>c:\MyDir\standard.jpg,c:\MyDir\%HoldPage%.jpg
5 MessageModal>%HoldPage%
In line 1 HoldPage is "packed" with string: yahoo.com from an
Excel .csv file.
In Line 2 the objective is if the string packed in HoldPage contains
a substring of .com it will be replaced or substituted by a "Null string"
thus yahoo.com becomes yahoo
In Line 3 I'm screen capturing http://www.yahoo.com which is fully
loaded up in Internet Explorer browser and saving the
capture to a standard named file: standard.jpg
In Line 4 my objective is to rename the standard file:
standard.jpg to the modified string (from Line 2) concatenated
by: .jpg
Line Line 5 the MessageModal shows HoldFile contains the
string: yahoo
In Line 4 if I don't surround HoldFile with %'s I know I'm
going to realize a standard file renaming of standard.jpg to:
HoldPage.jpg in MyDir so in Line 4 I don't try different
combinations of HoldFile surrounded/not surrounded by
%'s but in Lines 1,2 and 3 I have (e.g.
1 DDERequest>Excel,c:\MyDir\url_list-1.csv,R1C1,%HoldPage%,60)
I hope this defines my problem more succinctly.
Thanks again.
Joel.
Horoscopes2000:
In your example you say that works it seems if
nm is a valid/working string variable:
ScreenCapture>245,61,837,777,d:\wheels01\123qaz.jpg
movefile>d:\wheels01\123qaz.jpg,d:\wheels01\%nm%.jpg
the movefile command should be unnecessary.
Just:
ScreenCapture>245,61,837,777,d:\wheels01\%nm%.jpg
should work.
Joel.
In your example you say that works it seems if
nm is a valid/working string variable:
ScreenCapture>245,61,837,777,d:\wheels01\123qaz.jpg
movefile>d:\wheels01\123qaz.jpg,d:\wheels01\%nm%.jpg
the movefile command should be unnecessary.
Just:
ScreenCapture>245,61,837,777,d:\wheels01\%nm%.jpg
should work.
Joel.
All,
The solution is indeed in this forum at the following URL by Skunkworks.
It seems if you want to read a string from Excel put it through
the "string fix" for CRLF.
FWIW, just an observation, I think the two instances of:
MidStr>%VarName%,1,%LengthOfRecord%,VarName
are redundant. All that needs to be done is put the:
Endif>
after the "LET" and MidStr>%VarName%,1,%LengthOfRecord%,VarName
is by default always implemented. Props and gongrats to Skunkworks.
Joel.
http://www.mjtnet.com/forum/viewtopic.p ... ight=excel
DDERequest>Excel,C:\SomeFile.xls,R1C6,VarName,30
Position>%CRLF%,VarName,1,CRLFFlag
Length>VarName,LengthOfRecord
if>%CRLFFlag%>0
LET>LengthOfRecord=%CRLFFlag%-1
MidStr>%VarName%,1,%LengthOfRecord%,VarName
Else>
MidStr>%VarName%,1,%LengthOfRecord%,VarName
Endif>
The solution is indeed in this forum at the following URL by Skunkworks.
It seems if you want to read a string from Excel put it through
the "string fix" for CRLF.
FWIW, just an observation, I think the two instances of:
MidStr>%VarName%,1,%LengthOfRecord%,VarName
are redundant. All that needs to be done is put the:
Endif>
after the "LET" and MidStr>%VarName%,1,%LengthOfRecord%,VarName
is by default always implemented. Props and gongrats to Skunkworks.
Joel.
http://www.mjtnet.com/forum/viewtopic.p ... ight=excel
DDERequest>Excel,C:\SomeFile.xls,R1C6,VarName,30
Position>%CRLF%,VarName,1,CRLFFlag
Length>VarName,LengthOfRecord
if>%CRLFFlag%>0
LET>LengthOfRecord=%CRLFFlag%-1
MidStr>%VarName%,1,%LengthOfRecord%,VarName
Else>
MidStr>%VarName%,1,%LengthOfRecord%,VarName
Endif>