TheDanishDragon Posted December 13, 2008 Posted December 13, 2008 (edited) Hi all AU3'ers! I'm about to make a script whitch store math/physic equation and it's units to a database. Then my question is: What is the best way to make such database?I have surfed the forum, and found this:So, heres the UDF he use, can it inspire you? I'm still wondering how he do it expandcollapse popup_LimitInputEx(1, "0x1B|0x70|0x71|0x72|0x73") Global $ah_Hooks Global $ah_Hooks2 Func _LimitInputEx($sBlock=0, $sExclude="", $sALTExclude="") Select Case IsArray($ah_Hooks) AND $sBlock = 0 If $ah_Hooks[1] > 0 Then DllCallbackFree($ah_Hooks[1]) If $ah_Hooks[2] > 0 Then DllCallbackFree($ah_Hooks[2]) If $ah_Hooks[3] > 0 Then _WinAPI_UnhookWindowsHookEx($ah_Hooks[3]) If $ah_Hooks[4] > 0 Then _WinAPI_UnhookWindowsHookEx($ah_Hooks[4]) Return 1 Case IsArray($ah_Hooks) AND $sBlock = 1 If $ah_Hooks[1] > 0 Then DllCallbackFree($ah_Hooks[1]) If $ah_Hooks[2] > 0 Then DllCallbackFree($ah_Hooks[2]) If $ah_Hooks[3] > 0 Then _WinAPI_UnhookWindowsHookEx($ah_Hooks[3]) If $ah_Hooks[4] > 0 Then _WinAPI_UnhookWindowsHookEx($ah_Hooks[4]) Case IsNumber($sBlock) And $sBlock > 0 Local $pStub_KeyProc = 0, $hHookKeyboard = 0 $pStub_KeyProc = DllCallbackRegister("_Key_Proc", "int", "int;ptr;ptr") $hHookKeyboard = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($pStub_KeyProc), _ _WinAPI_GetModuleHandle(0), 0) Local $aRet[5] = ["|" & $sExclude & "|", $pStub_KeyProc, $hHookKeyboard] Global $ah_Hooks2 = "|" & $sALTExclude & "|" Global $ah_Hooks $ah_Hooks = $aRet Return 1 Case Else Return SetError(1, 0, 0) EndSelect EndFunc Func _Key_Proc($nCode, $wParam, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($ah_Hooks[3], $nCode, $wParam, $lParam) Local $KBDLLHOOKSTRUCT = DllStructCreate("dword vkCode;dword scanCode;dword flags;dword time;ptr dwExtraInfo", $lParam) Local $vkCode = DllStructGetData($KBDLLHOOKSTRUCT, "vkCode") Local $flags = DllStructGetData($KBDLLHOOKSTRUCT, "flags") ;Local $scanCode = DllStructGetData($KBDLLHOOKSTRUCT, "scanCode") ;Disable ALT-TAB If $flags = $LLKHF_ALTDOWN AND StringInStr($ah_Hooks2, "|0x" & Hex($vkCode, 2) & "|") Then Return 1 If StringInStr($ah_Hooks[0], "|0x" & Hex($vkCode, 2) & "|") Then Return 1 _WinAPI_CallNextHookEx($ah_Hooks[3], $nCode, $wParam, $lParam) EndFunc-------------------------------------------------------------------------My goal right now is to make a equation database. So that you can store a formula such as: F=m*gand have some values such as F,m and g - which is stored to a single line of text. Then later idexed into varriables. First off all i want to make a database, which contains all the units/prefixs/units. So i snooped this up: Example of using this UDF: #Include <LimitInputEx.au3> _LimitInputEx(1, "0x1B|0x70|0x71|0x72|0x73");0x1B={ESC},0x70="{F1}",0x71="{F2}",0x72="{F3}",0x73="{F4}" AdlibEnable("_Quit", 10000);This is only for testing, so if anything go wrong, the script will exit after 10 seconds. While 1 Sleep(100) WEnd Func OnAutoITExit() _LimitInputEx() EndFunci noticed that his input was: 1, "0x1B|0x70|0x71|0x72|0x73"!!!! WOW, and i want to make something like that in stead if the MYSQLite as admiral alkex points out. My best gueas right now would be right now:Dim $DATABASE = {TPIC1{{ formula1| formula2|..}{prefix(unit)|prefix(unit)|prefix(unit)|..}}} Eksample: Dim $DATABASE = {Forces{{F=m*g}{F(N)|m(m)|g(m/s^2)}}{NEVERENDING}Maybe it could write to a MYSQLite file, who knows ^^/Regard, TDD-----Edited once* Edited December 14, 2008 by TheDanishDragon
AdmiralAlkex Posted December 13, 2008 Posted December 13, 2008 You already have SQLite with AutoIt, why not use that? And what's the point with that UDF, there isn't any database in it? .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
PsaltyDS Posted December 14, 2008 Posted December 14, 2008 ...and i want to make something like that in stead if the MYSQLite as admiral alkex points out. ; ...<snip>Maybe it could write to a MYSQLite file, who knows ^^I don't understand what you want to do, but MYSQL is an enterprise capable full featured database server, while SQLite is a small, compact, shared-file DLL-based database access client included with the AutoIt UDFs. I'm sure you meant SQLite, where you would create, insert, and update the database by making calls to the SQLite3.dll (wrapped in the AutoIt UDF functions). You don't ever write directly to the file, any more than you would to an MS SQL .mdb file. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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