http://blogs.msdn.com/b/ericlippert/archive/2005/04/20/binary-files-and-the-
file-system-object-do-not-mix.aspx


-----Original Message-----
From: ProfoxTech [mailto:[email protected]] On Behalf Of James
Harvey
Sent: Saturday, 26 October 2013 1:40 AM
To: [email protected]
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.

Reply via email to