Jump to content

BugFix

Active Members
  • Posts

    378
  • Joined

  • Last visited

  • Days Won

    3

BugFix last won the day on January 2 2024

BugFix had the most liked content!

Profile Information

  • Location
    Germany

Recent Profile Visitors

1,316 profile views

BugFix's Achievements

Universalist

Universalist (7/7)

59

Reputation

  1. New version QRCreateCI.au3 v0.4 Multiline via command line was not recognized so far. I have now adjusted it. The default for line breaks is now a caret ^. Only if another placeholder is to be used for the break, this must be set - but then necessarily as the first parameter! e.g. QRCreatorCI break="||" text="Line 1||Line 2||Line 3" In the (possible) case that you want to output text without a line break but with the standard placeholder for line breaks (^), break=none is required (again as the first parameter)!
  2. I monitor an external window for resizing with the WinGetPos() function. This allows me to detect every move, minimize, maximize, restore and resize. One problem, however, is the SplitScreen dialog in Windows 11. If the size or position of the window is changed via this dialog, no associated event is usually triggered or it is not recognizable. This is clearly visible in the example script if the position of the window is frequently changed via the split dialog. #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Global $hGui = GUICreate('Test', 300, 200, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_POPUP,$WS_MAXIMIZEBOX,$WS_SIZEBOX)) GUISetState() _ConsoleWriteSize('START') While True Switch GUIGetMsg() Case -3 Exit Case $GUI_EVENT_MINIMIZE _ConsoleWriteSize('GUI_EVENT_MINIMIZE') Case $GUI_EVENT_RESTORE _ConsoleWriteSize('GUI_EVENT_RESTORE') Case $GUI_EVENT_MAXIMIZE _ConsoleWriteSize('GUI_EVENT_MAXIMIZE') Case $GUI_EVENT_RESIZED _ConsoleWriteSize('GUI_EVENT_RESIZED') Case $GUI_EVENT_PRIMARYUP _ConsoleWriteSize('SPLIT SCREEN DIALOG') EndSwitch WEnd Func _ConsoleWriteSize($_sMsg) Local Static $n = 0 $n += 1 Local $aWnd = WinGetPos($hGui) ConsoleWrite(StringFormat('[%s] %d, %d, %d, %d\t%s', $n, $aWnd[0], $aWnd[1], $aWnd[2], $aWnd[3], $_sMsg) & @CRLF) EndFunc What options do I have to react to the split dialog? I have tried to intercept the events with SHELLHOOK, but this only seems to work with self-created windows. EDIT: SHELLHOOK works, but does not recognize the window handle. I get the following information when the split screen dialog was used: $HSHELL_RUDEAPPACTIVATED: PID: -1 ClassName: hWnd: 0x00000000
  3. Most editors have the option of scrolling horizontally with the combination Shift+mouse wheel. SciTE does not offer this by default. I call the following script compiled at Windows startup. The scrolling speed is set as a multiplier via an INI file (filename.exe = filename.ini). The default, even without an INI file, is 3. ; INI: [HScroll] speed=3 ;-- TIME_STAMP 2024-01-02 15:58:13 #include <WinAPI.au3> #include <WindowsConstants.au3> Opt('TrayIconHide', 1) OnAutoItExitRegister('OnAutoItExit') ;~ HotKeySet('^+q', '_Exit') ; Strg+Shift+Q - during testing Global $iSpeed = 3 ; Factor for multiplying the wheel steps Global $INI = StringTrimRight(@ScriptFullPath, 4) & '.ini' If FileExists($INI) Then $iSpeed = IniRead($INI, 'HScroll', 'speed', 3) EndIf Global $gSciTECmd GUIRegisterMsg(74, "MY_WM_COPYDATA") ; $WM_COPYDATA = 74 Global Const $HC_ACTION = 0 Global $hStub_MouseProc = DllCallbackRegister("_MouseProc", "long", "int;wparam;lparam") Global $hmod = _WinAPI_GetModuleHandle(0) Global $hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($hStub_MouseProc), $hmod) Global $hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam") Global $hHookKey = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hStub_KeyProc), $hmod) Global $gbShift = False, $gbCtrl = False While True Sleep(50) WEnd Func _MouseProc($nCode, $wParam, $lParam) Local $tInfo, $wheelCount $tInfo = DllStructCreate("int X;int Y;dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo", $lParam) If $nCode < 0 Or _GetHwnd_SciTE() = Null Or $gbShift = False Or $gbCtrl Then Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) If $nCode = $HC_ACTION Then Switch $wParam Case $WM_MOUSEWHEEL $wheelCount = _WinAPI_HiWord($tInfo.mouseData)/120 SendSciTE_Command('extender:dostring do editor:LineScroll(' & $wheelCount*$iSpeed*(-1) & ',0) end') EndSwitch EndIf Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndFunc Func _KeyProc($nCode, $wParam, $lParam) Local $tKEYHOOKS, $vkCode, $ID $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) If $nCode < 0 Or _GetHwnd_SciTE() = Null Then Return _WinAPI_CallNextHookEx($hHookKey, $nCode, $wParam, $lParam) $vkCode = DllStructGetData($tKEYHOOKS, "vkCode") If $wParam = $WM_KEYDOWN Then If $vkCode = 0xA0 Or $vkCode = 0xA1 Then ; left or right shift-button pressed $gbShift = True ElseIf $vkCode = 0xA2 Or $vkCode = 0xA3 Then ; left or right ctrl-button pressed $gbCtrl = True EndIf Else Switch DllStructGetData($tKEYHOOKS, "flags") Case 0x80, 0x81 ; 0x80= UP for 'normal' keys and left pairs, 0x81= UP for right pairs If $vkCode = 0xA0 Or $vkCode = 0xA1 Then ; LShift, RShift $gbShift = False ElseIf $vkCode = 0xA2 Or $vkCode = 0xA3 Then ; LCtrl, RCtrl $gbCtrl = False EndIf EndSwitch EndIf Return _WinAPI_CallNextHookEx($hHookKey, $nCode, $wParam, $lParam) EndFunc Func _Exit() Exit EndFunc Func OnAutoItExit() _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hStub_MouseProc) _WinAPI_UnhookWindowsHookEx($hHookKey) DllCallbackFree($hStub_KeyProc) EndFunc ;==>OnAutoItExit Func _GetHwnd_SciTE() Local $hScite = WinGetHandle('[ACTIVE]') If _WinAPI_GetClassName($hScite) = 'SciTEWindow' Then Return $hScite Else Return SetError(1, 0, Null) EndIf EndFunc Func _GetHwndDirectorExtension() Local $hActive = WinGetHandle('[ACTIVE]') Local $PIDActive = WinGetProcess($hActive) Local $aExtension = WinList("DirectorExtension") Local $PIDExt For $i = 1 To $aExtension[0][0] $PIDExt = WinGetProcess($aExtension[$i][1]) If $PIDExt = $PIDActive Then Return $aExtension[$i][1] Next EndFunc ; by Jos Func SendSciTE_Command($_sCmd, $Wait_For_Return_Info=0) Local $WM_COPYDATA = 74 Local $Scite_hwnd = _GetHwndDirectorExtension() ; Get SciTE DIrector Handle Local $My_Hwnd = GUICreate("AutoIt3-SciTE interface") ; Create GUI to receive SciTE info Local $My_Dec_Hwnd = Dec(StringTrimLeft($My_Hwnd, 2)) ; Convert my Gui Handle to decimal $_sCmd = ":" & $My_Dec_Hwnd & ":" & $_sCmd ; Add dec my gui handle to commandline to tell SciTE where to send the return info Local $CmdStruct = DllStructCreate('Char[' & StringLen($_sCmd) + 1 & ']') DllStructSetData($CmdStruct, 1, $_sCmd) Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr') DllStructSetData($COPYDATA, 1, 1) DllStructSetData($COPYDATA, 2, StringLen($_sCmd) + 1) DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct)) $gSciTECmd = '' DllCall('User32.dll', 'None', 'SendMessage', 'HWnd', $Scite_hwnd, _ 'Int', $WM_COPYDATA, 'HWnd', $My_Hwnd, _ 'Ptr', DllStructGetPtr($COPYDATA)) GUIDelete($My_Hwnd) If $Wait_For_Return_Info Then Local $n = 0 While $gSciTECmd = '' Or $n < 10 Sleep(20) $n += 1 WEnd EndIf Return $gSciTECmd EndFunc ;==>SendSciTE_Command Func MY_WM_COPYDATA($hWnd, $msg, $wParam, $lParam) Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr', $lParam) Local $gSciTECmdLen = DllStructGetData($COPYDATA, 2) Local $CmdStruct = DllStructCreate('Char[' & $gSciTECmdLen+1 & ']',DllStructGetData($COPYDATA, 3)) $gSciTECmd = StringLeft(DllStructGetData($CmdStruct, 1), $gSciTECmdLen) EndFunc ;==>MY_WM_COPYDATA SciTE_ScrollH.au3
  4. I have already posted the script in the German forum, but I would like to make it available here as well. Highlighting the active tab item in SciTE Individual: Frame color Text color Background color Text color if not saved Marker "Inactive item unsaved" Marker position "Inactive item unsaved" optionally 'top' / 'bottom' / 'none' Active item marking can be deactivated (if only unsaved marking is desired). The active item then receives the same marking as the inactive item when "unsaved". Colors can be loaded as a scheme via INI The compiled script can be ended with CMDLine parameter "/Exit". Since Windows 10, the windows have a very "flat" look. One of the consequences of this is that it is not immediately apparent which item is active in a Tab-Ctrl. When programming in SciTE, I usually have many tabs open at the same time. To make the active tab more visible, I draw it with a colored frame. In addition, unsaved tabs are marked separately with coloring of the top or bottom edge. The colors used for this can be stored individually as a scheme in an INI file. Some schemes are predefined at the beginning of the script. Just try out what you like best. I start the script via the autostart folder when Windows starts. Here are a few pictures: Active Tab Active Tab, unsaved Active Tab, BG: blue / Text: white ... BG: green / Text: white Active Tab, left & right idle unsaved Tabs Active Tab unsaved too ;-- TIME_STAMP 2023-03-23 10:16:34 v 0.5 #cs v 0.5 [fixed] Flickering, a variable assignment was incorrect [fixed] Marking has failed by using keys ("F6", "Shift+F6") to change the buffer selection v 0.4 [added] Exit via CMDLine with parameter "/Exit" [added] Optionally adjustable via INI [appearance]: - Mark active item: rect_highlight=true/false - Position of the marker for "Inactive item unsaved": idlepos=top/bottom/none v 0.3 [added] Separate marker (colored line top) for "Inactive item unsaved". v 0.2 [added] Separate marking (text color) for unsaved files. [added] Loading of colors from an INI (color schemes) possible #ce #include <FontConstants.au3> #include <GuiTab.au3> #include <Misc.au3> #include <WinAPIGdi.au3> #include <WinAPISys.au3> #include <WinAPIMisc.au3> #include <WindowsConstants.au3> Opt('TrayIconHide', 1) If $CMDLINE[0] And $CMDLINE[1] = '/Exit' Then ; CMD-Line: "@ScriptName.exe /Exit" Local $aProcessList = ProcessList(@ScriptName) For $i = 1 To $aProcessList[0][0] Step 1 If $aProcessList[$i][1] <> @AutoItPID Then ProcessClose($aProcessList[$i][1]) Next EndIf _Singleton(@ScriptName) ;~ HotKeySet("!{F8}", _End) ; <Alt><F8> Beenden OnAutoItExitRegister(_End) Global $sINI = StringFormat("%s\%s.ini", @ScriptDir, StringTrimRight(@ScriptName, 4)) Global $gm_SciTE[] $gm_SciTE.ExistsLast = 0 $gm_SciTE.ExistsCurr = 0 #cs The colors can be defined in an INI file in the script folder. If INI is not available, default colors are loaded. INI-Name = Name_of_the_Exe.ini [appearance] ; rect_highlight=true/false "false" does NOT highlight the active item, default: "true". rect_highlight=true ; idlepos=top/bottom/none "none" does NOT mark unsaved inactive files, default: "top". idlepos=top [scheme] ; Specify which of the defined schemes should be active. current=default ; One section for each scheme. [default] rect=0xCC483F text=0x800020 bg=0xFFFFFF unsaved=0x3030FF idle=0x3030FF [blue_invers] rect=0xCC483F text=0xFFF0F0 bg=0x800020 unsaved=0xA9A5F7 idle=0xA9A5F7 [green_invers] rect=0x005F00 text=0xEDFFED bg=0x409340 unsaved=0x1DE6B5 idle=0x1DE6B5 #ce ; appearance $gm_SciTE.bHighlight = (_IniOrDefault($sINI, 'rect_highlight', 'true', 'appearance') = 'true') $gm_SciTE.IdlePos = _IniOrDefault($sINI, 'idlepos', 'top', 'appearance') ; scheme: default (blue): $gm_SciTE.RectColor = _IniOrDefault($sINI, 'rect' , 0xCC483F) ; BGR $gm_SciTE.TextColor = _IniOrDefault($sINI, 'text' , 0x800020) ; BGR $gm_SciTE.BGColor = _IniOrDefault($sINI, 'bg' , 0xFFFFFF) ; BGR $gm_SciTE.TextColorUnsaved = _IniOrDefault($sINI, 'unsaved', 0x3030FF) ; BGR $gm_SciTE.IdleUnsaved = _IniOrDefault($sINI, 'idle' , 0x3030FF) ; BGR _CheckSciTE() ; the effect takes place immediately AdlibRegister(_CheckSciTE, 750) While True Sleep(5000) WEnd Func _End() AdlibUnRegister(_CheckSciTE) ;~ MsgBox(0, 'SciTE TabItem', 'Beendet!') Exit EndFunc Func _CheckSciTE() If ProcessExists("SciTE.exe") Then $gm_SciTE.ExistsCurr = 1 If $gm_SciTE.ExistsLast = 0 Then $gm_SciTE.ExistsLast = 1 If $gm_SciTE.bHighlight Then _DrawTabItem() AdlibRegister(_MouseHoversTab, 150) EndIf _MarkUnsavedIdleTab() Else $gm_SciTE.ExistsCurr = 0 If $gm_SciTE.ExistsLast = 1 Then $gm_SciTE.ExistsLast = 0 If $gm_SciTE.bHighlight Then AdlibUnRegister(_MouseHoversTab) EndIf EndIf EndFunc Func _MouseHoversTab() Local Static $iHoverLast = 1 ; when starting the program, exit from the item must be simulated Local $mTab = _SciTE_GetActiveTabInfo() If @error Then Return Local $tPoint = _WinAPI_GetMousePos(True, $mTab.hTab) Local $tRect = $mTab.RectItem Local $isHover = _WinAPI_PtInRect($tRect, $tPoint) If $isHover = 1 And $iHoverLast = 0 Then $iHoverLast = 1 ElseIf $isHover = 0 And $iHoverLast = 1 Then $iHoverLast = 0 Return _DrawTabItem() EndIf EndFunc Func _MarkUnsavedIdleTab() If $gm_SciTE.IdlePos = 'none' Then Return Local $hTab = __GetHwnd_SciTeTabCtrl() If @error Then Return SetError(1) Local $iActive = _GUICtrlTab_GetCurFocus($hTab) For $i = 0 To _GUICtrlTab_GetItemCount($hTab) -1 If $i = $iActive And $gm_SciTE.bHighlight Then ContinueLoop If StringRight(_GUICtrlTab_GetItemText($hTab, $i), 1) = '*' Then _DrawMarkerUnsaved($hTab, $i) EndIf Next EndFunc Func _DrawMarkerUnsaved($_hTab, $_iItem) Local $tRect = _GUICtrlTab_GetItemRectEx($_hTab, $_iItem) Local $tRectDraw = DllStructCreate("struct; long Left;long Top;long Right;long Bottom; endstruct") If $gm_SciTE.IdlePos = 'top' Then $tRectDraw.Left = $tRect.Left $tRectDraw.Top = $tRect.Top -1 $tRectDraw.Right = $tRect.Right $tRectDraw.Bottom = $tRect.Top Else $tRectDraw.Left = $tRect.Left $tRectDraw.Top = $tRect.Bottom +2 $tRectDraw.Right = $tRect.Right $tRectDraw.Bottom = $tRect.Bottom +3 EndIf Local $hDC = _WinAPI_GetDC($_hTab) Local $hPen = _WinAPI_CreatePen($PS_SOLID, 2, $gm_SciTE.IdleUnsaved) Local $hOldPen = _WinAPI_SelectObject($hDC, $hPen) _WinAPI_Rectangle($hDC, $tRectDraw) _WinAPI_SelectObject($hDC, $hOldPen) _WinAPI_DeleteObject($hPen) _WinAPI_ReleaseDC(0, $hDC) EndFunc Func _DrawTabItem() Local $mTab = _SciTE_GetActiveTabInfo() If @error Then Return Local $hDC = _WinAPI_GetDC($mTab.hTab) Local $hFont = _WinAPI_CreateFont(14.5, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, _ $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Lucida Sans Unicode Standard') Local $hOldFont = _WinAPI_SelectObject($hDC, $hFont) Local $tRect = $mTab.RectItem ; extract to variable - otherwise no ByRef access possible Local $dY = (@OSVersion = "Win_7" ? 2 : 1) _WinAPI_InflateRect($tRect, 2, $dY) ; enlarge rectangle _WinAPI_OffsetRect($tRect, 0, 1) ; move rectangle down by 1px ; draw and fill rect Local $hPen = _WinAPI_CreatePen($PS_SOLID, 2, $gm_SciTE.RectColor) Local $hBrush = _WinAPI_CreateSolidBrush($gm_SciTE.BGColor) Local $hOldPen = _WinAPI_SelectObject($hDC, $hPen) Local $hOldBrush = _WinAPI_SelectObject($hDC, $hBrush) _WinAPI_Rectangle($hDC, $tRECT) ; draw text If StringRight($mTab.Item, 1) = '*' Then _WinAPI_SetTextColor($hDC, $gm_SciTE.TextColorUnsaved) Else _WinAPI_SetTextColor($hDC, $gm_SciTE.TextColor) EndIf _WinAPI_SetBkColor($hDC, $gm_SciTE.BGColor) ; move the text down a bit more _WinAPI_OffsetRect($tRect, 0, 3) _WinAPI_DrawText($hDC, $mTab.Item, $tRect, BitOR($DT_BOTTOM,$DT_CENTER)) ; clear ressources _WinAPI_SelectObject($hDC, $hOldFont) _WinAPI_DeleteObject($hFont) _WinAPI_SelectObject($hDC, $hOldPen) _WinAPI_DeleteObject($hPen) _WinAPI_SelectObject($hDC, $hOldBrush) _WinAPI_DeleteObject($hBrush) _WinAPI_ReleaseDC(0, $hDC) EndFunc Func _SciTE_GetActiveTabInfo() Local $mResult[], $hTab = __GetHwnd_SciTeTabCtrl() If @error Then Return SetError(1) $mResult.hTab = $hTab $mResult.Index = _GUICtrlTab_GetCurFocus($hTab) $mResult.Item = _GUICtrlTab_GetItemText($hTab, $mResult.Index) $mResult.RectItem = _GUICtrlTab_GetItemRectEx($hTab, $mResult.Index) Return $mResult EndFunc Func __GetHwnd_SciTE() Local $hScite = WinGetHandle('[ACTIVE]') If _WinAPI_GetClassName($hScite) = 'SciTEWindow' Then Return $hScite Else Return SetError(1, 0, Null) EndIf EndFunc Func __GetHwnd_SciTeTabCtrl() Local $hScite = __GetHwnd_SciTE() If @error Then Return SetError(1, 0, Null) Local $aChild, $hWndTab = Null $aChild = _WinAPI_EnumChildWindows($hScite) ; only visible If Not @error Then For $i = 1 To $aChild[0][0] If $aChild[$i][1] = "SciTeTabCtrl" Then $hWndTab = $aChild[$i][0] ExitLoop EndIf Next EndIf Return SetError(($hWndTab = Null ? 1 : 0), 0, $hWndTab) EndFunc ; read from INI if exists Func _IniOrDefault($_sINI, $_sKey, $_sDefault, $_sec=Null) Local $sVal = $_sDefault, $sSec = $_sec = Null ? 'scheme' : $_sec If FileExists($_sINI) Then If $sSec = 'scheme' Then $sSec = IniRead($_sINI, 'scheme', 'current', 'default') $sVal = IniRead($_sINI, $sSec, $_sKey, $_sDefault) EndIf Return $sVal EndFunc SciTE_DrawTabItem.au3
  5. When posting scripts to platforms that use different tab settings (e.g. GitHub), they are ripped from their formatting. Thus, it is better to replace all tabs with spaces in the correct position before posting. I have created the following Lua script for this purpose. It replaces all tabs with the appropriate number of spaces in the document opened in SciTE. By default a tab width of 4 characters is used. But other values are also possible, details about this and the installation and usage are at the beginning of the script. -- TIME_STAMP 2022-05-01 11:28:55 v 0.1 --[[ == Installation == • Store the file to "YOUR-PATH/TabReplaceSciTE.lua" • New entry in your "SciTEUser.properties" (find a free command number, in example is "49" used, and a free shortcut) #49 Replace TAB with spaces command.name.49.*=Replace TAB with spaces command.49.*=dofile "YOUR-PATH/TabReplaceSciTE.lua" command.mode.49.*=subsystem:lua,savebefore:no command.shortcut.49.*=Ctrl+Alt+Shift+R • If your sources has different values for TAB width, you can modify the command call in this script (last line), "TabReplace_FileInSciTE(2)" or "TabReplace_FileInSciTE(8)". Or add a property to your "SciTEUser.properties" to have more flexibility: # The currently used tab.size, which is replaced by spaces # Without this property or with empty value "4" is used. tab.replace.width=2 Then change the last line in this script to: TabReplace_FileInSciTE(props['tab.replace.width']) == Usage == • Open any script. • Hit the shortcut. • In the opened document, all TAB will be replaced by the number of spaces corresponding to the TAB position in the line. ]] ---------------------------------------------------------------------------------------------------- --[[ in...: _line A line of text whose TAB are to be replaced by spaces. .....: _tabsize TAB size in number of characters. If it is omitted, 4 is used. out..: The line, with TAB replaced if necessary, and the number of replacements. ]] ---------------------------------------------------------------------------------------------------- TabReplace_Line = function(_line, _tabsize) if _line:find('^[\r\n]+$') then return _line, 0 end -- only a line break if _line == '' then return _line, 0 end -- only a empty string local posTab = _line:find('\t') if posTab == nil then return _line, 0 end -- no TAB included _tabsize = _tabsize or 4 -- default TAB width local tTab, s, sRep, iLen, sumLen = {}, ' ', '', 0, 0 while posTab ~= nil do -- calculation replacement string, taking into account characters to be inserted iLen = (_tabsize - ((posTab + sumLen -1) % _tabsize)) sumLen = sumLen + iLen -1 -- total length of the replacements sRep = s:rep(iLen) -- create replacement string table.insert(tTab, sRep) -- save to table posTab = _line:find('\t', posTab +1) -- find next TAB end local idx = 0 _line = _line:gsub('\t', function() idx = idx +1 return tTab[idx] end) return _line, idx end ---------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- --[[ Replaces all TAB in the file currently open in SciTE ]] ---------------------------------------------------------------------------------------------------- TabReplace_FileInSciTE = function(_tabsize) local caret = editor.CurrentPos local fvl = editor.FirstVisibleLine local content = '' if _tabsize == '' then _tabsize = nil end for i=0, editor.LineCount -1 do local line = editor:GetLine(i) line = line or '' line = TabReplace_Line(line, _tabsize) content = content..line end editor:BeginUndoAction() editor:ClearAll() editor:InsertText(0, content) editor:EndUndoAction() editor.CurrentPos = caret editor:SetSel(caret, caret) editor.FirstVisibleLine = fvl end ---------------------------------------------------------------------------------------------------- TabReplace_FileInSciTE(4) -- If required: Change the TAB size here TabReplaceSciTE.lua
  6. Interesting that your only comment on the subject relates to copyright. But isn't the AutoIt help part of the AutoIt project? I think it is. And therefore the AutoIt copyright applies to it. Or do you see it differently? And with that your objection is invalid, isn't it?
  7. OK, I didn't make myself clear. I meant that your script refers only to the backup. Loading from a file into a :memory: database is not possible with it, at least not without changing it.
  8. I had found a script for the SQLite backup in the forum. However, this was exclusively for backing up an open database to a file. There, the pagesize was also checked, which is no longer necessary with the current SQLite version, as different pagesizes are adjusted internally. However, the backup functions of the SQLite DLL also allow loading a database file into a :memory: database and vice versa saving from a :memory: database into a database file. A database loaded into memory allows much faster access than via the file handle. I created the backup function for a running database in such a way that the backup can run completely in the background while the database continues to be worked with (implemented with AdlibRegister). Optionally, a progress function can be passed, which e.g. shows the percentage progress of the currently active backup operation in the status bar. Since the AdlibRegister function does not allow a return from the backup function, there are additional functions to query the current status (running / not running) and the last SQLite error. Another function makes it possible to output the SQLite error codes as a literal. All of this can be understood with the examples. SQLite_Backup.au3 ;-- TIME_STAMP 2021-08-15 12:32:35 v 0.3 #include-once #include <SQLite.au3> #cs First implementation of sqlite3_backup_XXX() in version 3.7.4 https://www.sqlite.org/backup.html Quote: "The online backup API allows the contents of one database to be copied into another database, overwriting the original contents of the target database. The copy operation may be done incrementally, in which case the source database does not need to be locked for the duration of the copy, only for the brief periods of time when it is actually being read from. This allows other database users to continue uninterrupted while a backup of an online database is made." Also useful to know: Default Page Size Change of SQLite 3.12.0 https://www.sqlite.org/pgszchng2016.html Here tested with 32-bit DLL (x86) for SQLite version 3.36.0 https://www.sqlite.org/download.html Paragraph: Precompiled Binaries for Windows #ce #cs FUNCTIONS ------------------------------------------------------------------------------------------------ _SQLite_Backup_LoadOrSaveDB Loads a database from file into memory or vice versa _SQLite_Backup_RunningDB Creates a backup of a running database. The database is not locked and can be used during the backup process. An optional progress function can be passed. _SQLite_Backup_RunningDB_Status Returns the status of _SQLite_Backup_RunningDB() $SQLITE_BACKUP_NOTRUNNING = 0 or $SQLITE_BACKUP_RUNNING = 1 _SQLite_Backup_RunningDB_LastError Returns the last error from _SQLite_Backup_RunningDB() _SQLite_ErrCodeLiteral Returns the passed SQLite error code as corresponding literal ------------------------------------------------------------------------------------------------ DLL FUNCTIONS ------------------------------------------------------------------------------------------------ _SQLite_Backup_Init Initialises a sqlite3_backup object _SQLite_Backup_Step Copy up to N pages between the source and destination databases specified by sqlite3_backup object _SQLite_Backup_Remaining Returns the number of pages still to be backed up at the conclusion of the most recent _SQLite_Backup_Step(). The value is updated each time _SQLite_Backup_Step() is called. _SQLite_Backup_Pagecount Returns the total number of pages in the source database at the conclusion of the most recent _SQLite_Backup_Step(). The value is updated each time _SQLite_Backup_Step() is called. _SQLite_Backup_Finish Releases all resources associated with the sqlite3_backup object ------------------------------------------------------------------------------------------------ #ce ; Error constants (not included in SQLite.au3) from sqlite3.c If Not IsDeclared('SQLITE_FORMAT') Then Global Const $SQLITE_FORMAT = 24 If Not IsDeclared('SQLITE_RANGE') Then Global Const $SQLITE_RANGE = 25 If Not IsDeclared('SQLITE_NOTADB') Then Global Const $SQLITE_NOTADB = 26 If Not IsDeclared('SQLITE_NOTICE') Then Global Const $SQLITE_NOTICE = 27 If Not IsDeclared('SQLITE_WARNING') Then Global Const $SQLITE_WARNING = 28 ; Time (ms) between 2 backup_step operations in _SQLite_Backup_RunningDB(). ; Required in order not to block other file accesses. Please do not reduce too much. Global Const $BACKUP_STEP_WAIT = 100 ; Global constants, variables to use with backup on running database Global Const $SQLITE_BACKUP_NOTRUNNING = 0 Global Const $SQLITE_BACKUP_RUNNING = 1 Global $g_Backup_pDB, $g_Backup_pFile, $g_Backup_nPage, $g_Backup_fProgress, $g_Backup_iErr, $g_Backup_iStatus = $SQLITE_BACKUP_NOTRUNNING ;=================================================================================================== ; Function Name....: _SQLite_Backup_LoadOrSaveDB ; Description......: Loads a database from file into memory or vice versa ; Parameter(s).....: $_FileDB The database file path. The database is loaded into the memory from there ; .................: or the database is saved from the memory to there. ; .........ByRef!!.: $_MemDB If you create this variable without any value (none DB pointer), it triggers the creation ; .................: of a new :memory: database. ; .................: This also determines the backup direction "file to memory". ; .................: If $_MemDB is a DB pointer (holds the handle from a :memory: database) the backup direction ; .................: is "memory to file". The file is overwritten without confirmation if it exists! ; .......optional..: $_sDBschemes Database Names ("To From") associated with the databases. (Scheme names: "main", "temp" or AS-name from ATTACH statement) ; .................: Default: "", means: "main main". If not default, pass both names separated by a space. (e.g. "temp MYCOPY") ; .................: Please note: Scheme names are case sensitive ; Return Value(s)..: Success $SQLITE_OK ; .................: Failure $SQLITE_ERROR If "_SQLite_Open(FILE)" fails: @error=error from this call, @extended=possible SQLite error there ; Remarks(s).......: The page parameter for _SQLite_Backup_Step() will not passed, the default (-1) copies all pages at once. ;=================================================================================================== Func _SQLite_Backup_LoadOrSaveDB($_FileDB, ByRef $_MemDB, $_sDBschemes='') Local $pFile = _SQLite_Open($_FileDB) Local $iErr = @error, $iExt = @extended If $iErr Then Return SetError($iErr,$iExt,$SQLITE_ERROR) Local $bSaveToFile = True, $iRet, $pBackup, $pTo, $pFrom, $iErr If Not IsPtr($_MemDB) Then $bSaveToFile = False $_MemDB = _SQLite_Open() EndIf $pFrom = $bSaveToFile ? $_MemDB : $pFile $pTo = $bSaveToFile ? $pFile : $_MemDB Local $aSchemes[] = ['main','main'] If $_sDBschemes <> '' Then $aSchemes = StringSplit($_sDBschemes, ' ', 2) $pBackup = _SQLite_Backup_Init($pTo, $aSchemes[0], $pFrom, $aSchemes[1]) If @error = $SQLITE_OK And $pBackup <> 0 Then $iErr = _SQLite_Backup_Step($pBackup) If $iErr <> $SQLITE_ERROR Then _SQLite_Backup_Finish($pBackup) $iRet = _SQLite_ErrCode($pTo) Else $iRet = $SQLITE_ERROR EndIf _SQLite_Close($pFile) Return $iRet EndFunc ;==>_SQLite_Backup_LoadOrSaveDB ;=================================================================================================== ; Function Name....: _SQLite_Backup_RunningDB ; Description......: Creates a backup of a running database. The database is not locked and can be used ; .................: during the backup process. ; Parameter(s).....: $_pDB Handle to an open database ; .................: $_FileDB The file path for backing up the database. The file is overwritten without confirmation if it exists! ; .......optional..: $_funcProgress The progress function like: progress(remaining, pagecount) ; .................: If defined, this function is called, so the percentage completion ; .................: of the process may be calculated as: ; .................: completion = 100% * (pagecount - remaining) / pagecount ; .......optional..: $_sDBschemes Database Names ("To From") associated with the databases. (Scheme names: "main", "temp" or AS-name from ATTACH statement) ; .................: Default: "", means: "main main". If not default, pass both names separated by a space. (e.g. "temp MYCOPY") ; .................: Please note: Scheme names are case sensitive ; .......optional..: $_iMaxSteps The max. number of step operations (default: 100). The sum of the pages ; .................: is divided by this value to determine the number of pages per step. ; Return Value(s)..: None Get it with call of _SQLite_Backup_RunningDB_LastError() ; Remark(s)........: You can get the current status ($SQLITE_BACKUP_NOTRUNNING = 0 or $SQLITE_BACKUP_RUNNING = 1) ; .................: with call of _SQLite_Backup_RunningDB_Status() ;=================================================================================================== ; Uses AdlibRegister ; In Adlib-function needed values as Global: $g_Backup_pDB, $g_Backup_pFile, $g_Backup_nPage, $g_Backup_fProgress, $g_Backup_iErr, $g_Backup_iStatus Func _SQLite_Backup_RunningDB($_pDB, $_FileDB, $_funcProgress=Null, $_sDBschemes='', $_iMaxSteps=100) $g_Backup_nPage = 1 $g_Backup_pFile = _SQLite_Open($_FileDB) If @error Then $g_Backup_iErr = $SQLITE_CANTOPEN Return EndIf Local $aSchemes[] = ['main','main'] If $_sDBschemes <> '' Then $aSchemes = StringSplit($_sDBschemes, ' ', 2) $g_Backup_pDB = _SQLite_Backup_Init($g_Backup_pFile, $aSchemes[0], $_pDB, $aSchemes[1]) $g_Backup_iErr = @error If $g_Backup_iErr = $SQLITE_OK And $g_Backup_pDB <> 0 Then $g_Backup_iStatus = $SQLITE_BACKUP_RUNNING ; run once ; _SQLite_Backup_Pagecount() needs first a call of _SQLite_Backup_Step() $g_Backup_iErr = _SQLite_Backup_Step($g_Backup_pDB, $g_Backup_nPage) ; 1st step with one page ($g_Backup_nPage=1) $g_Backup_nPage = Int(_SQLite_Backup_Pagecount($g_Backup_pDB)/$_iMaxSteps) ; calculate the number of pages per step for passed $_iMaxSteps If $g_Backup_nPage < 1 Then $g_Backup_nPage = 1 ; result may be <1, so correct it $g_Backup_fProgress = $_funcProgress If $g_Backup_fProgress <> Null Then $g_Backup_fProgress(_SQLite_Backup_Remaining($g_Backup_pDB), _SQLite_Backup_Pagecount($g_Backup_pDB)) EndIf If ($g_Backup_iErr = $SQLITE_OK Or $g_Backup_iErr = $SQLITE_BUSY Or $g_Backup_iErr = $SQLITE_LOCKED) Then AdlibRegister(__SQLite_Backup_StepWait, $BACKUP_STEP_WAIT) ; The ElseIf branch is only executed if the entire database was copied the first time _SQLite_Backup_Step() was called. ElseIf ($g_Backup_iErr <> $SQLITE_OK And $g_Backup_iErr <> $SQLITE_BUSY And $g_Backup_iErr <> $SQLITE_LOCKED) Then _SQLite_Backup_Finish($g_Backup_pDB) $g_Backup_iErr = _SQLite_ErrCode($g_Backup_pFile) _SQLite_Close($g_Backup_pFile) $g_Backup_iStatus = $SQLITE_BACKUP_NOTRUNNING EndIf Else _SQLite_Close($g_Backup_pFile) EndIf EndFunc ;==>_SQLite_Backup_RunningDB ;=================================================================================================== ; Function Name....: __SQLite_Backup_StepWait ; Description......: Internal AdlibRegister function, called from _SQLite_Backup_RunningDB ; Parameter(s).....: None ; Return Value(s)..: None ;=================================================================================================== Func __SQLite_Backup_StepWait() AdlibUnRegister(__SQLite_Backup_StepWait) $g_Backup_iStatus = $SQLITE_BACKUP_RUNNING $g_Backup_iErr = _SQLite_Backup_Step($g_Backup_pDB, $g_Backup_nPage) If $g_Backup_fProgress <> Null Then $g_Backup_fProgress(_SQLite_Backup_Remaining($g_Backup_pDB), _SQLite_Backup_Pagecount($g_Backup_pDB)) EndIf If ($g_Backup_iErr = $SQLITE_OK Or $g_Backup_iErr = $SQLITE_BUSY Or $g_Backup_iErr = $SQLITE_LOCKED) Then AdlibRegister(__SQLite_Backup_StepWait, $BACKUP_STEP_WAIT) ElseIf ($g_Backup_iErr <> $SQLITE_OK And $g_Backup_iErr <> $SQLITE_BUSY And $g_Backup_iErr <> $SQLITE_LOCKED) Then _SQLite_Backup_Finish($g_Backup_pDB) $g_Backup_iErr = _SQLite_ErrCode($g_Backup_pFile) _SQLite_Close($g_Backup_pFile) $g_Backup_iStatus = $SQLITE_BACKUP_NOTRUNNING EndIf EndFunc ;==>__SQLite_Backup_StepWait ;=================================================================================================== ; Function Name....: _SQLite_Backup_RunningDB_Status ; Description......: Returns the status of _SQLite_Backup_RunningDB() ; Parameter(s).....: None ; Return Value(s)..: $SQLITE_BACKUP_NOTRUNNING = 0 or $SQLITE_BACKUP_RUNNING = 1 ;=================================================================================================== Func _SQLite_Backup_RunningDB_Status() Return $g_Backup_iStatus EndFunc ;==>_SQLite_Backup_RunningDB_Status ;=================================================================================================== ; Function Name....: _SQLite_Backup_RunningDB_LastError ; Description......: Returns the last error from _SQLite_Backup_RunningDB() ; Parameter(s).....: None ; Return Value(s)..: The last error from _SQLite_Backup_RunningDB ;=================================================================================================== Func _SQLite_Backup_RunningDB_LastError() Return $g_Backup_iErr EndFunc ;==>_SQLite_Backup_RunningDB_LastError ;=================================================================================================== ; Function Name....: _SQLite_ErrCodeLiteral ; Description......: Returns the passed SQLite error code as corresponding literal ; Parameter(s).....: $_iErrCode The SQLite error code ; Return Value(s)..: The corresponding literal ;=================================================================================================== Func _SQLite_ErrCodeLiteral($_iErrCode) If $_iErrCode < 0 Or $_iErrCode > 101 Then Return "WRONG_OR_EXTENDED_ERROR_CODE" Local Static $aErrCodes[102] = ["$SQLITE_OK", "$SQLITE_ERROR", _ "$SQLITE_INTERNAL", "$SQLITE_PERM" , "$SQLITE_ABORT", _ "$SQLITE_BUSY", "$SQLITE_LOCKED", "$SQLITE_NOMEM", _ "$SQLITE_READONLY", "$SQLITE_INTERRUPT", "$SQLITE_IOERR", _ "$SQLITE_CORRUPT", "$SQLITE_NOTFOUND", "$SQLITE_FULL", _ "$SQLITE_CANTOPEN", "$SQLITE_PROTOCOL", "$SQLITE_EMPTY", _ "$SQLITE_SCHEMA", "$SQLITE_TOOBIG", "$SQLITE_CONSTRAINT", _ "$SQLITE_MISMATCH", "$SQLITE_MISUSE", "$SQLITE_NOLFS", _ "$SQLITE_AUTH", "$SQLITE_FORMAT", "$SQLITE_RANGE", _ "$SQLITE_NOTADB", "$SQLITE_NOTICE", "$SQLITE_WARNING"] $aErrCodes[100] = "$SQLITE_ROW" $aErrCodes[101] = "$SQLITE_DONE" Return $aErrCodes[$_iErrCode] EndFunc ;==>_SQLite_ErrCodeLiteral ;=================================================================================================== ; Function Name....: _SQLite_Backup_Init ; Description......: Initialises a sqlite3_backup object ; Parameter(s).....: $_pTo Database Connection Handle associated with the destination database. ; .................: $_NameToDB Database Name associated with the destination database. ("main", "temp" or AS-name from ATTACH statement) ; .................: $_pFrom Database Connection Handle associated with the source database. ; .................: $_NameFromDB Database Name associated with the source database. ("main", "temp" or AS-name from ATTACH statement) ; Return Value(s)..: Success The sqlite3_backup object if SQLITE_OK, otherwise null. @error=SQLITE_err_code (Dll call was successfull, the init operation may still have failed) ; .................: Failure 0, @errror=error from dll call ;=================================================================================================== Func _SQLite_Backup_Init($_pTo, $_NameToDB, $_pFrom, $_NameFromDB) Local $aRet = DllCall($__g_hDll_SQLite, "int:cdecl", "sqlite3_backup_init", _ "ptr", $_pTo, _ "str", $_NameToDB, _ "ptr", $_pFrom, _ "str", $_NameFromDB) Local $iErr = @error If $iErr Then Return SetError($iErr,0,0) Else Return SetError(_SQLite_ErrCode($_pTo),0,$aRet[0]) EndIf EndFunc ;==>_SQLite_Backup_Init ;=================================================================================================== ; Function Name....: _SQLite_Backup_Step ; Description......: Copy up to N pages between the source and destination databases specified by sqlite3_backup object ; Parameter(s).....: $_pBackup The sqlite3_backup object (result from _SQLite_Backup_Init). ; .................: $_nPages Number of pages to be copied. "-1" (default) copies all at once. ; Return Value(s)..: Success The SQLite error code (Dll call was successfull, the step operation may still have failed) ; .................: SQLITE_OK - successfully copies N pages and there are still more pages to be copied ; .................: SQLITE_DONE - successfully finishes copying all pages from source to destination ; .................: SQLITE_err_code - If an error occurs while running _SQLite_Backup_Step ; .................: As well as SQLITE_OK and SQLITE_DONE, a call to _SQLite_Backup_Step() may return ; .................: SQLITE_READONLY, SQLITE_NOMEM, SQLITE_BUSY, SQLITE_LOCKED, or an SQLITE_IOERR_XXX extended error code. ; .................: Failure $SQLITE_ERROR, @error=error from dll call ;=================================================================================================== Func _SQLite_Backup_Step($_pBackup, $_nPages=-1) Local $aRet = DllCall($__g_hDll_SQLite, "int:cdecl", "sqlite3_backup_step", _ "ptr", $_pBackup, _ "int", $_nPages) Local $iErr = @error If $iErr Then Return SetError($iErr,0,$SQLITE_ERROR) Else Return $aRet[0] EndIf EndFunc ;==>_SQLite_Backup_Step ;=================================================================================================== ; Function Name....: _SQLite_Backup_Remaining ; Description......: Returns the number of pages still to be backed up at the conclusion of the most ; .................: recent _SQLite_Backup_Step(). The value is updated each time _SQLite_Backup_Step() is called. ; Parameter(s).....: $_pBackup The sqlite3_backup object (result from _SQLite_Backup_Init). ; Return Value(s)..: Success Number of pages ; .................: Failure $SQLITE_ERROR, @error=error from dll call ;=================================================================================================== Func _SQLite_Backup_Remaining($_pBackup) Local $aRet = DllCall($__g_hDll_SQLite, "int:cdecl", "sqlite3_backup_remaining", _ "ptr", $_pBackup) Local $iErr = @error If $iErr Then Return SetError($iErr,0,$SQLITE_ERROR) Else Return $aRet[0] EndIf EndFunc ;==>_SQLite_Backup_Remaining ;=================================================================================================== ; Function Name....: _SQLite_Backup_Pagecount ; Description......: Returns the total number of pages in the source database at the conclusion of the most ; .................: recent _SQLite_Backup_Step(). The value is updated each time _SQLite_Backup_Step() is called. ; Parameter(s).....: $_pBackup The sqlite3_backup object (result from _SQLite_Backup_Init). ; Return Value(s)..: Success Number of pages ; .................: Failure $SQLITE_ERROR, @error=error from dll call ;=================================================================================================== Func _SQLite_Backup_Pagecount($_pBackup) Local $aRet = DllCall($__g_hDll_SQLite, "int:cdecl", "sqlite3_backup_pagecount", _ "ptr", $_pBackup) Local $iErr = @error If $iErr Then Return SetError($iErr,0,$SQLITE_ERROR) Else Return $aRet[0] EndIf EndFunc ;==>_SQLite_Backup_Pagecount ;=================================================================================================== ; Function Name....: _SQLite_Backup_Finish ; Description......: Releases all resources associated with the sqlite3_backup object ; Parameter(s).....: $_pBackup The sqlite3_backup object (result from _SQLite_Backup_Init). ; Return Value(s)..: Success The SQLite error code (Dll call was successfull, the finish operation may still have failed) ; .................: Failure $SQLITE_ERROR, @error=error from dll call ;=================================================================================================== Func _SQLite_Backup_Finish($_pBackup) Local $aRet = DllCall($__g_hDll_SQLite, "int:cdecl", "sqlite3_backup_finish", _ "ptr", $_pBackup) Local $iErr = @error If $iErr Then Return SetError($iErr,0,$SQLITE_ERROR) Else Return $aRet[0] EndIf EndFunc ;==>_SQLite_Backup_Finish SQLite_Backup_Example.au3 #include 'SQLite_Backup.au3' ; min. required: version 3.7.4 _SQLite_Startup(@ScriptDir & "\sqlite3.dll", False, 1) ; Modify the pathes for your SQLite database files! Global $g_sDBFile = @ScriptDir & "\germandict.db" Global $g_sDBFileCopy = @ScriptDir & "\germandict_copy_running.db" ; Target file: _Example_Backup_RunningDB() ; Function: _SQLite_Backup_LoadOrSaveDB ; ByRef parameter, must be declared (no preassignment required for: File -> Memory) Global $g_hDBMem ConsoleWrite('LOAD FILE TO MEMORY' & @CRLF) _Example_LoadFileToMemory() ConsoleWrite('SAVE MEMORY TO FILE' & @CRLF) _Example_SaveMemoryToFile() _SQLite_Close($g_hDBMem) ConsoleWrite('BACKUP RUNNING DB' & @CRLF) _Example_Backup_RunningDB() _SQLite_Shutdown() Func _Example_LoadFileToMemory() Local $Timer = TimerInit() ; Since $g_hDBMem is not a database pointer, a memory database is automatically created. ; This also results in the copy direction: file to memory. Local $iResult = _SQLite_Backup_LoadOrSaveDB($g_sDBFile, $g_hDBMem) #cs If you do not use the standard scheme names (To: 'main', From: 'main'), you can pass them as optional parameters. Local $iResult = _SQLite_Backup_LoadOrSaveDB($g_sDBFile, $g_hDBMem, 'temp MYCOPY') #ce If $iResult = $SQLITE_OK Then ConsoleWrite('COPY-TIME File -> Memory: ' & StringFormat('%.1f s', TimerDiff($Timer)/1000) & ' ' & _SQLite_ErrCodeLiteral($iResult) & @CRLF & @CRLF) Else ConsoleWrite('ERROR: ' & _SQLite_ErrCodeLiteral($iResult) & @CRLF & @CRLF) EndIf EndFunc ;==>_Example_LoadFileToMemory Func _Example_SaveMemoryToFile() Local $Timer = TimerInit() ; $g_hDBMem is now a database pointer (created and filled by _Example_LoadFileToMemory() ) ; This also results in the copy direction: memory to file. Local $iResult = _SQLite_Backup_LoadOrSaveDB($g_sDBFile, $g_hDBMem) #cs If you do not use the standard scheme names (To: 'main', From: 'main'), you can pass them as optional parameters. Local $iResult = _SQLite_Backup_LoadOrSaveDB($g_sDBFile, $g_hDBMem, 'temp MYCOPY') #ce If $iResult = $SQLITE_OK Then ConsoleWrite('COPY-TIME Memory -> File: ' & StringFormat('%.1f s', TimerDiff($Timer)/1000) & ' ' & _SQLite_ErrCodeLiteral($iResult) & @CRLF & @CRLF) Else ConsoleWrite('ERROR: ' & _SQLite_ErrCodeLiteral($iResult) & @CRLF & @CRLF) EndIf EndFunc ;==>_Example_SaveMemoryToFile Func _Example_Backup_RunningDB() Local $hDB = _SQLite_Open($g_sDBFile) ; Parameter: Handle running DB, Path backup file, [optional] progress function, [optional] string scheme names, [optional] max. number progress steps _SQLite_Backup_RunningDB($hDB, $g_sDBFileCopy, _progress, '', 100) Local $Timer = TimerInit(), $iStatus While True Sleep(20) $iStatus = _SQLite_Backup_RunningDB_Status() ConsoleWrite('TIMER: ' & StringFormat('%.2f', TimerDiff($Timer)/1000) & ' BACKUP-STATUS: ' & ($iStatus ? '$SQLITE_BACKUP_RUNNING' : '$SQLITE_BACKUP_NOTRUNNING') & @CRLF) If Not $iStatus Then ConsoleWrite('FINISHED, LAST_ERROR: ' & _SQLite_ErrCodeLiteral(_SQLite_Backup_RunningDB_LastError()) & @CRLF) ExitLoop EndIf WEnd _SQLite_Close($hDB) EndFunc ;==>_Example_Backup_RunningDB Func _progress($r, $p) ; $r=remaining-pages, $p=page-count ConsoleWrite('Completion: ' & StringFormat('%.1f %%', (100 * ($p - $r) / $p)) & @CRLF) EndFunc ;==>_progress SQLite_Backup.au3 SQLite_Backup_Example.au3
  9. If you have set the property NewFileEncoding=UTF8BOM each file, that will created in SciTE, get this encoding. If you work only with au3-files, it's OK. But if you also use e.g. lua-files, the BOM must removed. Therefore I've made another solution: -- TIME_STAMP 2021-04-15 14:02:19 --[[ After a file was saved, the event OnSave will fired. Now will checked: - needs this file typ the BOM? - If Yes: Has this file already the BOM? - If No: Write the BOM sequence at the beginning of the file If you want register other types as "au3" for set BOM use this property in SciTEUser.properties: #~ File types, that needs byte order mark #~ "au3" is predefined and does not need to be set here BOM.File.Types=extension_1 extension_2 ]] CheckBOM = EventClass:new(Common) CheckBOM.OnSave = function(self, _file) if not self:NeedsBOM(props['FileExt']) then return nil end if not self:StartsWithBOM(_file) then scite.MenuCommand(153) end return nil end CheckBOM.StartsWithBOM = function(self, _file) local ToHex = function(_s) if _s == nil then return "DEAD" end return (_s:gsub('.', function(_c) return ('%02X'):format(_c:byte()) end)) end local fh = io.open(_file, "rb") local read = fh:read(3) fh:close() return (ToHex(read) == "EFBBBF") end CheckBOM.NeedsBOM = function(self, _ext) local extensions = props['BOM.File.Types']:lower()..' au3' if extensions:find(_ext:lower()) then return true else return false end end Load the "CheckBOM.lua" with your "SciTEStartup.lua" and, if required, create the property "BOM.File.Types" to add other file types for using BOM. CheckBOM.lua
  10. New version v0.10 Set comment.block: leading and trailing empty lines in selection will ignored selection.start / selection.end is inside a text line: selection will expanded to full line selection.end is at 1st position in a line: this line will ignored (is outside the block comment) at minimum 1 character needs to selected UnSet comment.block: Only one: The cursor position must be within a line with comment.box.start or in any line above. The related comment.box.end will detected automatically (with any kind of nesting).
  11. The block comment (internal: box comment) in SciTE cannot be toggled. I have now created a script that helps. It works with any file type for which the corresponding entries in the properties are created.For toggeling its required to detect, what the user want to do. EDIT 2021-04-14 [v0.10] In the meantime, I have changed and discarded a few things. But in my opinion, the current variant is much easier to handle: Rules for detection: UNSET COMMENT BLOCK - NEW: NONE SELECTION IS REQUIRED! There must exist an comment block near the cursor position (cursor inside the .start line or above). The script detects automatically the "comment.box.start" and the corresponding "comment.box.end" (also if nested) and works until this line. SET COMMENT BLOCK - Some text must selected (at minimum one character) - Starts and/or ends the selection inside of a line, the selection will expanded to full line. - Ends the selection in a line with text, but at line start position so will this line ignored! - Leading and trailing empty lines in selection will ignored! This means that in nested block comments there is at least one more line between two comment.box.start markers. It is recommended to write all block comment settings into "SciTEUser.properties". The setting "comment.box.end.au3" from "SciTEGlobal.properties" is incorrect and must be corrected. comment.box.start.au3=#cs #~ If you want characters or tab in each line of comment block (middle lines), define it here. #~ If TAB should used as box.middle, set it so: comment.box.middle.au3=@Tab #~ "@Tab" is replaced by a tabulator by the script. comment.box.middle.au3= comment.box.end.au3=#ce additional [optional] property: #~ message for comment block set or unset - output/none (1/0), default=0 (none output) #~ e.g.: "++ COMMENT BLOCK - UNSET [line 103-106]" #~ SET : current line numbers of commented text including the lines with .start .end #~ UNSET: current line number(s) of text that was commented comment.box.output=0 Connection to SciTE Search a free command number. Use a Hotkey of your choice. (or use the default shortcut: Ctrl+Shift+Q) If you have declared an option for user lua scripts (e.g.: "Lua.User.Scripts.Path=C:\code\lua"), copy the script to this folder. Otherwise copy it to a folder of your choice and change the path in the command: "dofile". But backslashes in the path must be masked. ("\\"). If your path has spaces don't forgot to encapsulate in string delimiters. # 24 Toggle Block Comment command.name.24.*=Toggle Block Comment command.24.*=dofile $(Lua.User.Scripts.Path)/BlockComment.lua command.mode.24.*=subsystem:lua,savebefore:no command.shortcut.24.*=Ctrl+Alt+F10 Here the lua script: -- TIME_STAMP 2021-04-14 17:56:37 v 0.10 --[[ Toggle Block Comments ©BugFix ( autoit[at]bug-fix.info ) For toggeling its required to detect, what the user want to do. Rules for detection: UNSET COMMENT BLOCK - NEW: NONE SELECTION IS REQUIRED! There must exist an comment block near the cursor position (cursor inside the .start line or above). The script detects automatically the "comment.box.start" and the corresponding "comment.box.end" (also if nested) and works until this line. SET COMMENT BLOCK - Some text must selected (at minimum one character) - Starts and/or ends the selection inside of a line, the selection will expanded to full line. - Ends the selection in a line with text, but at line start position so will this line ignored! - Leading and trailing empty lines in selection will ignored! Properties: It is recommended to write all block comment settings into SciTEUser.properties. The setting "comment.box.end.au3" from "au3.properties" is wrong and must be corrected. comment.box.start.au3=#cs #~ If you want characters or tab in each line of comment block (middle lines), define it here. #~ If TAB should used as box.middle, set it so: comment.box.middle.au3=@Tab #~ "@Tab" is replaced by a tabulator by the script. comment.box.middle.au3= comment.box.end.au3=#ce additional [optional] property: #~ message for comment block set or unset - output/none (1/0), default=0 (none output) #~ e.g.: "++ COMMENT BLOCK - UNSET [line 103-106]" #~ SET : current line numbers of commented text including the lines with .start .end #~ UNSET: current line number(s) of text that was commented comment.box.output=0 Example with AutoIt comment: "SelectionStart" = [S] "SelectionEnd" = [E] ---------------------------------------------------------------------- selection: or or 1 [S]line with some text[E] 1 [S] 1 lin[S]e with some text[E] 2 line with some text[E] or or or 1 [S] 1 [S]line with some text 1 [S] 2 line with some text 2 [E] 2 line with so[E]me text 3 [E] or or 1 [S] 1 [S] ... empty lines 2 line with some text 5 ... empty lines 6 line with some text 6 7 [E] 7 [E] result for all: 1 #cs 2 line with some text 3 #ce ---------------------------------------------------------------------- ]] --[[ History v 0.10 - fixed: If last selected line is also last line in editor, the comment.end was set in this line and so was this line deleted if has toggled. v 0.9 - removed: comment.box.ignore.empty.before/after - was not very usefull - added: detection (and excluding) of leading and/or trailing empty lines in selection v 0.8 - fixed: Problem with selection starts/ends in the middle of a line or ends at the first position of the line with text v 0.7 - added: Automatic detection for comment blocks, NO SELECTION REQUIRED to unset a comment block - added: properties comment.box.ignore.empty.before: if first selected line is empty -- don't include in comment block comment.box.ignore.empty.after: if last selected line is empty -- don't include in comment block comment.box.output: if "1" -- write result of proceeding to console, default is "0" - changed: minimum required selection to start block comment: 1 character v 0.6 - fixed: if selection for uncommenting is wrong, leading/trailing empty line will removed v 0.5 - fixed: the trailing line break from comment.end while uncommenting will not removed v 0.4 - added: detection for uncommenting if selection is wrong (starts/ends in empty line) v 0.3 - project new designed (object syntax) v 0.2 - fixed: missed adding of middle marker in first line ]] local BlockComment = { -- variables ext, -- file extension boxStart, -- property: comment.box.start boxMiddle, -- property: comment.box.middle boxEnd, -- property: comment.box.end bMiddle, -- bool: boxMiddle is defined lenEOL, -- length of line break character(s) from file in editor eol, -- the end of line character(s) in this file msg = {}, -- store line numbers (start, end) for proceeding message selS = {}, -- selection start selE = {}, -- selection end -- selection table fields: -- .pos, -- selection position -- .line, -- selection line number newText, -- the text that replaces the selection -- initialize variables Init = function(self) self.ext = props["FileExt"] self.boxStart = props["comment.box.start."..self.ext] self.boxMiddle = props["comment.box.middle."..self.ext] self.bMiddle = not (self.boxMiddle == "") self.boxEnd = props["comment.box.end."..self.ext] if self.boxMiddle == "@Tab" then self.boxMiddle = "\t" end self.selS = self:SelLineData(editor.SelectionStart) self.selE = self:SelLineData(editor.SelectionEnd) self.lenEOL = self:GetEOL() self.eol = "\n" if self.lenEOL == 2 then self.eol = "\r\n" end self.newText = "" end, -- stores #pos and #line from selection position SelLineData = function(self, _selPos) -- _selPos: editor.SelectionStart or editor.SelectionEnd local t = {} t.pos = _selPos t.line = editor:LineFromPosition(t.pos) return t end, -- returns position from start and end (behind last visible char) of a line LineStartEndPos = function(self, _line) local startP = editor:PositionFromLine(_line) local endP = editor.LineEndPosition[_line] return startP, endP end, -- returns the length of EOL (default) or with "_getMode=true": LF/CRLF -- asking the property "eol.mode.type" is not safe, maybe not set and the global value may differ from the file in the editor GetEOL = function(self, _getMode) -- It is possible that another program makes entries (e.g.: version number) at the beginning of the file.. -- ..with a different EOL mode, therefore the second last line (last line with line break) of the file is checked. local l = editor.LineCount -2 local lenEOL if l < 0 then -- the eol.mode from properties will used instead (but not sure, if exists) local mode = props["eol.mode."..self.ext] -- mode for file type (if declared) if mode == "" then mode = props["eol.mode"] end -- otherwise the global mode if mode == "LF" then lenEOL = 1 else lenEOL = 2 end else local textEnd = editor.LineEndPosition[l] -- pos after last visible character local posLineStart = editor:PositionFromLine(l) -- first pos in line local textLen = textEnd - posLineStart -- pure text length local len = editor:LineLength(l) -- length of line including the line break characters lenEOL = len - textLen -- length of line line break characters end if _getMode then if lenEOL == 1 then return "LF" else return "CRLF" end else return lenEOL end end, -- detects if is/not selection IsSelection = function(self) return (self.selS.pos ~= self.selE.pos) end, -- mask magic characters MaskMagic = function(self, _s) if _s == nil then return "" end return _s:gsub('([%(%)%.%%%+%-%*%?%[%^%$])', '%%%1') end, -- checks if line is empty (has only a line break) LineIsEmpty = function(self, _line) -- _line: number or text from "editor:GetLine" if type(_line) == "string" then return (_line:len() == self.lenEOL) end if _line == nil then return true end local len = editor:LineLength(_line) return (len <= self.lenEOL) end, -- checks if line starts with/has box.start -- detects it also, if nested and middle marker(s) before the start marker LineHasStart = function(self, _line) if self:LineIsEmpty(_line) then return false end if type(_line) == "number" then _line = editor:GetLine(_line) end local pattern if self.boxMiddle == '' then pattern = self:MaskMagic(self.boxStart) else pattern = self:MaskMagic(self.boxMiddle)..'*'..self:MaskMagic(self.boxStart) end local n = _line:find(pattern) return (n ~= nil) end, -- checks if line starts with/has box.end -- detects it also if nested, and middle marker(s) before the end marker LineHasEnd = function(self, _line) if self:LineIsEmpty(_line) then return false end if type(_line) == "number" then _line = editor:GetLine(_line) end local pattern if self.boxMiddle == '' then pattern = self:MaskMagic(self.boxEnd) else pattern = self:MaskMagic(self.boxMiddle)..'*'..self:MaskMagic(self.boxEnd) end local n = _line:find(pattern) return (n ~= nil) end, -- remove middle marker/add line UncommentMiddleLine = function(self, _bMiddle, _text) if _bMiddle then self.newText = self.newText.._text:gsub("^("..self:MaskMagic(self.boxMiddle)..")", "") else self.newText = self.newText.._text end end, -- checks if passed line is last line in editor AND selection ends not at line start position IsLastLine = function(self, _line) return (editor.LineCount == (_line + 1)) and (editor:PositionFromLine(_line) ~= self.selE.pos) end, -- the ternary operator ternary = function(self, _condition, _ifTrue, _ifFalse) if _condition == true then return _ifTrue else return _ifFalse end end, -- creates the text to toggle and replace the selection with it Toggle = function(self) self:Init() local firstVisibleLine = editor.FirstVisibleLine local countNesting, bStart, nStart, text, nLine, replS, replE = 0, false, -1 local lineStart, lineEnd, bLastLine local sStart, sEnd = self:MaskMagic(self.boxStart), self:MaskMagic(self.boxEnd) local sMiddle = self:MaskMagic(self.boxMiddle) local bUsedMiddle = false -- (for uncommenting) check if first line after comment.start, starts with comment.box.middle marker local insertMiddle = "" if self.bMiddle then insertMiddle = self.boxMiddle end -- error check if self.boxStart == "" or self.boxEnd == "" then return print("! ERROR - The comment.box properties for *."..self.ext.." files are missing or incomplete.") end -- check for set comment block if (not self:IsSelection()) then -- none selection - means: Unset CommentBlock -- start unset self.msg.action = 'COMMENT BLOCK - UNSET' nLine = self.selS.line while nLine < editor.LineCount do text = editor:GetLine(nLine) -- line with eol if (not bStart) and self:LineHasStart(text) then -- first line with comment.box.start bStart = true self.msg.starts = nLine nStart = nLine replS = editor:PositionFromLine(nLine) -- save the start position for replacing end if nLine == nStart +1 then -- first line after comment.box.start if self.bMiddle then -- check if comment.box.middle is used, if defined local n = text:find(sMiddle) if n == 1 then bUsedMiddle = true end -- true, if starts with it end end if self:LineIsEmpty(text) then -- do nothing with empty lines, add them only if start was detected before if bStart then self.newText = self.newText..text end -- text is only a line break else if self:LineHasEnd(text) then -- the box.end or a nested box.end countNesting = countNesting -1 -- decrease nesting counter if countNesting == 0 then -- it's the corresponding end position self.newText = self.newText:sub(1, -(self.lenEOL +1)) -- ignore text from this line and delete line break from stored line before replE = editor.LineEndPosition[nLine] -- save the end position (w.o. line break) for replacing self.msg.ends = nLine -2 break -- leave the loop else -- will be treated as middle line (it's a nested comment.box.end) self:UncommentMiddleLine(bUsedMiddle, text) end elseif self:LineHasStart(text) then countNesting = countNesting +1 -- increase nesting counter -- countNesting == 1 it's the real start of block comment --> ignore this line if countNesting > 1 then self:UncommentMiddleLine(bUsedMiddle, text) end -- treat it like a middle line else -- all other cases are middle lines but if not start was detected - ignore this line if bStart then self:UncommentMiddleLine(bUsedMiddle, text) end end end nLine = nLine +1 end if (not bStart) then return print("! ERROR - None comment block starts near the cursor.") -- text near Cursor isn't comment block start marker end else -- set comment block self.msg.action = 'COMMENT BLOCK - SET' if self.selS.line == self.selE.line then -- selection is in one line text = editor:GetLine(self.selS.line) lineStart = editor:PositionFromLine(self.selS.line) lineEnd = editor.LineEndPosition[self.selS.line] + self.lenEOL editor:SetSel(lineStart, lineEnd) -- select all text in line bLastLine = self:IsLastLine(self.selE.line) if bLastLine then self.boxEnd = self.eol..self.boxEnd end self.newText = self.boxStart..self.eol..insertMiddle..text..self.boxEnd..self:ternary(bLastLine, '', self.eol) self.msg.starts = self.selS.line self.msg.ends = self.selS.line +2 else -- as 1.: find the last line with text in selection, possibly blank lines are selected at the end local iLineLastText = -1 for i = self.selE.line, self.selS.line, -1 do if (not self:LineIsEmpty(i)) then iLineLastText = i break end end -- none text selected if iLineLastText == -1 then return print("! ERROR - Only empty lines selected.") end if iLineLastText ~= self.selE.line then self.selE.line = iLineLastText self.selE.pos = editor.LineEndPosition[self.selE.line] end bLastLine = self:IsLastLine(self.selE.line) if bLastLine then self.boxEnd = self.eol..self.boxEnd end for i = self.selS.line, self.selE.line do text = editor:GetLine(i) if i == self.selS.line then -- selection start line if (not self:LineIsEmpty(text)) then lineStart = editor:PositionFromLine(self.selS.line) if lineStart ~= self.selS.pos then self.selS.pos = lineStart editor:SetSel(self.selS.pos, self.selE.pos) end self.newText = self.boxStart..self.eol..insertMiddle..text self.msg.starts = i else -- start line is empty - do nothing end elseif i == self.selE.line then -- selection end line if self.newText == "" then -- the last line is the 1st line with text in selection self.newText = self.boxStart..self.eol self.selS.pos = editor:PositionFromLine(i) self.msg.starts = i end lineStart = editor:PositionFromLine(i) lineEnd = editor.LineEndPosition[i] if lineStart == self.selE.pos then -- selection ends at line start position self.newText = self.newText..self.boxEnd..self.eol -- ignore this line self.msg.ends = i +2 break end if lineEnd == self.selE.pos then -- selection ends behind last visible char self.newText = self.newText..insertMiddle..text..self.boxEnd -- without EOL self.msg.ends = i +2 break end if lineEnd > self.selE.pos then -- selection ends inside the line, line will used self.selE.pos = lineEnd + self.lenEOL -- set selE.pos to line end for correct replacing end self.newText = self.newText..insertMiddle..text..self.boxEnd..self:ternary(bLastLine, '', self.eol) self.msg.ends = i +2 else -- middle lines if (not self:LineIsEmpty(i)) and self.newText == "" then -- may be only empty lines in selection before self.newText = self.boxStart..self.eol self.selS.pos = editor:PositionFromLine(i) self.msg.starts = i end if self.newText ~= "" then self.newText = self.newText..insertMiddle..text end end end editor:SetSel(self.selS.pos, self.selE.pos) end end -- replace the selection with the new toggled text if bStart then editor:SetSel(replS, replE) end -- for uncommenting exists none selection - do it here editor:ReplaceSel(self.newText) -- replace the next editor:SetSel(self.selS.pos,self.selS.pos) -- set the cursor to start position editor.FirstVisibleLine = firstVisibleLine -- make the first visible line visible again if props["comment.box.output"] == "1" then print(string.format('++ %s [line %d-%d]', self.msg.action, self.msg.starts +1, self.msg.ends +1)) end end } BlockComment:Toggle() As far as I know, it is not possible to overwrite SciTE internal hotkeys. In this case "Ctrl+Shift+B" for IDM_BLOCK_COMMENT. Therefore I used the connection shown here. But if overwriting is possible, I would be interested in this solution. BlockComment.lua
  12. New version QRCreatorUI v 0.4 in post #1 added features The parameters for the QR code (except text!) can now be changed immediately while the preview window is open. If $ _iSizePt had to be changed (reduced), this is visually displayed. In addition to Slider and UpDown, the preview can now be resized using the mouse wheel (forward + / backward -) or mouse buttons (left + / right -) when the mouse is over the preview window.
  13. "Once upon a time ..." than I've made the following: But now exist a new version of the "quricol.dll" for 32 and 64 bit. All parameters can be used now. In the old thread you can see, that is implemented with the help of @TheXman . Thanks for that. Then I revised the GUI and I came up with new possibilities. This has now resulted in a much more powerful tool, which is why I decided to create a new thread on this topic. There are 3 components:     QRCreator.au3         This is the base UDF that need for all. You can write your own applications by using it.     QRCreatorUI         This is the graphical User Interface to deal with all functions of the UDF.         As a special feature, you have a preview that can be enlarged.     QRCreatorCI         This is the Commandline Interface.          With the exception of HBITMAP generation, which is not required on the command line, you can perform all functions of the UDF to generate QR codes. Here more in detail: QRCreator.au3 - functions   _QR_generatePNG        Generates the QR-Code as PNG file for the passed text.   _QR_generateBMP        Generates the QR-Code as BMP file for the passed text.   _QR_getHBitmap        Creates a HBITMAP handle for the QR-Code for the passed text.         Don't forget to delete it, if no more need (_WinAPI_DeleteObject(HBITMAP)).   _QR_copyToClipboard        Copies the QR-Code picture for the passed text to the clipboard.   _QR_FileDefault       Generates a default filename (QR_YYYYMMDD_hhmmss)   _QR_getLastCall()      Asks for the result of the last call (_QR_getHBitmap/_QR_copyToClipboard/_QR_generateBMP/_QR_generatePNG)      Gets a structure with: .success(1/0) .error(@error) .width .type(B/C/[F/R]) .output(hBMP/''/fullpath) .margin .sizept .corrlevel      Types(.type): B (HBITMAP), C (Clipboard), F (File created), R (resized file created) The following parameters will used:   $_sText     The text to encode. Full unicode is supported.   $_sPathOut (ONLY: _QR_generatePNG und _QR_generateBMP)     The full path of the file to create. If only a filename has passed the @ScriptDir will used.     Without a filename the default filename will used (QR_YYYYMMDD_hhmmss).     If the filename exists, it will get a suffix (1..n) until it's unique.   $_iMargin       The QR-Code margin in px   $_iSizePt       Size of the points in the QR-Code (1-4, depends by the correction level)     If a wrong value is passed, it will corrected by the script.   $_iCorrLvl       The used correction level (0-3). Allows to read a QR-Code if some parts damaged.   $_iOutSize (ONLY: _QR_generatePNG und _QR_generateBMP)     As a new feature you can pass a target size for created file.      The size of the file depends by used correction level and the size of created points.      If you pass a value for width (and so for heigth too), the default by the dll created file will resized for this size.      If the passed size is to small it raises an error.   $_iScale (ONLY: _QR_copyToClipboard)     Also new is the ability to scale up the QR-Code copied to clipboard.      It's a factor for linear scaling, based on the default creation size by the dll call. QRCreatorUI.au3   All information for the actions you've done will shown in the statusbar of the GUI.    But this is my own statusbar, that allows formatting. I've attached them too. QRCreatorCI   available command line parameters   ---------------------------------------------------------------------------------------------------------------    REQUIRED NEW: Passing multi-line text via command line break=Placeholder character for a line break (default is ^) Must only be set if the default value is not to be used. For single-line text that contains the default placeholder, set "break=none"! If break is set, this must always be the first parameter!      text=Text for encoding    OPTIONAL      file=path/filename[.ext]  - If ommited, the default will used: @HomeDrive & @HomePath & "\QR_YYYYMMDD_hhmmss"      type=png,bmp,clip         - If ommited, 'png' will used. With clip runs CopyToClipboard.           or combined png/bmp    If file has .ext and type is passed but is different to .ext than will used type      width=int                 - (and height) initializes a resizing of the default created QR-Code                                  Resizing fails, if passed size is smaller as the default generated file.                                REMARK: Only for file creation      scale=int                 - Factor for up scaling the QR-Code                                REMARK: Only for CopyToClipboard      margin=4                  - The margin around the QR-Code in px (Default = 4)      corrlevel=0               - Up to 7%, 15%, 25% or 30% damage [0, 1, 2, 3]. (Default = 0)      sizept=2                  - The size of the painted pixel itself. The value depends on the correction level.                                  Only the smallest point size can be used for the largest correction level.                                  The value will corrected automatically, if wrong.   ---------------------------------------------------------------------------------------------------------------   return values   ---------------------------------------------------------------------------------------------------------------   comma separated string with:     ERROR=@error     RESULT='FullFilePath' or 'CLIPBOARD'     SIZE=width x heigth     SIZEPT=The really used (may be corrected) size of point     MARGIN=The used margin size     CORRLEVEL=The used correction level   --------------------------------------------------------------------------------------------------------------- You find all the stuff also in the function headers. So that you get an impression, here are a few pictures. Gallery QRCode.zip QRCreatorUI.au3 QRCreatorCI.au3
  14. Oops, 😚 I'll solve this tomorrow.
  15. I've searched in my old scripts and have seen, that I've had the same problem in opposite manner during creation of the 32 bit application. At that time I tried to apply the parameter for the correction level in the 32 bit dll, which did not work. Since it worked in the variant without correction level parameters, I have not dealt with it in recent years. Thanks to @TheXman for integrating the 64 bit dll. Now I've added the choice for the correction level. There are 4 level available: QR_ECLEVEL_L = 0 / up to 7% damage (default) QR_ECLEVEL_M = 1 / up to 15% damage QR_ECLEVEL_Q = 2 / up to 25% damage QR_ECLEVEL_H3 = 3 / up to 30% damage A higher correction level reduces the maximum count of usable characters. But I've not changed the maxChar counter, because I don't know exactly the amount of available characters for each correction level. I've also integrated an upscaling to 250 % of the created bitmap (line 469). If its to large on your system, comment this line. The changed script is attached. qr_creator_64.au3
×
×
  • Create New...