g33kdude / codequicktester Goto Github PK
View Code? Open in Web Editor NEWWrite and run AHK scripts without touching the file system.
Home Page: https://autohotkey.com/boards/viewtopic.php?f=6&t=6113
License: MIT License
Write and run AHK scripts without touching the file system.
Home Page: https://autohotkey.com/boards/viewtopic.php?f=6&t=6113
License: MIT License
I always find it easier to just drag the file and drop it in the program and open it instead of going to the file and open it or go to file -> open or even the shortcut
I'm running it as Administrator.
Save As works fine, but simple Save returns following error:
Error: Missing a required parameter.
Specifically: saveAs
---- C:\Users\acer\Documents\GitHub\AutoHotkey\GeekDude\CodeQuickTester\lib\CQT.ahk
090: }
090: {
▶ 090: Return this.Save()
090: }
090: {
Word wrap would make it much easier to use. Alternatively, saving the GUI size after being resized would mostly remove the need for wrapping.
Also, being able to replace tabs with spaces would be nice, but easy enough to get around with a user-made hotkey.
I apologise for not being able to point out exactly where the problem is, but this is what I have done so far to fix it.
I'm sure you'll understand as soon as you see it.
; Create the right click menu
this.menu := Menu()
for Index, Entry in RichCode.MenuItems
this.menu.Add(Entry?, IsSet(Entry) ? RightClickMenu : unset)
; Get the ITextDocument object
bufpIRichEditOle := Buffer(A_PtrSize, 0)
this.SendMsg(0x43C, 0, bufpIRichEditOle) ; EM_GETOLEINTERFACE
this.pIRichEditOle := NumGet(bufpIRichEditOle, "UPtr")
this.IRichEditOle := ComValue(9, this.pIRichEditOle, 1)
; ObjAddRef(this.pIRichEditOle)
this.pITextDocument := ComObjQuery(this.IRichEditOle, RichCode.IID_ITextDocument)
this.ITextDocument := ComValue(9, this.pITextDocument, 1)
; ObjAddRef(this.pITextDocument)
RightClickMenu(ItemName, ItemPos, MenuName)
{
Switch ItemName {
case "Cut" : A_Clipboard := this.SelectedText, this.SelectedText := ""
case "Copy" : A_Clipboard := this.SelectedText
case "Paste" : this.SelectedText := A_Clipboard
case "Delete" : this.SelectedText := ""
case "Select All": this.Selection := [0, -1]
case "UPPERCASE" : this.SelectedText := Format("{:U}", this.SelectedText)
case "lowercase" : this.SelectedText := Format("{:L}", this.SelectedText)
case "TitleCase" : this.SelectedText := Format("{:T}", this.SelectedText)
}
}
How about enclosing a task manager function?
#SingleInstance, FORCE
#NoEnv
#NoTrayIcon
SetTitleMatchMode, 1
DetectHiddenWindows, On
;Valiables Setup
app_title = AhkTaskMan
; column number
col_file = 1
col_pid = 2
col_mem = 3
col_exe = 4
col_ver = 5
col_hwnd = 6
col_dir = 7
; header label
label_file = ; スクリプト
label_pid = ; PID
label_mem = ; Mem(kb)
label_exe = ; プロセス名
label_ver = ; バージョン
label_hwnd = ; ウィンドウハンドル
label_dir = ; スクリプト位置
; column options
opt_file = 120
opt_pid = 50
opt_mem = 70 Integer
opt_exe = 120
opt_ver = 90
opt_hwnd = 70
opt_dir = 200
refresh_dur = 5000 ; (ms)
use_comma = 1
refresh_timer = 0
Init:
Gosub, InitGui
Gosub, ListViewColumnSetUp
Gosub, SB_Show
monitor:=true
Gosub, RefleshView
monitor:=refresh_timer
Return
RefleshView:
Thread, Interrupt, 1000
Thread, Priority, 10000
If !(monitor)
Return
pidList := "|"
row:=LV_GetCount()
; reverse loop for deleting row(s)
While (row>0) {
LV_GetText(pid, row, col_pid)
pidList.=pid . "|"
Process, Exist, %pid%
If (ErrorLevel!=pid)
LV_Delete(row)
else
LV_Modify(row, "Col" col_mem, GetMem(pid))
row--
}
WinGet, list, List, ahk_class AutoHotkey,,%A_ScriptFullPath%
Loop, % list {
hwnd:=list%A_Index%
IfWinNotExist, ahk_id %hwnd%
continue
WinGet, pid, PID
If pid && InStr(pidList, "|" pid "|")
continue
WinGetTitle, title
If RegExMatch(title, "(?P<path>.+) - AutoHotkey v(?P<ver>\d(?:\.\w+)+)$", $) {
path := $path, ver:=$ver
} else {
path := title, ver:=""
}
WinGet, exe, ProcessName
mem := GetMem(pid)
SplitPath, path, file, dir
val%col_pid% := pid
val%col_file% := file
val%col_mem% := mem
val%col_exe% := exe
val%col_ver% := ver
val%col_dir% := dir
val%col_hwnd% := hwnd
LV_Add("", val1, val2, val3, val4, val5, val6, val7)
}
SB_SetText("Process:" A_Tab A_Tab LV_GetCount() " ", 2)
Return
InitGui:
Gui, +LastFound +Resize
Gui, Margin, 0, 0
Gui, Add, ListView, vLV gLvEvent r8 w620 grid AltSubmit -Multi
Gui, Add, StatusBar, vSB gSbEvent 0x800
SB_SetParts(100, 100)
Menu, Tray, NoStandard
Menu, Tray, Add, &Restore, RestoreGui
Menu, Tray, Add, E&xit, EndApp
Menu, Tray, Default, &Restore
Menu, M1, Add, Show &Main Window , ShowMainWindow
Menu, M1, Add
Menu, M1, Add, &Reload Script , BypassMenu
Menu, M1, Add, &Suspend Hotkeys , BypassMenu
Menu, M1, Add, &Pause , BypassMenu
Menu, M1, Add, E&xit (Terminate Script), BypassMenu
Menu, M1, Add,
Menu, M1, Add, &Kill Process , KillProcess
Menu, M1, Add,
Menu, M1, Add, &Cancel , MenuCancel
Gui, Show,, %app_title%
Return
ListViewColumnSetUp:
col_headers =
(LTrim Join|
file
pid
mem
exe
ver
hwnd
dir
)
Loop, 7
{
idx:=A_Index
Loop, PARSE, col_headers, |, %A_Tab%%A_Space%
{
If (col_%A_LoopField%==idx)
{
LV_InsertCol(idx, opt_%A_LoopField%, label_%A_LoopField% ? label_%A_LoopField% : A_LoopField)
}
}
}
Return
RestoreGui:
Menu, Tray, NoIcon
Gui, Show
Return
EndApp:
GuiClose:
ExitApp
Return
GuiSize:
If (A_EventInfo==0 || A_EventInfo==2)
{
GuiControlGet, p, POS, SB
GuiControl, Move, LV, % "w" A_GuiWidth " h" (A_GuiHeight-pH)
}
else If (A_EventInfo==1)
{
Menu, Tray, Icon
Gui, Hide
}
Return
SB_Show:
If (monitor)
{
SB_SetIcon(A_Windir . "\system32\shell32.dll", 138, 1)
SB_SetText("monitoring...")
SetTimer, RefleshView, %refresh_dur%
}
else
{
SB_SetIcon(A_Windir . "\system32\shell32.dll", 4*28-2, 1)
SB_SetText("Idle")
SetTimer, RefleshView, Off
}
Return
KillProcess:
Thread, NoTimers, true
SetTimer, RefleshView, Off
Gui, +OwnDialogs
MsgBox, 305, Alert, Are you sure?, 500
IfMsgBox, OK
{
Process, Close, %pid%
Sleep, 500
Gosub, RefleshView
SetTimer, RefleshView, %refresh_dur%
}
Return
ShowMainWindow:
WinShow, ahk_id %hwnd%
Return
BypassMenu:
Thread, NoTimers, true
SetTimer, RefleshView, Off
WinMenuSelectItem, ahk_id %hwnd%,, File, %A_ThisMenuItem%
Sleep, 500
Gosub, RefleshView
SetTimer, RefleshView, %refresh_dur%
Return
MenuCancel:
; dummy
Return
LvEvent:
Thread, NoTimers, true
If (A_GuiEvent="RightClick" && row:=LV_GetNext(0, "F"))
{
LV_GetText(path, row, col_file)
LV_GetText(exe , row, col_exe )
LV_GetText(ver , row, col_ver )
LV_GetText(pid , row, col_pid )
LV_GetText(dir , row, col_dir )
LV_GetText(mem , row, col_mem )
LV_GetText(hwnd, row, col_hwnd)
Menu, M1, Show
}
Return
SbEvent:
If (A_EventInfo==1 && A_GuiEvent="DoubleClick") {
monitor:=!monitor
Gosub, SB_Show
}
Return
GetMem(pid) {
Global use_comma
mem := GetProcessMemoryState(pid)
Return use_comma ? comma(mem) : mem
}
Comma(value) {
return RegExReplace(value, "(\d{1,3})(?=(?:\d\d\d)+(?!\d))", "$1,", "", -1)
}
GetProcessMemoryState(pid,type=8){
pMemSt:=SAlloc(40)
hProcess:=DllCall("OpenProcess"
, "UInt", 0x001F0FFF
, "UInt", 0
, "UInt", pid
, "UInt")
If (hProcess) {
If DllCall("psapi.dll\GetProcessMemoryInfo", "UInt",hProcess, "UInt",pMemst, "UInt",40) {
val:=SGetInt(pMemSt,type*4)
}
releaseProcessHandle(hProcess)
}
SFree(pMemSt)
Return val
}
SAlloc(size){
Return DllCall("GlobalAlloc","UInt",0x40,"UInt",size,"UInt")
}
SFree(ptr){
DllCall("GlobalFree","UInt",ptr)
}
SGetInt(pStruct,offset){
DllCall("RtlMoveMemory", "UIntP",val, "UInt",pStruct+offset, "Int",4)
Return val
}
releaseProcessHandle(hProcess){
DllCall("psapi.dll\CloseProcess","Int",hProcess)
}
The line number gutter fails to stay in sync with the editor when the editor is zoomed, or sometimes when it is scrolled. It also goes out of sync when moving to the end of the document by the Control-End shortcut.
Line 529 in e388c2c
Since Geek mentioned once in discord, I found it can easily be fixed by change this.richCode.Value
to this.richCode.Text
FileOpen(this.FilePath, "w").Write(this.richCode.Text)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.