Not sure about Blat but for shortfilename this works for me in Windows 7.

DECLARE INTEGER GetShortPathName IN kernel32;
        STRING lcLongPath, STRING @lcShortPath,;
        INTEGER nBuffer

lcName = GETFILE()
        
lcBuffer = Replicate(CHR(0), 512)
lnResult = GetShortPathName(lcName, @lcBuffer, 512)  && Len(lcBuffer)

CLEAR DLLS GetShortName

WAIT LEFT(m.lcBuffer, m.lnResult) WINDOW

-----Original Message-----
From: ProfoxTech [mailto:[email protected]] On Behalf Of Frank
Cazabon
Sent: Sunday, 26 January 2014 11:11 AM
To: [email protected]
Subject: GetShortPathName Doesn't

Hi,

I've recently started using Blat and have a problem with the path of an
attachment I am trying to send.  I'd appreciate any ideas as to what I'm not
seeing.

The file name is stored in taFiles[1] like this:

taFiles[1] = "D:\Documents\Football IQ Academy\Receipts\1025-Alain
Briggs.Pdf"

Which is a file that has just been created by my code.

Blat seems to choke on it.

The code that builds up the -attach parameter is this:

   IF TYPE("taFiles", 1) = "A"
     lcBlatParam = lcBlatParam + " -attach "
    FOR lnCountAttachments = 1 TO ALEN(taFiles)
      lcBlatParam = lcBlatParam +
GetShortPath(ALLTRIM(taFiles(lnCountAttachments))) + ","
    ENDFOR
    lcBlatParam = LEFT(lcBlatParam, LEN(lcBlatParam) - 1) && Remove Extra
Comma
   ENDIF

in debugging the code, GetShortPath returns the exact same string for the
file.  This then breaks blat because it can't handle the spaces in the file
path and name.

This is GetShortPath

****************************************
Function GetShortPath
****************************************
  LPARAMETERS lcFileName
  LOCAL lnReturn, lcBuffer

  Declare Integer GetShortPathNameA In Win32API As GetShortPathName String,
String, Integer

  lcBuffer = SPACE(255)
  lnReturn= GetShortPathName(lcFileName, @lcBuffer, 255)

  Clear Dlls "GetShortPathName"

  Return (Left(lcBuffer, lnReturn))
ENDFUNC

-- 

Frank.

Frank Cazabon


[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