Jump to content

Help with 3 line file read and insert to mysql

Recommended Posts



First off, i'm a fairly new AutoIT User and so far i have found everything i need on this Forum.

Secondly i seem to have cornered myself into a tough spot. I have made myself a little automated backup app that works well so far.
But now that i have added a licensing feature in connection with obsidium, i would like to add issued licenses to a mysql database to keep track of them.
I have already created a Web Licensing Feature using the Obsidium SDK and an App that uses this and creates a License File (License.lic) containing 3 Lines which look like this:


Customer Name
SystemID (Alphanumeric)


The Code for the LicenseFetching Tool, which works well, looks like this:

#include <GUIConstants.au3>

GUICreate("MyApp Licensing Tool", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45)
$info1 = GUICtrlCreateInput("CustomerName", 10, 5, 300, 20)
$systemid = GUICtrlCreateInput("SystemID", 10, 35, 300, 20)
$btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20)
$project = "SomeFileNameHere"
$type = "aSettingComesHere"
$legacy = "aSettingComesHere"
$advanced = "aSettingComesHere"


$msg = 0
While $msg <> $GUI_EVENT_CLOSE
    $msg = GUIGetMsg()
        Case $msg = $Btn
            ;MsgBox(262144, '', ' 1 : ' & GUICtrlRead($info1) & ' 2: ' & GUICtrlRead($systemid))
            $sStr = BinaryToString(InetRead("https://some.URL.here/web-cgi/something.cgi?info1="&GUICtrlRead($info1)&"&systemid="&GUICtrlRead($systemid)&"&project="&$project&"&type="&$type&"&legacy="&$legacy&"&advanced="&$advanced, 1))
            FileWrite(@ScriptDir &"\License.lic", $sStr)

This is where i would somehow like to add a Check to see if Customer already exists, as well as enter the Issued License to the Database.

So my current Questions are:
1. How would i read these 3 Lines and enter them to a MySQL Database?
2. Which would be the best way to set up the Tables in MySQL to use these 3 Lines

Any Tips and/or ideas are more than welcome

Share this post

Link to post
Share on other sites

For the file read line part, you could either  FileReadLine  or user the UDF _FIleReadToArray.

If you wants to insert into the MySql database, you need to connect to it first, there is some UDF's that can help you with that.

For the Mysql part I can't help newer worked with that, only Sqlite.



Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now