Storing ini data online. Options?

Get help with using AutoHotkey and its commands and hotkeys
homeskool
Posts: 16
Joined: 03 Jan 2017, 21:25

Storing ini data online. Options?

16 Dec 2019, 13:49

I would love to be able to store data online.
I used to upload text/ini file via FTP scripts that have existed for awhile.
But I find those scripts do not work anymore for various reasons.
All of them have been command line based with the built in windows FTP program which seems to have some type of error now.

My new searches for a simple solution have not yet yielded positive results for FTP upload. Which I think I may prefer for simple reasons?
Or maybe there is a much more modern solution? But my skills / time are limited so I am hoping for a simple solution like FTP.

Thank you for your time!
FanaticGuru
Posts: 1406
Joined: 30 Sep 2013, 22:25

Re: Storing ini data online. Options?

16 Dec 2019, 14:59

homeskool wrote:
16 Dec 2019, 13:49
I used to upload text/ini file via FTP scripts that have existed for awhile.
But I find those scripts do not work anymore for various reasons.
All of them have been command line based with the built in windows FTP program which seems to have some type of error now.

My new searches for a simple solution have not yet yielded positive results for FTP upload. Which I think I may prefer for simple reasons?
Or maybe there is a much more modern solution? But my skills / time are limited so I am hoping for a simple solution like FTP.

Here is a link to the AutoHotkey FTP class that works for me.

https://github.com/jNizM/AHK_Scripts/blob/master/src/ftp/Class_FTP.ahk

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
User avatar
TheDewd
Posts: 1391
Joined: 19 Dec 2013, 11:16
Location: USA

Re: Storing ini data online. Options?

16 Dec 2019, 15:05

There's an application which allows you to use Google Drive as an FTP. You could use this also... https://github.com/andresoviedo/google-drive-ftp-adapter
Image Bulldozer - Sokoban inspired game from 1994 recreated in AutoHotkey.
homeskool
Posts: 16
Joined: 03 Jan 2017, 21:25

Re: Storing ini data online. Options?

16 Dec 2019, 16:05

Thank you both.
FanaticGuru - I'm having trouble making sense of the code but if that is the modern solution I will dive in to learn how it works. Thank you very much for the link. I appreciate it!
FanaticGuru
Posts: 1406
Joined: 30 Sep 2013, 22:25

Re: Storing ini data online. Options?

16 Dec 2019, 17:37

homeskool wrote:
16 Dec 2019, 16:05
FanaticGuru - I'm having trouble making sense of the code but if that is the modern solution I will dive in to learn how it works.

Here is an example of FTP in use:

Code: Select all

; Get Files Dropped on Script
if (%0%)
	Loop %0%  ; For each parameter (or file dropped onto a script):
		Files .= "`n" %A_Index%

#include <FTP>

ServerID := "YourIDhere"
ServerPW := "YourPWhere"
ServerURL := "www.YourServerHere.com"
ServerDirectory := "your/directory/here"

if !Files
	FileSelectFile, Files, M3  ; M3 = Multiselect existing files.

if Files
{
	hInternet := FTP.InternetOpen("Upload Link")
	hConnect  := FTP.InternetConnect(hInternet, ServerURL, ServerID, ServerPW)
	FTP.FtpSetCurrentDirectory(hConnect, ServerDirectory)
	Loop, parse, Files, `n
	{
		if (A_Index = 1)
			FileFolder := A_LoopField
		else
		{
			SplitPath, A_LoopField, FileName
			if FileFolder
				FTP.FtpPutFile(hConnect, FileFolder "\" A_LoopField, FileName)
			else
				FTP.FtpPutFile(hConnect, A_LoopField, FileName)
		}
	}
	FTP.InternetCloseHandle(hConnect)
	FTP.InternetCloseHandle(hInternet)
}

This will allow you to drag files on to the script icon and have them uploaded.

You will need to put in all your credentials information in the script for it to work. Putting credentials within a script can be risky. I encrypt them within my scripts. Here is a link to a topic on that: https://www.autohotkey.com/boards/viewtopic.php?p=268667#p268667

You will need to compile the script in order to drop files without 8-dot-3 (short) names to work. That has nothing to do with the FTP but how drag and drop works.

It is also worth noting that if Dropbox is installed on each computer, that can be used which is as easy as coping a file to a folder and Dropbox handles all the syncing. You can also use the Dropbox API directly but that is rather complicated again because of all the credentials but is an option if you do not want to actually install Dropbox on each computer and don't have access to a free FTP site.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts

AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon

[Function] Timer - Create and Manage Timers
homeskool
Posts: 16
Joined: 03 Jan 2017, 21:25

Re: Storing ini data online. Options?

27 Apr 2020, 22:08

I am sorry that I didn't notice you had posted a reply to my question until now. Thank you very much FanaticGuru!
I will start messing with your script right away. :)

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], JackMa and 283 guests