View Full Version : Script to upload screenshot to ftp with Greenshot
mitch
09-22-2015, 10:34 PM
Hello,
Here is a link to what i need to achieve with Flashfxp as the mediator.
In the following example its done with WinSCP but of course we are users of flashfxp so i want to achieve something similar if possible ?
How to Upload Screenshots to a Web Server via FTP, SCP or SFTP | Greenshot (http://getgreenshot.org/2013/11/07/how-to-upload-screenshots-to-a-web-server-via-ftp-scp-or-sftp/)
Can it be done, anyone give some clear instructions on how to acheive this... will transfer $5 to a nominated paypal for your time. Cheers.
MxxCon
09-23-2015, 08:50 AM
Have you looked at FlashFXP's help file, command line section?
bigstar
09-23-2015, 07:36 PM
Command:
<path\to\>flashfxp.exe
Argument:
/tray /overwrite /upload <server name> /localpath="{0}" /remotepath="<path\to\target>file.png" /quit
replace <server name> with the name of the server, if the server is within a group then include the group name such as \group 1\group 2\site name
replace <path\to\target>file.png with the desired target location for the uploaded screenshot
The above command will start FlashFXP minimized to the tray, (overwrite the file if it already exists) upload the file, and then quit.
mitch
09-24-2015, 08:14 AM
Command:
<path\to\>flashfxp.exe
Argument:
/tray /overwrite /upload <server name> /localpath="{0}" /remotepath="<path\to\target>file.png" /quit
replace <server name> with the name of the server, if the server is within a group then include the group name such as \group 1\group 2\site name
replace <path\to\target>file.png with the desired target location for the uploaded screenshot
The above command will start FlashFXP minimized to the tray, (overwrite the file if it already exists) upload the file, and then quit.
Hello, i sort of got this working, however if my site name has credentials for the ftp, does <site name> inherit the user and pass and i dont need to pass it across in the command line ?
bigstar
09-24-2015, 09:24 AM
Yes, <server name> is the name of the server within the FlashFXP Site Manager.
mitch
09-24-2015, 06:30 PM
Yes, <server name> is the name of the server within the FlashFXP Site Manager.
This is the argument i have.
/tray /overwrite /upload menkom /localpath="{0}" /remotepath="" /quit
i get an error message in flashfxp when it starts with the following.
It seems when i use the sitename as specified in the sitename field of the site manager it gives an error. But if i use something like ftp.menkom.com.au it attempts to connect but says i need to authenticate.... ???
http://i.imgur.com/SGdWgK0.jpg
bigstar
09-24-2015, 09:17 PM
/tray /overwrite /upload menkom /localpath="{0}" /remotepath="" /quitThat's not going to work, you need to set the /remotepath to the target path\filename
mitch
09-24-2015, 09:28 PM
Ok still got issues.. this is everything i have and the errors... i just want to upload to the the public_html folder.
http://i.imgur.com/0N8D6vW.jpg
http://i.imgur.com/tmWYn16.jpg
Argument: /tray /overwrite /upload menkom /localpath="{0}" /remotepath="\test.png" /quit
bigstar
09-25-2015, 10:01 AM
Ok do this..
Open the Site Manager and select menkom in the Site List and then press Ctrl + \
Now open Notepad or something similar and paste the clipboard, this will paste the exact <site name> that you need, if menkom is in a group then it will add the group names as needed.
For example if menkom is added directly below FlashFXP Sites and not in any group it would paste as \menkom
(Since this is just the site name without any groups the leading slash is optional, if you're wondering why my original example did not include it)
/tray /overwrite /upload \menkom /localpath="{0}" /remotepath="/public_html/" /quit
If the site menkom is in a group named "websites" then it would paste as \websites\menkom
/tray /overwrite /upload \websites\menkom /localpath="{0}" /remotepath="/public_html/" /quit
The remote path needs to be the actual path where you want the file to upload, In my original example I gave it a filename but if you want the screenshots to retain their original file name then you omit the name and just define the folder; You must make sure you include the trailing slash if you do this.
Since I don't know the structure of your server I want you to do this, connect to menkom and navigate to the public_html folder, now copy the path from the path box. It might simply be /public_html/ or it could be /home/<user>/public_html/
So now with the correct remote path obtained use it in your Argument.
/tray /overwrite /upload \menkom /localpath="{0}" /remotepath="/public_html/" /quit
mitch
09-25-2015, 09:12 PM
Ok do this..
Open the Site Manager and select menkom in the Site List and then press Ctrl + \
Now open Notepad or something similar and paste the clipboard, this will paste the exact <site name> that you need, if menkom is in a group then it will add the group names as needed.
For example if menkom is added directly below FlashFXP Sites and not in any group it would paste as \menkom
(Since this is just the site name without any groups the leading slash is optional, if you're wondering why my original example did not include it)
/tray /overwrite /upload \menkom /localpath="{0}" /remotepath="/public_html/" /quit
If the site menkom is in a group named "websites" then it would paste as \websites\menkom
/tray /overwrite /upload \websites\menkom /localpath="{0}" /remotepath="/public_html/" /quit
The remote path needs to be the actual path where you want the file to upload, In my original example I gave it a filename but if you want the screenshots to retain their original file name then you omit the name and just define the folder; You must make sure you include the trailing slash if you do this.
Since I don't know the structure of your server I want you to do this, connect to menkom and navigate to the public_html folder, now copy the path from the path box. It might simply be /public_html/ or it could be /home/<user>/public_html/
So now with the correct remote path obtained use it in your Argument.
/tray /overwrite /upload \menkom /localpath="{0}" /remotepath="/public_html/" /quit
Yessss, works it was mainly due to the fact my site was in a group, thanks so much for being patient, its the first time ive had to actually use support and ive been a supporter for many years now.
Only thing left for me to figure out is why its not copying the url to the clipboard, it should be.... cheers.... might be something with the program itself.
Edit, just on the off chance i read this post saying that anything that happens after the image is passed over to the external program is the functionality that is allowed, so i guess my final question would be... if the file is uploaded is there a way to copy the URL into clipboard of the location of that file ? This is something i read
How to use the External Command Plugin to send screenshots to other applications | Greenshot (http://getgreenshot.org/2013/01/28/how-to-use-the-external-command-plugin-to-send-screenshots-to-other-applications/)
bigstarX
09-25-2015, 09:26 PM
Yessss, works it was mainly due to the fact my site was in a group, thanks so much for being patient, its the first time ive had to actually use support and ive been a supporter for many years now.
Only thing left for me to figure out is why its not copying the url to the clipboard, it should be.... cheers.... might be something with the program itself.
You're welcome.
I am fairly sure that the winscp script you linked did not copy the URL to the clipboard.
Right now I don't think there is a way to do this in FlashFXP since it would require a specialty function to make this work. I will look into this on Monday.
Sent from my SAMSUNG-SM-G920A using Tapatalk
mitch
09-25-2015, 09:49 PM
You're welcome.
I am fairly sure that the winscp script you linked did not copy the URL to the clipboard.
Right now I don't think there is a way to do this in FlashFXP since it would require a specialty function to make this work. I will look into this on Monday.
Sent from my SAMSUNG-SM-G920A using Tapatalk
No worries, thanks for your help let me know how you go.
bigstar
09-26-2015, 02:25 PM
Okay try this..
Download and install this development build of FlashFXP
FlashFXP52_3877_Setup.exe (https://oss.azurewebsites.net/testr/dev-builds/FlashFXP52_3877_Setup.exe)
Then add this to the Argument
/gs=cb
This will copy the upload as a http url, now for this to work you need to have the Copy to clipboard > HTTP feature configured for the site.
Site Manager > Select the site profile > Options tab
Copy URL - Mapping
HTTP URL:
Enter the http url such as https://oss.azurewebsites.net/
Server Web Root Path:
This is the path part that needs to be removed to make the HTTP Url valid.
Such as /home/user/public_html/
mitch
09-27-2015, 06:04 PM
Okay try this..
Download and install this development build of FlashFXP
FlashFXP52_3877_Setup.exe (https://oss.azurewebsites.net/testr/dev-builds/FlashFXP52_3877_Setup.exe)
Then add this to the Argument
/gs=cb
This will copy the upload as a http url, now for this to work you need to have the Copy to clipboard > HTTP feature configured for the site.
Site Manager > Select the site profile > Options tab
Copy URL - Mapping
HTTP URL:
Enter the http url such as FlashFXP - Secure FTP Client Software for Windows. Upload, Download, and Synchronize your files. (https://oss.azurewebsites.net/)
Server Web Root Path:
This is the path part that needs to be removed to make the HTTP Url valid.
Such as /home/user/public_html/
Hey bigstar, im using the portable version can i install this version ? from the site download for same functionality ?
5.2.0 build 3878
mitch
09-27-2015, 06:33 PM
Hey bigstar, im using the portable version can i install this version ? from the site download for same functionality ?
5.2.0 build 3878
Ok, i tried it in the latest build and i do see the option so i tried it, works but without one small problem... once this is done its a proper working solution.
When i use the argument with the following
/tray /overwrite /upload \Menkom Server\menkom.com.au /localpath="{0}" /remotepath="/public_html/" /gs=cb /quit
I successfully copies the screenshot to the public_html directory, but the url that is copied into clipboard is
Page not found - Menkom Web Design & IT Support Services (http://www.menkom.com.au/public_html/2015_09_28_09_27_30_Films_TV.jpg)
Of course this is not valid because the internet browser does not interpret the public_html directory so it comes as a 404, if i could strip the public_html part then i guess it would work fine.
Even though your command line is stripping the webroot, it still seems to carry it across via the argument of the remote destination.
Did i miss something ?
bigstar
09-27-2015, 06:43 PM
Did i miss something ? It sounds like the webroot isn't properly setup in the Site Manager for the site, if it was then /public_html/ would be stripped, are you 100% sure that /public_html/ is the correct?
Connect to the server and see if the file uploaded into the correct location, if not you may need to change the remotepath and the webroot
The url will be copied to the clipboard on success and even on a failure, if it failed to upload you'll still end up with the url on the clipboard.
mitch
09-27-2015, 11:17 PM
It sounds like the webroot isn't properly setup in the Site Manager for the site, if it was then /public_html/ would be stripped, are you 100% sure that /public_html/ is the correct?
Connect to the server and see if the file uploaded into the correct location, if not you may need to change the remotepath and the webroot
The url will be copied to the clipboard on success and even on a failure, if it failed to upload you'll still end up with the url on the clipboard.
100%
Copy URL mapping says the following (screenshot program not working at the moment)
HTTP URL:: Web Design & IT Support for Small Businesses in Sydney (http://www.menkom.com.au/)
Server Web Root Path: /home/menkomco/public_html/
Screenshot working again... see the following as confirmation of the path when i access the path via ftp:
http://i.imgur.com/1pGEHZW.jpg
Arguments:
/tray /overwrite /upload \Menkom Server\menkom.com.au /localpath="{0}" /remotepath="/public_html/" /gs=cb /quit
I think it has something to do with the remotepath overriding the settings.
bigstar
09-28-2015, 07:55 AM
Try this, change /remotepath="/public_html/" to /remotepath="/home/menkomco/public_html/"
mitch
09-28-2015, 09:05 AM
Try this, change /remotepath="/public_html/" to /remotepath="/home/menkomco/public_html/"
No that didnt work, see screenshot... not a valid path
http://i.imgur.com/pYYs4bi.jpg
The reason that the /home/menkomco/public_html wont work is because the login credentials are user level not root level, if i was loging in as root then that might work.
As suspected it did work when i used the root login details, which i really dont want to do if possible as im not sure what is transmitted.
However, with root the full home directory path works with the above settings. Here is the end result of the file uploaded.
http://www.menkom.com.au/2015_09_29_08_50_23_Films_TV.jpg
Hopefully we can get it to work at a user level :)
bigstar
09-29-2015, 05:45 AM
I just created a new site entry to test and verify that this is working as expected and with my new entry here's what I got
https://opensightsoftware.com/2015_09_29_05_22_43.png
And in Greenshot I am using this
Command:
C:\Program Files (x86)\FlashFXP 5\FlashFXP.exe
Argument:
/quit /tray /overwrite /upload "\test server" /localpath="{1}" /remotepath="/public_html/" /gs=cb
The screenshot in my post was taken with this configuration.
The only other thing I can think of is maybe you need to quote the site name like I did above when using "\test server" since it contains a space. "\Menkom Server\menkom.com.au"
You could omit the /quit and check the server session log window to see whats going on.
mitch
09-29-2015, 09:13 AM
I just created a new site entry to test and verify that this is working as expected and with my new entry here's what I got
https://opensightsoftware.com/2015_09_29_05_22_43.png
And in Greenshot I am using this
Command:
C:\Program Files (x86)\FlashFXP 5\FlashFXP.exe
Argument:
/quit /tray /overwrite /upload "\test server" /localpath="{1}" /remotepath="/public_html/" /gs=cb
The screenshot in my post was taken with this configuration.
The only other thing I can think of is maybe you need to quote the site name like I did above when using "\test server" since it contains a space. "\Menkom Server\menkom.com.au"
You could omit the /quit and check the server session log window to see whats going on.
Workssssssssssssssssssss.
Was probably the "" around the server name..... so it could've been that.
You have been a great help i will notify Greenshot author of your instructions to get Greenshot to work with Flashfxp and hopefully the do a blogpost out of it like they did for Winscp as i think it will benefit other users. :)
vBulletin® v3.8.11 Alpha 3, Copyright ©2000-2024, vBulletin Solutions, Inc.