Bru Posted February 28, 2009 Share Posted February 28, 2009 I am having troubles with my URL Manager. So here is my code. expandcollapse popup#include <GUIConstants.au3> #include <GUIListBox.au3> #include <SQLite.au3> _SQLite_Startup() $Form1 = GUICreate("oURL Manager", 323, 338, 272, 188) $ListURL = GUICtrlCreateList("", 8, 8, 305, 253) $SelectedURL = GUICtrlCreateInput("", 8, 272, 305, 21) $AddURL = GUICtrlCreateButton("Add", 8, 304, 97, 25, 0) $DeleteURL = GUICtrlCreateButton("Delete", 112, 304, 97, 25, 0) $ConnectURL = GUICtrlCreateButton("Connect", 216, 304, 97, 25, 0) GUISetState(@SW_SHOW) Global $hQuery, $aRow _SQLite_Open() _SQLite_Exec(0, "CREATE TABLE urls (url);") _RefreshList() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $AddURL _AddURL() Case $DeleteURL _DeleteURL() Case $ConnectURL _ConnectURL() Case $ListURL $state = _GUICtrlListBox_GetCurSel($ListURL) $url = GUICtrlRead($ListURL, $state) GUICtrlSetData($SelectedURL, $url) EndSwitch WEnd Func _AddURL() If GUICtrlRead($SelectedURL) = "" Then MsgBox(0, "Error..", "Please enter a URL to add.", 5) Else _GUICtrlListBox_AddString($ListURL, GUICtrlRead($SelectedURL)) _SQLite_Exec(-1, "INSERT INTO urls (url) VALUES ('" & GUICtrlRead($SelectedURL) & "');") GUICtrlSetData($SelectedURL, "") EndIf EndFunc Func _DeleteURL() $state = _GUICtrlListBox_GetCurSel($ListURL) If $state <> -1 Then _GUICtrlListbox_DeleteString($ListURL, $state) Else MsgBox(0, "Error..", "Please select a URL to delete.", 5) Endif EndFunc Func _ConnectURL() $state = _GUICtrlListBox_GetCurSel($ListURL) If $state <> -1 Then $url = GUICtrlRead($ListURL, $state) ShellExecute($url) Else MsgBox(0, "Error..", "Please select a URL to connect.", 5) EndIf EndFunc Func _RefreshList() _SQLite_Exec(-1, "SELECT url FROM urls;", $hQuery) While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK _GUICtrlListBox_AddString($ListURL, $aRow[0]) WEnd EndFunc _SQLite_Close() _SQLite_Shutdown() I just need the SQLite to work. Also help deleting an entry / url from the db. Thanks in advance. [right][/right] Link to comment Share on other sites More sharing options...
Zedna Posted March 13, 2009 Share Posted March 13, 2009 AutoIt helpfile and forum is full of SQLite examples. Just search for them ... Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now