topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Wednesday December 11, 2024, 5:59 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: FTP Uploader Script  (Read 30343 times)

damax

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 35
    • View Profile
    • Donate to Member
FTP Uploader Script
« on: February 17, 2008, 08:56 AM »
Description:
------------
I wrote a small VBS script which will upload a file to an FTP server and put a
link to it in your windows clipboard. The script is written to be used with
Screenshot Captor but can also be used externally.

You can get it here:
Upload_to_FTP.zip
It is my first contribution to DonationCoder, so please be kind with your criticisms.

I hacked this together because I always missed this functionality in Screenshot
Captor. In this forum there were some discussions going on on how to get this
functionality into SC. The most common solution was to use either FtpUpload.exe
or RCFtp. FtpUpload.exe provided the clipboard functionality but was not able to
upload the file anywhere other than the root directory and RCFtp didn't provide
the clipboard functionality.

So here we have both: possibility of uploading the file to any directory on the
FTP server and a handy link to that file in your windows clipboard afterwards.

Requirements:
-------------
Windows 98/ME/XP/2000/Vista(?)
 with installed Scripting Host
Internet Explorer (for clipboard functionality)

The script was only tested on Windows XP Professional yet.
If you want to try it on another version, please inform me about the results.

Usage with Screenshot Captor:
-----------------------------
1. Copy the script into your Screenshot Captor directory

2. Create a new external tool link in Screenshot Captor:
   2.1. Menu "Tools" -> "Configure external tools" -> "add"
   2.2. Think of a nice title (eg. "Upload to FTP")
   2.3. Insert screenshot_to_ftp.vbs as Program
   2.4. Leave working dir blank (the script uses your windows home directory
        to create a small temp file which is deleted right after execution)
       
   2.5. The parameters for the script are:
   
       ftpserver username password externalpath filename [url]
       
       - FTP-Server: the server where you want to put your screenshot
       - User name: the user name to use for the ftp server
       - Password: the password to use for the ftp server
         (use "" for empty password)
       - External path: the directory on the server to put the file into
         Use a simple slash (/) if you want to upload to the root directory
       - File name: use "%file%" including quotes
       - URL (optional): the URL which is copied to your clipboard.
         Leave URL empty if you don't want to use the clipboard functionality
     
       Example:
       ftp.foobar.org foo bar /foo/bar/ "%file%" http://www.foobar.org/foo/bar/
       
       This will connect to ftp.foobar.org with "foo" as username and "bar" as
       password. It will then change to the directory /foo/bar/ on the server and
       put the selected file there via FTP. The given URL is then completed with
       the filename and will be written to the windows clipboard.
       
       PLEASE NOTE that both external path and URL have to end with a slash (/).
       If you want to put the file to the root directory of the server, use "/"
       (without quotes) as external path.

       Here is how it looks like when you're done:
Bildschuss_080217_15_42_54.png
       
3. You can now select a file in Screenshot Captor and use Tools -> Upload to FTP
   to upload the file. The URL to the file will be ready for use in your windows
   clipboard afterwards.


Usage without screenshot captor:
--------------------------------
If you're into batch programming, you may also use this script from a DOS batch
file. Just call it by

cscript [Drive:\][Path to file]\screenshot_to_ftp.vbs ftpserver username password externalpath filename url

and it will behave just as described above.

Known limitations:
------------------
- Empty password is not possible (any idea on how to realize a variant number of
  parameters)?

 

Found bugs? Added some functionality?
-------------------------------------
Feel free to contact me. I will try to answer every post but please give me some time. I got a life to live, y'know ;)


=======
da]v[ax
=======
« Last Edit: February 19, 2008, 12:05 AM by damax »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: FTP Uploader Script
« Reply #1 on: February 17, 2008, 09:04 AM »
Great work!! :)

And i'm glad there's a superior alternative to ftpupload ;)

About the empty password.. How about if you used "" to mean empty password?

damax

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 35
    • View Profile
    • Donate to Member
Re: FTP Uploader Script
« Reply #2 on: February 17, 2008, 11:38 AM »
You are right! Double quotes for empty password works perfectly  :Thmbsup: Thanx for that!

=======
da]v[ax
=======

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: FTP Uploader Script
« Reply #3 on: August 29, 2008, 12:36 AM »
what a cool script! i couldn't believe i hadn't noticed this before. good job, damax! :Thmbsup:

btw, i used vbstoexe to convert the script into an exe. hope you don't mind.

damax

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 35
    • View Profile
    • Donate to Member
Re: FTP Uploader Script
« Reply #4 on: August 29, 2008, 01:16 AM »
Thank you for the flowers, lanux128. Converting the script to an exe is indeed a very nice idea. Didn't know of vbstoexe yet. I think I will do this on the weekend <- does not work, see below.

=======
da]v[ax
=======
« Last Edit: September 02, 2008, 01:47 AM by damax »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: FTP Uploader Script
« Reply #5 on: August 29, 2008, 01:23 AM »
nice to hear from you damax. :) just wondering if your script is capable of overwriting existing files on the ftp server? this could be useful when uploading updated screenshots.

damax

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 35
    • View Profile
    • Donate to Member
Re: FTP Uploader Script
« Reply #6 on: August 29, 2008, 02:01 AM »
...ermmm.... hm.... never experienced that case before because all my screenshots get timestamped.
The script uses the FTP-command put to upload the file. This here says that put will react with a "Permission denied"-error if the file already exists on the remote server :( I believe it'd be possible to delete the remote file first in that case but I can't be bothered at the moment  ;) Feel free to enhance the script if you like.

=======
da]v[ax
=======
« Last Edit: August 29, 2008, 02:08 AM by damax »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: FTP Uploader Script
« Reply #7 on: August 29, 2008, 02:32 AM »
my screenshots are timestamped too but i sometimes modify them and save with the same filename but it's okay since the 'put' doesn't seem to allow over-writing. your script still gets the job done, though. :)

damax

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 35
    • View Profile
    • Donate to Member
Re: FTP Uploader Script
« Reply #8 on: September 01, 2008, 11:58 AM »
VbsToExe worked for you? The generated .exe doesn't do a thing here on my computer :huh: I used the command "VbsToExe.exe screenshot_to_ftp.vbs screenshot_to_ftp.exe" but when I double-click the *.exe, nothing happens. The same is true if I try to use the *.exe in SC. Just nothing......

=======
da]v[ax
=======

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: FTP Uploader Script
« Reply #9 on: September 01, 2008, 07:50 PM »
now that you mentioned i went and checked. the converted exe doesn't work actually (!) i had been using the script all this while without realizing it. :o

even the website makes a note of it:

NOTICE

The resulted program may not work correct. Some VBScript functions are not available.
You may test it for functionality.
-website

cvbusa

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 33
    • View Profile
    • Donate to Member
Re: FTP Uploader Script
« Reply #10 on: September 14, 2008, 10:23 PM »
Hi ... nice script programming.

Rightload (mentioned on this forum previously) is what I use. It allows uploading to ftp servers ( to a fixed or custom directory ) by right clicking on any image thumbnail listed in the SC file directory left-hand panel and copies the URL link to the clipboard.

Later ... Charles

Rightload Home - http://rightload.org/

Snapshot - http://screencast.com/t/napMvRprx

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: FTP Uploader Script
« Reply #11 on: September 14, 2008, 10:34 PM »
yes, Rightload is quite an able tool but i wonder if this feature has been implemented, copy uploaded path to clipboard? this is essential for me, hence the usage of damax's script. :)

cvbusa

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 33
    • View Profile
    • Donate to Member
Re: FTP Uploader Script
« Reply #12 on: September 15, 2008, 12:18 AM »
Yes ... Rightload does copy the upload path ( URL ) to the clipboard after the upload is complete. The other nice feature is that Rightload can be configured for multiple FTP sites. Just right click a thumbnail in the SC browser panel, select one of the destination FTP sites that you have configured and you are good to go!!!

Charles

damax

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 35
    • View Profile
    • Donate to Member
Re: FTP Uploader Script
« Reply #13 on: September 15, 2008, 01:11 AM »
G'damn it. I hoped I had written something that was not implemented before :( well well, you can't have it all, right?

=======
da]v[ax
=======

cvbusa

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 33
    • View Profile
    • Donate to Member
Re: FTP Uploader Script
« Reply #14 on: September 15, 2008, 01:22 AM »
A nice piece of programming is never a waste of time if you enjoyed the experience and learned something ... Charles.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: FTP Uploader Script
« Reply #15 on: September 15, 2008, 01:27 AM »
exactly both damax's script and rightload has proved to be very useful. :Thmbsup:

cvbusa

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 33
    • View Profile
    • Donate to Member
Re: FTP Uploader Script
« Reply #16 on: September 15, 2008, 12:46 PM »
I should mention that Rightload can upload multiple files at once to an FTP site and provides the user graceful options for handling duplicate files.

1) Control click multiple thumbnails from the Screenshot Captor ( SC ) image/file browser panel
2) Right click the selection
3) Use the "Upload with Rightload" option to select the FTP destination site ( or queue )

Screencast (no audio )of multi-file selection in SC and sending
the selection to the queue before making an FTP destination selection
- http://screencast.com/t/SQW62GT6G

Later ... Charles

Rightload site - http://rightload.org/

PS In this multi-file upload scenario, Rightload copies multiple upload paths ( URLs ) to the clipboard.

Screencast ( no audio ) of multi-file copy, handling duplicate files and
clipboard pasting of multiple upload paths
- http://screencast.com/t/tYJ8PTTKQ

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: FTP Uploader Script
« Reply #17 on: September 15, 2008, 12:52 PM »
That's great cvbusa  :up:
Can i add a link to that screencast from SC page and from SC help file?

cvbusa

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 33
    • View Profile
    • Donate to Member
Re: FTP Uploader Script
« Reply #18 on: September 15, 2008, 07:28 PM »
Hi mouser ... you are welcome to use the screencast as you see fit.

Below is a link to a "better" screencast that demonstrates the entire process. You are welcome to download this Flash .swf file to your local server ( just in case my hosting service changes in the future ).

Later ... Charles

Screencast ( no audio ) of using Rightload with Screenshot Captor :

- http://www.charlesbr...-2008-09-15_1716.swf


mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: FTP Uploader Script
« Reply #19 on: September 15, 2008, 08:12 PM »
Great, thanks  :up:

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: FTP Uploader Script
« Reply #20 on: September 15, 2008, 08:12 PM »
By the way everyone, rightload is donationware -- if you use it and like it, consider sending them a little donation as a way of saying thanks.  :up:

nafs

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 16
    • View Profile
    • Donate to Member
Re: FTP Uploader Script
« Reply #21 on: March 09, 2009, 06:53 AM »
I just found out that Rightload also supports the command line, which makes it even greater. Click here for instructions.