AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Send to FTP, Copy URL to clipboard

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
icefreez



Joined: 15 May 2007
Posts: 39

PostPosted: Wed Jan 09, 2008 8:31 pm    Post subject: Send to FTP, Copy URL to clipboard Reply with quote

Ok this is my proposed task. It is something that I am sure would simplify the life of a anyone who owns a server Smile

Task: Upload files from local computer to FTP server. Compute URL of newly uploaded files to clipboard.

Right now I can right click a file, select "Send To" and put the files on my FTP server. I still have to manually create the path to them though. (I know not alot of work, but I want to automate it)

I was thinking of integrating with an existing FTP client. Or maybe using the Command Prompt shell to automate the process. (don't know much about importing file names into a bat file). I am open to possible solutions.


Two free FTP programs that allow a Send to FTP option are:
WinSCP
Send to FTP

I also came across this post as well which describes FTPZillla, now called FireZilla as being able to do this. I installed FireZilla but was unable to find such an option.
Back to top
View user's profile Send private message
ManaUser



Joined: 24 May 2007
Posts: 906

PostPosted: Wed Jan 09, 2008 9:24 pm    Post subject: Reply with quote

Can the URL be reliably determined from the original file names? For instance if you upload MyFile.html can you count on the URL being http://xyz.com/~blah/blah/MyFile.html? If so then wouldn't it be easier to figure out the URL from the filenames rather than trying to extract them from the FTP client?
Back to top
View user's profile Send private message
icefreez



Joined: 15 May 2007
Posts: 39

PostPosted: Wed Jan 09, 2008 9:33 pm    Post subject: Reply with quote

Ohh no I fully agree. I would not want to determine the file names from the FTP client. I just want two parts.

Upload selected files to FTP
Get Clipboard filled with valid URLs to new files.

I don't care how this is achieved. In my particular case it would always be the same directory they are saved in.

So say I upload two files. I won't know what they are called but lets say they are named a.txt and b.txt. I know I am going to always upload to www.autohotkey.com/files/ lets say. So if i can just figure out what files are selected and sent to the ftp client to upload into the /files/ directory I can just assume that I need to copy
http://www.autohotkey.com/files/a.txt
http://www.autohotkey.com/files/b.txt
to the clipboard.

Nothing smooth and fancy I am just looking for a rough hacked together way to get that done.
Back to top
View user's profile Send private message
icefreez



Joined: 15 May 2007
Posts: 39

PostPosted: Wed Jan 09, 2008 9:50 pm    Post subject: Reply with quote

I was able to figure it out somewhat using WinSCP's command line commands. http://winscp.net/eng/docs/commandline

Code:
count = 0

Loop, %0%  ; For each parameter:
{
    param := %A_Index%  ; Fetch the contents of the variable whose name is contained in A_Index.
   list = %list% %param%
   storeclip = %storeclip%`rhttp://www.autohotkey.com/David/%param%
   count++
   
}

clipboard = %storeclip%
run, `"C:\Program Files\WinSCP\WinSCP.exe`" /upload %list%



I am having two problems still. When storing to the clipboard I want to store a new line to the clipboard but `n or `r don't seem to work. Also I need to strip off the local path so its just the file name.

You place this in your documents and settings in the SendTo folder. EX C:\Documents and Settings\david\SendTo\ Of course you update the path to WinSCP if its different.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group