请教哈 该如何运行从数据库中读出的代码?【已解决】
本帖最后由 qsy666888 于 2020-6-5 23:02 编辑保存在数据库中的代码现在点击后只能读取我想点击后运行这段代码 该如何写呢? 亲爱的大佬们
<font color="deepskyblue">#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
#Include <GuiListView.au3>
$SQLite_Data_Path = "MySQLite.db"
$Table = "textTable"
_SQLite_Startup ()
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 542, 267, 339, 297)
$ListView1 = GUICtrlCreateListView("id|text1|", 8, 8, 522, 246)
_GUICtrlListView_SetColumn($ListView1, 1, "text1", 300, -1)
tuqushuju()
GUIRegisterMsg($WM_NOTIFY, 'WM_NOTIFY')
GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
#EndRegion ### END Koda GUI section ###
Func tuqushuju()
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView1))
Local $aRow, $hQuery,$i = 0
_SQLite_Open ($SQLite_Data_Path)
If _SQLite_Query(-1, "SELECT * FROM " & $Table & ";", $hQuery) = $SQLITE_OK Then
While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK
_GUICtrlListView_AddItem($ListView1, $aRow, 0)
_GUICtrlListView_AddSubItem($ListView1, $i, BinaryToString($aRow), 1)
$i+=1
WEnd
_SQLite_Close()
EndIf
EndFunc
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
Local $tNMHDR, $hWndFrom, $iCode
$tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
$hWndFrom = DllStructGetData($tNMHDR, 'hWndFrom')
$iCode = DllStructGetData($tNMHDR, 'Code')
Switch $iCode
Case $NM_CLICK
$aItemIndex = _GUICtrlListView_GetSelectedIndices($ListView1, True)
If $aItemIndex Then
$iCurIndex = $aItemIndex
$text = _GUICtrlListView_GetItemText($ListView1, $iCurIndex, 1)
MsgBox(0,0,$text)
EndIf
EndSwitch
EndFunc ;==>WM_NOTIFY</font>
读取的代码写入文件,然后使用宏@AutoItExe去执行 Execute ('MsgBox(0, 0, "代码被执行。")') 本帖最后由 qsy666888 于 2020-6-5 23:03 编辑
水木子 发表于 2020-6-5 13:20
Execute ('MsgBox(0, 0, "代码被执行。")')
感谢感谢,用过这个Execute代码,计算器上就要用到这个代码 没有想到居然还可以这样用。:face (27):
页:
[1]