James
If copying the file is not doing the trick with FSO then it may be because
the FSO (as I understand it) was not designed for Binary Files. What you can
do is create the file and copy / move it with other mechanisms and then use
FSO to rename the file insitu. The command is the fso.movefile - in that
instance it does not actually copy anything but simply renames it.
e.g. fso.movefile("c:\temp\File.pdf","c:\temp\FILE.PDF")
Cleary if the original copy is on the same drive then "move" is more
efficient than the "copy" (assuming you don't want the original file after
the move). Anyway you get the idea.
Cheers
Darren
-----Original Message-----
From: ProfoxTech [mailto:[email protected]] On Behalf Of James
Harvey
Sent: Saturday, 26 October 2013 2:47 AM
To: [email protected]
Subject: RE: How to "FORCE" uppercase filename
I added the parameter, but I still cannot open the pdf.
It's as though the "scripting.filesystemobject" is somehow not creating a
true PDF document?
James E Harvey
M.I.S.
Hanover Shoe Farms, Inc.
www.hanoverpa.com
office: 717-637-8931
cell: 717-887-2565
fax: 717-637-6766
-----Original Message-----
From: ProFox [mailto:[email protected]] On Behalf Of Dave Crozier
Sent: Friday, October 25, 2013 11:20 AM
To: ProFox Email List
Subject: RE: How to "FORCE" uppercase filename
James,
Off the top of my head as I can't find my example at the moment, don't you
need .t. as the last parameter in the copyfile()...
i.e
oFSO.CopyFile(mnamefile,MPATHFILE,.T.)
I think that parameter forces file overwrite but I remember that it needed
to be present from my dark distant past..
Dave
-----Original Message-----
From: ProFox [mailto:[email protected]] On Behalf Of James Harvey
Sent: 25 October 2013 15:40
To: 'ProFox Email List'
Subject: RE: How to "FORCE" uppercase filename
I'm must be going crazy, but I'm 99% sure this process was working
successfully. Today I ran the form and now the resulting PDF's will not
open...
What I'm attempting to do is rename the pdf's and having the new file name's
letters be in uppercase. (there was a suggestion to edit the registry
(DontPrettyPath), but I'm trying to avoid that option).
****************
mnamefile = pdf_loc_path + Alltrim(dam1) + ".PDF"
MPATHFILE = packet_path + tattoo + ".PDF"
If File(mnamefile)
= Strtofile(mnamefile,mnamefile) && Filename on disk
="test_text.txt"
oFSO = Createobject("scripting.filesystemobject")
oFSO.CopyFile(mnamefile,MPATHFILE) && Filename on Disk =
"Test_text.txt"
Endif
************
Now Adobe returns an error message when I try to open the file.:
Adobe Reader could not open '1K8801.PDF' because it is either not a
supported file type or because the file has been damaged (for example, it
was sent as an email attachment and wasn't correctly decoded).
If I go back to the "old" code which uses "copy file", the files copy over,
and can be opened, but they revert back to lower case letters, and we want
the files to be uppercase.
If File(mnamefile)
Copy File (mnamefile) To (MPATHFILE)
Endif
I tried using a different PDF reader but it would not open the files either.
Could the oFSO object be the problem?
James E Harvey
M.I.S.
Hanover Shoe Farms, Inc.
www.hanoverpa.com
office: 717-637-8931
cell: 717-887-2565
fax: 717-637-6766
-----Original Message-----
From: ProFox [mailto:[email protected]] On Behalf Of Darren
Sent: Thursday, August 29, 2013 3:41 PM
To: [email protected]
Subject: RE: How to "FORCE" uppercase filename
James
I believe the FSO is your friend in this case. Give it a try. If not let me
know and I 'll dig through my framework and find another method I used
(Can't recall exactly but involves some API stuff and definitely works)
FSO is easier though - I have confirmed below on my system - I'm running
Windows 7 x64 Ultimate
Cheers
Darren
=STRTOFILE("sometext","c:\temp\test_text.txt") && Filename on disk =
"test_text.txt"
oFSO = CREATEOBJECT("scripting.filesystemobject")
ofso.MoveFile("c:\temp\test_text.txt", "c:\temp\Test_text.txt") && Filename
on Disk = "Test_text.txt"
-----Original Message-----
From: ProfoxTech [mailto:[email protected]] On Behalf Of James
Harvey
Sent: Friday, 30 August 2013 5:23 AM
To: [email protected]
Subject: RE: How to "FORCE" uppercase filename
Darren,
I first run a process that confirms there is a pdf for each record (horse)
in the table, then the code below is run to copy the files from one folder
to another with the new name.
The convention for naming the pdf's is if the horse is a yearling they use
the yearling's dam's name for the pdf, and if it is NOT a yearling they use
the actual name of the horse.
***m_copy_rename
With Thisform.stcntgroup
pdf_loc_path = Alltrim(.sttxtpdfloc.Value)
packet_path = Alltrim(.sttxtpacketpath.Value)
If .Hstxtfhip.Value = " "
mhips = " (hip_no <> ' ' or hip_no = ' ') "
Else
mhips = " (hip_no >= .Hstxtfhip.value and hip_no <=
.Hstxtlhip.value) "
Endif
With .stcmbtype
Do Case
Case Empty(.Value)
Messagebox("You must select a 'Type', please try
again.",16,"Notice")
.SetFocus
Return .F.
Case .Value = "A"
mtype = " (type_horse <> ' ' or type_horse = ' ') "
Case .Value = "B"
mtype = " type_horse = 'B' "
Case .Value = "R"
mtype = " type_horse = 'R' "
Case .Value = "S"
mtype = " type_horse = 'S' "
Case .Value = "W"
mtype = " type_horse = 'W' "
Case .Value = "Y"
mtype = " type_horse = 'Y' "
Case .Value = "M"
mtype = " type_horse <> 'Y' "
Case .Value = "P"
mtype = " type_horse = 'B' or (type_horse = 'R'
and
sex = 'M') "
Otherwise
mtype = " (type_horse <> ' ' or type_horse = ' ') "
Endcase
If .Value <> "Y"
mdamname = " ALLTRIM(NAME) "
Else
mdamname = " ALLTRIM(DAM1) "
Endif
Endwith
If .stcmbgait.Value <> ' '
mgait = " gait = .Stcmbgait.value "
Else
mgait = " (gait <> ' ' or gait = ' ') "
Endif
If .stcmbsex.Value <> ' '
msex = " sex = .Stcmbsex.value "
Else
msex = " (sex <> ' ' or sex = ' ') "
Endif
If .Stcmbsire.Value <> ' '
msire = " sire1 = .Stcmbsire.value "
Else
msire = " (sire1 <> ' ' or sire1 = ' ') "
Endif
If .Stcmbcon.Value <> ' '
MCONS = " cons_no = .Stcmbcon.value "
Else
MCONS = " (cons_no <> ' ' or cons_no = ' ') "
Endif
Select ;
Name, ;
tattoo, ;
sex, ;
gait, ;
sire1, ;
dam1, ;
sire2, ;
cons_no, ;
hip_no, ;
type_horse ;
From ;
(msalefile) ;
Where ;
&mhips ;
And ;
&mtype ;
And ;
&mgait ;
And ;
&msex ;
And ;
&msire ;
And ;
&MCONS ;
Order By hip_no ;
Into Cursor pedtemp
Select pedtemp
*******************************************************************
Scan
mname = &mdamname + ".PDF"
mnamefile = pdf_loc_path + &mdamname + ".PDF"
MPATHFILE = packet_path + "_" + Upper(tattoo) + ".PDF"
If File(mnamefile)
*Copy File UPPER(mnamefile) To (MPATHFILE) *Copy File UPPER(mnamefile) To
(packet_path)+ UPPER(tattoo) + ".PDF"
Copy File Upper(mnamefile) To (packet_path) + tattoo
+ ".PDF"
Endif
ENDSCAN
*******************************************************************
Messagebox("Transfer complete, check the destination folder to
confirm transfer.",0,"Notice")
Endwith
Thisform.Refresh
James E Harvey
M.I.S.
Hanover Shoe Farms, Inc.
www.hanoverpa.com
office: 717-637-8931
cell: 717-887-2565
fax: 717-637-6766
-----Original Message-----
From: ProFox [mailto:[email protected]] On Behalf Of Darren
Sent: Thursday, August 29, 2013 3:05 PM
To: [email protected]
Subject: RE: How to "FORCE" uppercase filename
James - how are you copying and renaming the files?
-----Original Message-----
From: ProfoxTech [mailto:[email protected]] On Behalf Of James
Harvey
Sent: Friday, 30 August 2013 5:01 AM
To: [email protected]
Subject: RE: How to "FORCE" uppercase filename
Looks like the best option to try is the first one, otherwise I'd have to
edit everyone's registry?
James E Harvey
M.I.S.
Hanover Shoe Farms, Inc.
www.hanoverpa.com
office: 717-637-8931
cell: 717-887-2565
fax: 717-637-6766
-----Original Message-----
From: ProFox [mailto:[email protected]] On Behalf Of M Jarvis
Sent: Thursday, August 29, 2013 2:55 PM
To: [email protected]
Subject: Re: How to "FORCE" uppercase filename
On Thu, Aug 29, 2013 at 11:31 AM, James Harvey <[email protected]>
wrote:
> Trying to copy pdf files from one folder to another and in the process
> "rename" the files being copied.
>
I haven't tested it, but does this help?
http://www.techsupportalert.com/content/how-force-your-windows-file-and-fo
ld
er-names-have-case-you-want.htm
--
Matt Jarvis
Eugene, Oregon USA
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.