;#RequireAdmin ;No console #Region ;Wrapper #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Run_Tidy=y #AutoIt3Wrapper_Res_SaveSource=y #AutoIt3Wrapper_Run_Debug_Mode=n #AutoIt3Wrapper_Icon=AComp.ico #pragma compile(CompanyName, 'careca') #pragma compile(x64, false) #pragma compile(UPX, False) #AutoIt3Wrapper_Res_Comment=By: Careca #AutoIt3Wrapper_Res_Icon_Add=AComp.ico #AutoIt3Wrapper_Res_Description=Completer #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 6 -w- 7 ;-w 5 #EndRegion ;Wrapper ;====================================================================================== #Region ;FileInstall + Includes Local $InstallDir = @LocalAppDataDir & '\Completer' DirCreate($InstallDir) Local $TitleVer = StringTrimRight(@ScriptName, 4) Local $Ini = $InstallDir & '\Text.ini' Local $aProcessList = ProcessList(@AutoItExe) If $aProcessList[0][0] >= 2 Then Exit If StringInStr($cmdlineRaw, "/source") Then FileInstall(@ScriptFullPath, $InstallDir & '\' & @ScriptName, 1) Exit EndIf FileInstall("AComp.ico", $InstallDir & '\AComp.ico', 1) #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #EndRegion ;FileInstall + Includes ;====================================================================================== #Region ;Opt Opt("MustDeclareVars", 1) Opt("TrayIconDebug", 1) Opt("TrayMenuMode", 1) Opt("TrayIconHide", 0) Opt("GUIOnEventMode", 1) Opt("TrayAutoPause", 0) Opt("TrayOnEventMode", 1) Opt("MouseCoordMode", 2) Opt("GUICoordMode", 1) Opt("MouseCoordMode", 1) TraySetClick(16) TraySetState() TraySetToolTip($TitleVer) ;TraySetIcon($InstallDir & '\Str.ico') Local $hDLL = DllOpen("user32.dll") Local $WinState = 0 #EndRegion ;Opt ;====================================================================================== #Region ;Vars Global $Gui, $WS, $Bass, $Vol, $Vol2, $VolLast, $Title, $Text, $Pic, $CursorInfo, $Window, $cListView Global $hChildWin, $VisibleChild = 0, $ExitItem, $Toast, $ToastFS, $MOFF, $ReloadBASS, $ShowToast, $ShowToastFS, $ToastTray, $ToastTrayFS, $WinWHAct, $ToastFSIniRead Global $ButtonSave, $ButtonLoad, $StartWinCheck, $OffLine, $LanIp, $ImgState, $IPSplit, $Hook, $MouseArray, $ReadSect, $Buffer = '' Global $begin, $dif, $ClipGet, $iMsgBoxAnswer, $aArray, $MKey, $ScanKey, $OutKey, $GWArea, $tWorkArea, $aReturn, $Index = 0 Global $SPc, $RPc, $LPc, $ToastIniRead, $GMarquee, $Progress_1, $LabelP, $CfgFldr, $DLLCallBack, $ModHdl, $GetLTLV, $GetItemTxt, $WinPos Global $LastKey1, $LastKey2, $LastKey3, $LastKey4, $LastKey5, $LastKey6, $PCMB, $IniRVolP, $Alter = 0 Global $About, $scrFile, $Text_len, $Text_P1, $Text_P2, $Text_P3, $VolPercInpt, $VolPRead, $Hover = 0 Global $aMousePos, $aMousePos2, $DSK, $Read, $Str, $Str1, $ExIp, $GatBut, $ChkUpd, $ModKey, $FileDlgApp Global $begintrigger, $diftrigger, $Output = '', $c = 0, $s = 0, $Strlength, $App, $All = 0, $hWnd = '', $Msg = '', $wParam = '', $lParam = '' Global $UserString[21], $UserAppStr[21], $UserStringIni[21], $UserAppStrIni[21], $SelBut[21], $scanCode, $aRet, $vkKey, $lWantParam, $KeyHook, $Time2Hide = 2500 Global $i_x1 = 0, $i_y1 = 0, $i_x3 = 15, $i_y3 = 15 Global $DummyLbl, $Button_ToTray, $Button_XClose, $NewAu3, $NewAu3Path Global $YControls = 330, $FirstRun = 0, $ColorPick, $ColorPicked ;============================================================================= Const $ClearTimer = 2500 ;Time to clear the key buffer, in ms ;============================================================================= #EndRegion ;Vars ;============================================================================= #Region ;GUI ;============================================================================= $DLLCallBack = DllCallbackRegister("KeyProc", "long", "int;wparam;lparam") If $DLLCallBack = 0 Then MsgBox(64, 'Error', 'KeyProc') $ModHdl = _WinAPI_GetModuleHandle(0) If $ModHdl = 0 Then MsgBox(64, 'Error', 'GetModuleHandle') $Hook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($DLLCallBack), $ModHdl) If $Hook = 0 Then MsgBox(64, 'Error', 'SetWindowsHookEx') Local $GUI2 = GUICreate("") GUIRegisterMsg($WM_COMMAND, "GUIKey") ;============================================================================= Global Const $MSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData" Global $hKey_Proc = DllCallbackRegister("_Mouse_Proc", "int", "int;ptr;ptr") Global $hM_Module = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0) Global $hM_Hook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", $WH_MOUSE_LL, "ptr", DllCallbackGetPtr($hKey_Proc), "hwnd", $hM_Module[0], "dword", 0) ;============================================================================= $begin = TimerInit() $Gui = GUICreate($TitleVer, 200, 150, -1, -1, $WS_POPUP, -1, $GUI2) ;$WS_BORDER + $WS_SYSMENU) _WinAPI_SetLayeredWindowAttributes($Gui, 0xABCDEF, 255) _GuiRoundCorners($Gui, $i_x1, $i_y1, $i_x3, $i_y3) $cListView = GUICtrlCreateListView("Words", 3, 3, 194, 144, -1, $LVS_EX_GRIDLINES + $LVS_EX_FULLROWSELECT) ;$LVS_EX_TRACKSELECT $LVS_EX_INFOTIP GUICtrlSetTip($cListView, 'Right Click for options', "Tip", 1) GUICtrlSetFont($cListView, 9, 600, 0, '', 5) GUICtrlSendMsg($cListView, $LVM_SETCOLUMNWIDTH, 0, 190) GUISetIcon($InstallDir & '\AComp.ico') Color() GUISetState(@SW_SHOW, $Gui) WinSetOnTop($Gui, '', 1) ;============================================================================= Local $OptMenu = GUICtrlCreateContextMenu($cListView) GUICtrlCreateMenuItem("Delete", $OptMenu, 0, 0) GUICtrlSetOnEvent(-1, "Delete") ;============================================================================= $WS = TrayCreateItem("StartWithWindows") GUICtrlSetTip(-1, 'Startup with windows', "Startup", 1) TrayItemSetOnEvent($WS, "StartWinChoose") $CfgFldr = TrayCreateItem("Config Folder") TrayItemSetOnEvent(-1, "CfgFolder") $ChkUpd = TrayCreateItem("Check Update") TrayItemSetOnEvent(-1, "Update") $About = TrayCreateItem("About") TrayItemSetOnEvent(-1, "About") $ExitItem = TrayCreateItem("Close App") TrayItemSetOnEvent(-1, "Quit") GUISetOnEvent($GUI_EVENT_CLOSE, "Quit") ;============================================================================= #EndRegion ;GUI ;============================================================================= Load() ;============================================================================= While 1 ;============================================================================= $diftrigger = TimerDiff($begintrigger) If $diftrigger > $ClearTimer Or $vkKey = 32 Or $vkKey = 13 Then $begintrigger = TimerInit() $Output = '' If $Buffer <> '' And $vkKey = 32 Or $vkKey = 13 And StringLen($Buffer) > 4 Then IniWrite($Ini, 'WordList', StringLower($Buffer), '') EndIf $Buffer = '' $Index = 0 WinMove($Gui, '', 15000, 10000, 200, 150, 1) _GUICtrlListView_DeleteAllItems($cListView) EndIf ;============================================================================= If $Output <> '' And $Output <> $Buffer Then _GUICtrlListView_DeleteAllItems($cListView) $ReadSect = IniReadSection($Ini, 'WordList') For $w = 1 To $ReadSect[0][0] ;ConsoleWrite(' - ' & $ReadSect[$w][0] & ' - ' & @MSEC & @CRLF) If StringInStr($ReadSect[$w][0], $Output, 2) <> 0 Then GUICtrlCreateListViewItem($ReadSect[$w][0], $cListView) EndIf Next $Buffer = $Output $MouseArray = MouseGetPos() WinMove($Gui, '', $MouseArray[0], $MouseArray[1], 200, 150, 1) _GUICtrlListView_SetItemFocused($cListView, 0, True) _GUICtrlListView_SetItemSelected($cListView, 0, True, True) _GUICtrlListView_SetItemState($cListView, 0, $LVIS_FOCUSED, $LVIS_FOCUSED) $GetLTLV = _GUICtrlListView_GetNextItem($cListView, -1, 0, 8) $GetItemTxt = _GUICtrlListView_GetItemText($cListView, $GetLTLV, 0) EndIf ;============================================================================= $WinPos = WinGetPos($Gui) If $WinPos[0] <> 15000 And $WinPos[1] <> 10000 Then If $GetItemTxt <> '' Then If _IsPressed(04) Then Do Send('{BS}') $c = $c + 1 Until $c >= StringLen($Buffer) Send($GetItemTxt) $c = 0 $diftrigger = 3000 $Output = '' $Buffer = '' $Index = 0 WinMove($Gui, '', 15000, 10000, 200, 150, 1) _GUICtrlListView_DeleteAllItems($cListView) EndIf EndIf EndIf ;============================================================================= $hM_Hook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", $WH_MOUSE_LL, "ptr", DllCallbackGetPtr($hKey_Proc), "hwnd", $hM_Module[0], "dword", 0) $aRet = DllCall($hDLL, 'int', 'GetKeyNameText', 'int', '0x00' & $ScanKey & '0000', 'str', "", 'int', 256) ;MsgBox(64 + 262144, 'Pressed', 'Key: ' & $aRet[2]) ;ConsoleWrite('$aRet[2] - ' & $aRet[2] & ' - ' & @MSEC & @CRLF) ;============================================================================= Sleep(100) WEnd ;============================================================================= Func GUIKey($hWnd, $Msg, $wParam, $lParam) ;If $All = 0 Then $aRet = DllCall($hDLL, 'int', 'GetKeyNameText', 'int', $lParam, 'str', "", 'int', 256) $Output = $Output & $aRet[2] ConsoleWrite('$Output - ' & $Output & ' - ' & @MSEC & @CRLF) $begintrigger = TimerInit() ;EndIf EndFunc ;==>GUIKey ;============================================================================= Func KeyProc($nCode, $wParam, $lParam) If $nCode >= 0 And $wParam = $WM_KEYDOWN Then $KeyHook = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) $vkKey = DllStructGetData($KeyHook, "vkCode") $scanCode = DllStructGetData($KeyHook, "scanCode") $lWantParam = BitShift($scanCode, -16) ;============================================================================= If $All = 1 Then $All = 0 $ScanKey = Hex($scanCode, 2) $OutKey = Hex($vkKey, 2) _WinAPI_PostMessage($GUI2, $WM_COMMAND, $vkKey, $lWantParam) Else ;============================================================================= If (($vkKey > 64) And ($vkKey < 91)) Or (($vkKey > 47) And ($vkKey < 58)) Then ; a - z ; 0 - 9 ;Return ElseIf ($vkKey > 159) And ($vkKey < 164) Then Return ElseIf ($vkKey = 32) Or ($vkKey = 13) Then ; Space Or Enter ;Return Else $Output = '' Return EndIf ;============================================================================= EndIf ;============================================================================= _WinAPI_PostMessage($GUI2, $WM_COMMAND, $vkKey, $lWantParam) EndIf Return _WinAPI_CallNextHookEx($Hook, $nCode, $wParam, $lParam) EndFunc ;==>KeyProc ;============================================================================= Func _Mouse_Proc($nCode, $wParam, $lParam) #forceref $nCode, $wParam, $lParam Local $info, $mouseData $info = DllStructCreate($MSLLHOOKSTRUCT, $lParam) $mouseData = DllStructGetData($info, 3) Select Case $wParam = $WM_MOUSEWHEEL If _WinAPI_HiWord($mouseData) > 0 Then $begintrigger = TimerInit() ;ConsoleWrite(' - Up - ' & @CRLF) ;ToolTip('Up') If $Index > 0 Then $Index = $Index - 1 Else $Index = 0 EndIf _GUICtrlListView_SetItemFocused($cListView, $Index, True) _GUICtrlListView_SetItemSelected($cListView, $Index, True, True) _GUICtrlListView_SetItemState($cListView, $Index, $LVIS_FOCUSED, $LVIS_FOCUSED) $GetLTLV = _GUICtrlListView_GetNextItem($cListView, -1, 0, 8) $GetItemTxt = _GUICtrlListView_GetItemText($cListView, $GetLTLV, 0) ;MsgBox(64, '', $GetItemTxt) Else $begintrigger = TimerInit() ;ConsoleWrite(' - Down - ' & @CRLF) ;ToolTip('Dn') If $Index < _GUICtrlListView_GetItemCount($cListView) - 1 Then $Index = $Index + 1 EndIf _GUICtrlListView_SetItemFocused($cListView, $Index, True) _GUICtrlListView_SetItemSelected($cListView, $Index, True, True) _GUICtrlListView_SetItemState($cListView, $Index, $LVIS_FOCUSED, $LVIS_FOCUSED) $GetLTLV = _GUICtrlListView_GetNextItem($cListView, -1, 0, 8) $GetItemTxt = _GUICtrlListView_GetItemText($cListView, $GetLTLV, 0) ;MsgBox(64, '', $GetItemTxt) EndIf EndSelect EndFunc ;==>_Mouse_Proc ;============================================================================= #Region ;============================================================================= Func Delete() $GetLTLV = _GUICtrlListView_GetNextItem($cListView, -1, 0, 8) $GetItemTxt = _GUICtrlListView_GetItemText($cListView, $GetLTLV, 0) IniDelete($Ini, 'WordList', $GetItemTxt) _GUICtrlListView_DeleteAllItems($cListView) $ReadSect = IniReadSection($Ini, 'WordList') For $w = 1 To $ReadSect[0][0] ;ConsoleWrite(' - ' & $ReadSect[$w][0] & ' - ' & @MSEC & @CRLF) If StringInStr($ReadSect[$w][0], $Output, 2) <> 0 Then GUICtrlCreateListViewItem($ReadSect[$w][0], $cListView) EndIf Next EndFunc ;==>Delete ;============================================================================= Func Color() GUISetBkColor('0xEEEEEE', $Gui) IniWrite($Ini, 'Options', 'Color', '0xEEEEEE') _WinAPI_RedrawWindow($Gui) EndFunc ;==>Color ;====================================================================================== Func Save() $StartWinCheck = TrayItemGetState($WS) If $StartWinCheck = 65 Then IniWrite($Ini, 'Options', 'StartWithWin', 1) ElseIf $StartWinCheck = 68 Then IniWrite($Ini, 'Options', 'StartWithWin', 0) EndIf EndFunc ;==>Save ;====================================================================================== Func Load() $ReadSect = IniReadSection($Ini, 'WordList') If @error Then IniWrite($Ini, 'WordList', 'Word', '') If FileExists('C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Completer.lnk') Then Local $aDetails = FileGetShortcut('C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Completer.lnk') If Not @error Then If $aDetails[0] <> @AutoItExe Then FileDelete('C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Completer.lnk') FileCreateShortcut(@AutoItExe, 'C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Completer.lnk') EndIf EndIf TrayItemSetState($WS, $GUI_CHECKED) IniWrite($Ini, 'Options', 'StartWithWin', 1) Else ;TrayItemSetState($WS, $GUI_UNCHECKED) IniWrite($Ini, 'Options', 'StartWithWin', 0) EndIf EndFunc ;==>Load ;====================================================================================== Func StartWinChoose() $StartWinCheck = TrayItemGetState($WS) If $StartWinCheck = 65 Then StartWithWin() ElseIf $StartWinCheck = 68 Then RemFromStartWithWin() EndIf EndFunc ;==>StartWinChoose ;====================================================================================== Func StartWithWin() FileCreateShortcut(@AutoItExe, 'C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Completer.lnk') If FileExists('C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Completer.lnk') Then TrayItemSetState($WS, $GUI_CHECKED) IniWrite($Ini, 'Options', 'StartWithWin', 1) MsgBox(64, '', 'Application setup to start with windows') Else TrayItemSetState($WS, $GUI_UNCHECKED) IniWrite($Ini, 'Options', 'StartWithWin', 0) MsgBox(64, '', 'Could not set the application to start with windows') EndIf EndFunc ;==>StartWithWin ;====================================================================================== Func RemFromStartWithWin() FileDelete('C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Completer.lnk') Sleep(100) If FileExists('C:\Users\' & @UserName & '\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Completer.lnk') Then TrayItemSetState($WS, $GUI_CHECKED) IniWrite($Ini, 'Options', 'StartWithWin', 1) MsgBox(64, '', 'Could not remove the application from the start of windows') Else TrayItemSetState($WS, $GUI_UNCHECKED) IniWrite($Ini, 'Options', 'StartWithWin', 0) MsgBox(64, '', 'Removed application from start of windows') EndIf EndFunc ;==>RemFromStartWithWin ;====================================================================================== Func About() TrayItemSetState($About, $TRAY_UNCHECKED) MsgBox(64, 'About', '' & @CRLF & _ 'To be continued...' & @CRLF & @CRLF & _ 'Made By Careca') EndFunc ;==>About ;====================================================================================== Func CfgFolder() TrayItemSetState($CfgFldr, $TRAY_UNCHECKED) ShellExecute($InstallDir) EndFunc ;==>CfgFolder ;====================================================================================== Func Update() ;TrayItemSetState($ChkUpd, $TRAY_UNCHECKED) ;IniWrite($InstallDir & '\StringTriggerUpd.url', 'InternetShortcut', 'URL', 'https://drive.google.com/drive/folders/12Hb26BjpV_hoZAkgbgtpwgIzcWUBjbsK') ;ShellExecute($InstallDir & '\StringTriggerUpd.url') EndFunc ;==>Update ;============================================================================= Func _GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3) Local $Pos, $ret, $ret2 $Pos = WinGetPos($h_win) $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $Pos[2], "long", $Pos[3], "long", $i_x3, "long", $i_y3) If $ret[0] Then $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1) If $ret2[0] Then Return 1 Else Return 0 EndIf Else Return 0 EndIf EndFunc ;==>_GuiRoundCorners ;============================================================================= Func Quit() TrayItemSetState($ExitItem, $TRAY_UNCHECKED) ;============================================================================= DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hM_Hook[0]) $hM_Hook[0] = 0 DllCallbackFree($hKey_Proc) $hKey_Proc = 0 ;============================================================================= _WinAPI_UnhookWindowsHookEx($Hook) DllCallbackFree($DLLCallBack) DllClose($hDLL) Exit EndFunc ;==>Quit ;============================================================================= #EndRegion ;=============================================================================