Author Topic: Retrieving the FTP path from a buffer  (Read 7180 times)

tme

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
Retrieving the FTP path from a buffer
« on: December 19, 2006, 04:59:24 PM »
Hi, I'm trying to pass some file names and paths back and forth between SlickEdit Macros and some Perl Scripts. 

I've had no problems getting it working with local files, but I want to be able to access the remote file names with my slickedit macros, not the local spot where the buffer is stored. 

For example, I open a file through the FTP sidebar and it's path on the filetab looks exactly like what I want (VAX directory structure):

[Path.To.Files]<file_name>


but if I use the strip_filename function it returns where the buffer is stored, which looks something like:

C:\Documents and Settings\<user>\My Documents\My SlickEdit Config\11.0.1\ftp\<server_name>\Path\To\Files\On\Server\<file_name>

I've tried looking through the Macro Guide, but I can't find anything in there about retrieving the FTP filename.  Does anyone know how I can retrieve the ftp file name instead of the buffer local file name? Any help would be appreciated, thanks.

Rodney

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 798
  • Hero Points: 54
Re: Retrieving the FTP path from a buffer
« Reply #1 on: December 21, 2006, 10:53:34 PM »
You can retrieve the displayed ftp://... name from the p_DocumentName property in Slick-C:

#include "slick.sh"
#include "ftp.sh"
...
   _str docName = p_DocumentName;
   _str host, port, path;
   _ftpParseAddress(docName,host,port,path);
   // If you are using the FTP open tab (docked on left by default),
   // then you could retrieve a pointer to current connection profile
   // and use it instead of hardcoding the system type. This assumes
   // that the current active connection profile is VMS. Like so:
   // ftpConnProfile_t* pfcp = ftpopenGetCurrentConnProfile();
   ftpConnProfile_t fcp;
   fcp.System = FTPOS_VMS;
   // namePart holds <filename>
   _str namePart = _ftpStripFilename(&fcp,path,'P');
   // pathPart holds '[Path.To.Files]'
   _str pathPart = _ftpStripFilename(&fcp,path,'N');

--rodney

tme

  • Junior Community Member
  • Posts: 2
  • Hero Points: 0
Re: Retrieving the FTP path from a buffer
« Reply #2 on: December 22, 2006, 04:35:37 PM »
Thanks, that's perfect.  I'm really starting to like this editor.