|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Game Hacking Dojo Advanced Cheater Reputation: 0
Joined: 17 Sep 2023 Posts: 70
|
Posted: Thu Apr 18, 2024 9:19 am Post subject: External AA script editor |
|
|
Hello, Hitler
I was looking for a way to edit scripts in Sublime Text and found this one.
However, it is not very well executed, I think, and could be more useful.
The script was not made for Sublime Text and here is the link:
https://forum.cheatengine.org/viewtopic.php?t=619422&sid=6c1385e62b6ad69c27fbaafd0927a533
Thank you in advance for the help.
Bugs:
- Saving the file, is not going to save changes to the script unless Sublime Text has been closed.
- Sometimes even saving and closing does not apply changes (frustrating)
- Saves the files in a folder in the CE directory
The way it should be:
- Saving is enough to apply changes to the script.
- Double-clicking the script will open the script in the external editor (defined in the script beforehand)
- Keep the "Change script" context menu option.
- Temp files get deleted after saving the script
- Edit any script regardless of its name. If the name is not Windows naming conversion-compliant then give the chance to change the name before or after editing the script in the external editor (e.g.: Script names that contain invalid characters !,?,\,",/,*, etc.
Future CE features:
- The ability to choose a script editor for double-clicking the script.
Code: |
local result1=1
al = getAddressList()
pathOrg=getCheatEngineDir()
local pathtbl={pathOrg.."editing-ceaascripts"}
local progtbl={--{[[notepad.exe]],[[notepad.exe]]},
{[["C:\Program Files\Sublime Text\sublime_text.exe"]],[[sublime_text.exe]]}
}
local pthText=[[Just type the number of titles and confirm:
1) Sublime_text.exe]]
function editPath(ePath,editName)
local path = ePath
lfs.mkdir(path) --assume it works, or it already exists
path=path.."\\"..editName..".CEA"
return path
end
function LaunchCommandAndWait(command)
local proc=getProcessList()[tonumber(command)]
--print(proc)
if proc==nil then
result1=0
else
result1=1
end
return result1
end
function EditPad()
local mr=AddressList.getSelectedRecord()
--print(mr.Script)
local sl=createStringList()
sl.Text=mr.Script
--print(mr.Script)
local path1=pathtbl[1]
path=editPath(path1,mr.Description)
--print(path)
--printf("initial path=%s", path)
if path then
sl.saveToFile(path)
--progIdx=inputQuery('Select Edit Program', pthText, progIdx)
progIdx=tonumber(1)
--if progIdx==nil then showMessage("Just type the number!")
--else
if progIdx>0 and progIdx<=#progtbl then
if progIdx==1 then
shellExecute(path)
else
prg1=progtbl[progIdx][1]
shellExecute(prg1,shellExecute(path))
--print(progtbl[progIdx][1])
end
sleep(200)
prog1=getForegroundProcess() or getProcessIDFromProcessName(progtbl[progIdx][2])
--print(1,prog1)
if Thread1 then Thread1.Destroy() Thread1=nil end
Thread1=createTimer() Thread1.Interval=1100
Thread1.Enabled=true
Thread1.OnTimer=function()
aa=LaunchCommandAndWait(prog1)
if aa==0 then
sl.loadFromFile(path)
mr.Script=sl.Text
sl.destroy()
--print(mr.Script)
os.remove(path)
Thread1.Enabled=false
return true
end
end
end
end
--end
end
local mm = al.Parent.PopupMenu
if nm==nil then
nm = createMenuItem(mm)
nm.Caption = "Edit in Sublime Text"
menuItem_setShortcut(nm, "Ctrl+E")
nm.OnClick = EditPad
mm.Items.insert(15,nm)
end
if oldOnPopup==nil then
oldOnPopup=mm.OnPopup
mm.OnPopup=function(sender)
nm.Visible=al.SelCount>0
oldOnPopup(sender)
end
end
|
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 33
Joined: 16 Feb 2017 Posts: 1298
|
Posted: Thu Apr 18, 2024 12:14 pm Post subject: |
|
|
1 - Quote: | It is enough to save the changes to apply them to the script. ...: |
This ensures that the "Sublime Text" program still stays open! (And automatically see the answer to your 4th question.)
2 - Quote: | Double clicking on the script will open the script in the external editor (predefined in the script). |
I didn't find this appropriate at all! There is always a doubt and they want to double click and open the original script to see it.
This view (idea) is on hold for now!
3 -
No changes were made because "Input" was canceled in the code and the table and table-related codes were edited. Now only one editor is active.
4 - Quote: | Temporary files are deleted after the script is saved. |
Question #1 and the solution will contradict this question or idea.
The reason is; When saving, the "description.CEA" file will be automatically deleted and the code will still be available independently in the "Sublime Text" interface.
Sublime Text will give you a warning message when you want to edit the same script again!
5 -
Don't think too complicated about this idea.
Editing results do not affect the script name in the Address List.
(Or I didn't quite understand what you wanted to say.)
Here is the code example that changes the script after "Register" without rule 2 and 5.
(Now that I remember! It is actually possible to delete description.CEA after the Sublime Text program is closed.)
Code: | local result1=1
al = getAddressList()
pathOrg=getCheatEngineDir()
local pathtbl={pathOrg.."editing-ceaascripts"}
local progtbl={[["C:\Program Files\Sublime Text\sublime_text.exe"]],[[sublime_text.exe]]}
local progMem = 0
function pathBytesMemory(path)
local fileName = path
local file = assert(io.open(fileName, 'rb'))
local t = {}
repeat
local str = file:read(4*1024)
for c in (str or ''):gmatch'.' do
t[#t+1] = c:byte()
end
until not str
file:close()
print(#t)
return #t
end
function editPath(ePath,editName)
local path = ePath
lfs.mkdir(path) --assume it works, or it already exists
path1=path.."\\"..editName..".CEA"
return path1
end
function LaunchCommandAndWait(command)
local proc=getProcessList()[tonumber(command)]
--print(proc)
if proc==nil then
result1=0
else
result1=1
end
return result1
end
function EditPad()
local mr=AddressList.getSelectedRecord()
--print(mr.Script)
local sl=createStringList()
sl.Text=mr.Script
--print(mr.Script)
local path1=pathtbl[1]
path=editPath(path1,mr.Description)
--print(path)
--printf("initial path=%s", path)
if path then
sl.saveToFile(path)
--progIdx=inputQuery('Select Edit Program', pthText, progIdx)
progIdx=tonumber(1)
--if progIdx==nil then showMessage("Just type the number!")
--else
if progIdx>0 and progIdx<=#progtbl then
if progIdx==1 then
shellExecute(path)
else
prg1=progtbl[1]
shellExecute(prg1,shellExecute(path))
-- original file memory:
end
sleep(200)
progMem = pathBytesMemory(path)
--print(progMem)
if Thread1 then Thread1.Destroy() Thread1=nil end
Thread1=createTimer() Thread1.Interval=1100
Thread1.Enabled=true
Thread1.OnTimer=function()
aa=pathBytesMemory(path)
--print(aa .. " >> " .. progMem)
if aa~=progMem then
sl.loadFromFile(path)
mr.Script=sl.Text
--print(mr.Script)
sl.destroy()
--print(aa .. " >> " .. progMem)
progMem = pathBytesMemory(path)
os.remove(path)
Thread1.Enabled=false
return true
end
end
end
end
--end
end
local mm = al.Parent.PopupMenu
if nm then nm.Destroy() nm=nil end
nm = createMenuItem(mm)
nm.Caption = "Edit in Sublime Text"
menuItem_setShortcut(nm, "Ctrl+E")
nm.OnClick = EditPad
mm.Items.insert(15,nm)
if oldOnPopup==nil then
oldOnPopup=mm.OnPopup
mm.OnPopup=function(sender)
nm.Visible=al.SelCount>0
oldOnPopup(sender)
end
end
|
_________________
|
|
Back to top |
|
|
Game Hacking Dojo Advanced Cheater Reputation: 0
Joined: 17 Sep 2023 Posts: 70
|
Posted: Thu Apr 18, 2024 1:12 pm Post subject: |
|
|
Thank you
I just tried the code you provided thank you, that did help solve some issues. However, I got a new issue afterwards, the Lua engine window appeared showing the character count, which can't be closed unless the script is saved or closed, within Sublime Text.
Another thing to point out, is it possible that the script temp file is not deleted until Sublime Text is closed? (The issue is when saving the file the script is deleted, making it a bit less convenient than having the ability to edit it while it is open in Sublime Text)
I asked for a way to call it using double-clicking since it's way better to use Sublime Text than the original script editor. And to make Sublime Text the default environment, since it's superior. And of course, keeping the option to use the CE AA script editor using the context menu option which is already available.
What I meant by file naming was that if my script description contained any of the invalid characters the script doesn't open because of an invalid character that can't be used to name a file in Windows. My script name contained a question mark which is an invalid character. Thus the external editor didn't launch giving the following error:
"Error:...eat Engine 7.5\autorun\redirectAAscriptEditorCEForum.lua:11: C:\Program Files\Cheat Engine 7.5\editing-ceaascripts\Character Change?.CEA: Invalid argument"
Please could you at least add the part that replaces the default editor when double-clicking as a comment so whoever copies the snippet will be using your idea/version of the code?
Thank you again
P.S:
Yes true as you mentioned it's not a good idea to delete the temp files right after saving. However, I think they weren't being removed when I closed the tab or upon closing Sublime Text. It's definitely best if you could make it behave like a normal text file and whenever the tab is closed the temp files get deleted.
Description: |
|
Filesize: |
329.04 KB |
Viewed: |
471 Time(s) |
|
Description: |
|
Filesize: |
28.3 KB |
Viewed: |
480 Time(s) |
|
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 33
Joined: 16 Feb 2017 Posts: 1298
|
Posted: Thu Apr 18, 2024 4:05 pm Post subject: |
|
|
OK, I re-edited the code.
Here are some exceptions and fixes:
1) Added a filter function for invalid characters in the file name;
( https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file )
You can add more characters here.
Code: | function invalName(name)
str = [["\\/:*?\"<>|"]]
str:gsub(".", function(c)
if string.find(name,c) then
name = name:gsub(c,"_")
end
end)
return name
end |
2) When Sublime Text is closed, the saved editing file (CEA) will be deleted.
3) Added code to the script that directs the double-click option to Sublime Text.
Code: | active={}
AddressList.OnAutoAssemblerEdit=function(al,mr)
if active[mr.ID] then return true end --already editing
EditPad()
end |
4) The part that gives an error message when double-clicking to edit and closing Sublime Text without editing (Saving) has been stabilized.
"No such file or directory" = stable now.
5) This option is optional, but I added a code that automatically closes Sublime Text when the CEA file is deleted after the edit save.
Otherwise, Sublime Text will remain open with a non-existent file.
The final version of the code;
Code: | local result1=1
al = getAddressList()
pathOrg=getCheatEngineDir()
local pathtbl={pathOrg.."editing-ceaascripts"}
local progtbl={[["C:\Program Files\Sublime Text\sublime_text.exe"]],[[sublime_text.exe]]}
local progMem = 0
local active={} -- open check script
function pathBytesMemory(path)
local fileName = path
if fileName~=nil then
local file = assert(io.open(fileName, 'rb'))
local t = {}
repeat
local str = file:read(4*1024)
for c in (str or ''):gmatch'.' do
t[#t+1] = c:byte()
end
until not str
file:close()
--print(#t)
return #t
end
end
function editPath(ePath,editName)
local path = ePath
lfs.mkdir(path) --assume it works, or it already exists
path1=path.."\\"..editName..".CEA"
return path1
end
function invalName(name)
str = [["\\/:*?\"<>|"]]
str:gsub(".", function(c)
if string.find(name,c) then
name = name:gsub(c,"_")
end
end)
return name
end
function EditPad()
local mr=AddressList.getSelectedRecord()
--print(mr.Script)
local sl=createStringList()
sl.Text=mr.Script
--print(mr.Script)
local path1=pathtbl[1]
path=editPath(path1,invalName(mr.Description))
--print(path)
--printf("initial path=%s", path)
if path then
sl.saveToFile(path)
--progIdx=inputQuery('Select Edit Program', pthText, progIdx)
progIdx=tonumber(1)
--if progIdx==nil then showMessage("Just type the number!")
--else
if progIdx>0 and progIdx<=#progtbl then
if progIdx==1 then
shellExecute(path)
else
prg1=progtbl[1]
shellExecute(prg1,shellExecute(path))
-- original file memory:
end
sleep(200)
progMem = pathBytesMemory(path)
--print(progMem)
if Thread1 then Thread1.Destroy() Thread1=nil end
Thread1=createTimer() Thread1.Interval=1100
Thread1.Enabled=true
Thread1.OnTimer=function()
aa=pathBytesMemory(path)
--print(aa .. " >> " .. progMem)
pd1 = getProcessIDFromProcessName(progtbl[2])
if pd1==nil then os.remove(path) Thread1.Enabled=false end
if aa~=progMem then
sl.loadFromFile(path)
mr.Script=sl.Text
--print(mr.Script)
sl.destroy()
--print(aa .. " >> " .. progMem)
shellExecute('taskkill', '/PID '..pd1)
progMem = pathBytesMemory(path)
os.remove(path)
Thread1.Enabled=false
return true
end
end
end
end
--end
end
local mm = al.Parent.PopupMenu
if nm then nm.Destroy() nm=nil end
nm = createMenuItem(mm)
nm.Caption = "Edit in Sublime Text"
menuItem_setShortcut(nm, "Ctrl+E")
nm.OnClick = EditPad
mm.Items.insert(15,nm)
if oldOnPopup==nil then
oldOnPopup=mm.OnPopup
mm.OnPopup=function(sender)
nm.Visible=al.SelCount>0
oldOnPopup(sender)
end
end
AddressList.OnAutoAssemblerEdit=function(al,mr)
--print(mr.ID)
-- print("editing aa script")
if active[mr.ID] then return true end --already editing
EditPad()
end |
_________________
|
|
Back to top |
|
|
Game Hacking Dojo Advanced Cheater Reputation: 0
Joined: 17 Sep 2023 Posts: 70
|
Posted: Thu Apr 18, 2024 4:52 pm Post subject: |
|
|
Thank you very much that is pretty much what I wanted. I commented out two lines that would make it perfect for me; Sublime Text stays up and the files stay available until Sublime Text is closed.
by commenting out the following lines:
Code: |
--shellExecute('taskkill', '/PID '..pd1)
--os.remove(path)
|
So the code would be like the following:
And of course, thank you AylinCE again.
Code: |
local result1=1
al = getAddressList()
pathOrg=getCheatEngineDir()
local pathtbl={pathOrg.."editing-ceaascripts"}
local progtbl={[["C:\Program Files\Sublime Text\sublime_text.exe"]],[[sublime_text.exe]]}
local progMem = 0
local active={} -- open check script
function pathBytesMemory(path)
local fileName = path
if fileName~=nil then
local file = assert(io.open(fileName, 'rb'))
local t = {}
repeat
local str = file:read(4*1024)
for c in (str or ''):gmatch'.' do
t[#t+1] = c:byte()
end
until not str
file:close()
--print(#t)
return #t
end
end
function editPath(ePath,editName)
local path = ePath
lfs.mkdir(path) --assume it works, or it already exists
path1=path.."\\"..editName..".CEA"
return path1
end
function invalName(name)
str = [["\\/:*?\"<>|"]]
str:gsub(".", function(c)
if string.find(name,c) then
name = name:gsub(c,"_")
end
end)
return name
end
function EditPad()
local mr=AddressList.getSelectedRecord()
--print(mr.Script)
local sl=createStringList()
sl.Text=mr.Script
--print(mr.Script)
local path1=pathtbl[1]
path=editPath(path1,invalName(mr.Description))
--print(path)
--printf("initial path=%s", path)
if path then
sl.saveToFile(path)
--progIdx=inputQuery('Select Edit Program', pthText, progIdx)
progIdx=tonumber(1)
--if progIdx==nil then showMessage("Just type the number!")
--else
if progIdx>0 and progIdx<=#progtbl then
if progIdx==1 then
shellExecute(path)
else
prg1=progtbl[1]
shellExecute(prg1,shellExecute(path))
-- original file memory:
end
sleep(200)
progMem = pathBytesMemory(path)
--print(progMem)
if Thread1 then Thread1.Destroy() Thread1=nil end
Thread1=createTimer() Thread1.Interval=1100
Thread1.Enabled=true
Thread1.OnTimer=function()
aa=pathBytesMemory(path)
--print(aa .. " >> " .. progMem)
pd1 = getProcessIDFromProcessName(progtbl[2])
if pd1==nil then os.remove(path) Thread1.Enabled=false end
if aa~=progMem then
sl.loadFromFile(path)
mr.Script=sl.Text
--print(mr.Script)
sl.destroy()
--print(aa .. " >> " .. progMem)
--shellExecute('taskkill', '/PID '..pd1)
progMem = pathBytesMemory(path)
--os.remove(path)
Thread1.Enabled=false
return true
end
end
end
end
--end
end
local mm = al.Parent.PopupMenu
if nm then nm.Destroy() nm=nil end
nm = createMenuItem(mm)
nm.Caption = "Edit in Sublime Text"
menuItem_setShortcut(nm, "Ctrl+E")
nm.OnClick = EditPad
mm.Items.insert(15,nm)
if oldOnPopup==nil then
oldOnPopup=mm.OnPopup
mm.OnPopup=function(sender)
nm.Visible=al.SelCount>0
oldOnPopup(sender)
end
end
AddressList.OnAutoAssemblerEdit=function(al,mr)
--print(mr.ID)
-- print("editing aa script")
if active[mr.ID] then return true end --already editing
EditPad()
end |
P.S:
After reading and using the code I noticed that as long as Sublime Text is open the only temp file that is going to be deleted is whatever the last saved/open file was. Is it possible to delete every file in the folder when Sublime Text is closed?
I was thinking of using something like this. I am the noobest person at using Lua but I thought maybe this would solve it but did not try it:
Code: |
pd1 = getProcessIDFromProcessName(progtbl[2])
if pd1==nil then os.remove(pathtbl) Thread1.Enabled=false end
|
I am not sure if that will work I am afraid of trying since I might end up deleting the CE directory instead.
Thank you I solved it. And this is hopefully the final version
Code: |
local result1=1
al = getAddressList()
pathOrg=getCheatEngineDir()
local pathtbl={pathOrg.."Script-Temp"}
local progtbl={[["C:\Program Files\Sublime Text\sublime_text.exe"]],[[sublime_text.exe]]}
local progMem = 0
local active={} -- open check script
function pathBytesMemory(path)
local fileName = path
if fileName~=nil then
local file = assert(io.open(fileName, 'rb'))
local t = {}
repeat
local str = file:read(4*1024)
for c in (str or ''):gmatch'.' do
t[#t+1] = c:byte()
end
until not str
file:close()
--print(#t)
return #t
end
end
function editPath(ePath,editName)
local path = ePath
lfs.mkdir(path) --assume it works, or it already exists
path1=path.."\\"..editName..".CEA"
return path1
end
function invalName(name)
str = [["\\/:*?\"<>|"]]
str:gsub(".", function(c)
if string.find(name,c) then
name = name:gsub(c,"_")
end
end)
return name
end
function EditPad()
local mr=AddressList.getSelectedRecord()
--print(mr.Script)
local sl=createStringList()
sl.Text=mr.Script
--print(mr.Script)
local path1=pathtbl[1]
local deleteContent = 'del /q "' .. path1 .. '" > nul'
--print(path1)
path=editPath(path1,invalName(mr.Description))
--print(path)
--printf("initial path=%s", path)
if path then
sl.saveToFile(path)
--progIdx=inputQuery('Select Edit Program', pthText, progIdx)
progIdx=tonumber(1)
--if progIdx==nil then showMessage("Just type the number!")
--else
if progIdx>0 and progIdx<=#progtbl then
if progIdx==1 then
shellExecute(path)
else
prg1=progtbl[1]
shellExecute(prg1,shellExecute(path))
-- original file memory:
end
sleep(200)
progMem = pathBytesMemory(path)
--print(progMem)
if Thread1 then Thread1.Destroy() Thread1=nil end
Thread1=createTimer() Thread1.Interval=1100
Thread1.Enabled=true
Thread1.OnTimer=function()
aa=pathBytesMemory(path)
--print(aa .. " >> " .. progMem)
pd1 = getProcessIDFromProcessName(progtbl[2])
--if pd1==nil then os.remove(path) Thread1.Enabled=false end
if pd1==nil then os.execute(deleteContent) Thread1.Enabled=false end
if aa~=progMem then
sl.loadFromFile(path)
mr.Script=sl.Text
--print(mr.Script)
sl.destroy()
--print(aa .. " >> " .. progMem)
--shellExecute('taskkill', '/PID '..pd1)
progMem = pathBytesMemory(path)
--os.remove(path)
Thread1.Enabled=false
return true
end
end
end
end
--end
end
local mm = al.Parent.PopupMenu
if nm then nm.Destroy() nm=nil end
nm = createMenuItem(mm)
nm.Caption = "Edit in Sublime Text"
menuItem_setShortcut(nm, "Ctrl+E")
nm.OnClick = EditPad
mm.Items.insert(15,nm)
if oldOnPopup==nil then
oldOnPopup=mm.OnPopup
mm.OnPopup=function(sender)
nm.Visible=al.SelCount>0
oldOnPopup(sender)
end
end
AddressList.OnAutoAssemblerEdit=function(al,mr)
--print(mr.ID)
-- print("editing aa script")
if active[mr.ID] then return true end --already editing
EditPad()
end
|
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 33
Joined: 16 Feb 2017 Posts: 1298
|
Posted: Thu Apr 18, 2024 6:02 pm Post subject: |
|
|
See the code layout order and change the code shown within the "EditPad()" function.
Code: | function scandir(directory)
local i, t, popen = 0, {}, io.popen
local pfile = popen('dir "'..directory..'" /b')
for filename in pfile:lines() do
i = i + 1
t[i] = filename
end
pfile:close()
return t
end
function deleteAllFiles(path)
aa2 = scandir(path)
for i,k in pairs(aa2) do
aa3 = extractFileExt(path..k)
if aa3==".CEA" then
--print(k)
os.remove(path..k)
end
end
end
function EditPad()
-- ...
-- ...
pd1 = getProcessIDFromProcessName(progtbl[2])
if pd1==nil then deleteAllFiles(pathtbl.."\\") Thread1.Enabled=false end
-- ...
-- ...
end |
_________________
|
|
Back to top |
|
|
Game Hacking Dojo Advanced Cheater Reputation: 0
Joined: 17 Sep 2023 Posts: 70
|
Posted: Fri Apr 19, 2024 4:20 am Post subject: |
|
|
Thank you that worked better, since it does not summon the CMD.
But it needed a small fix
"pathtbl" had to be "path1"
Code: |
pd1 = getProcessIDFromProcessName(progtbl[2])
if pd1==nil then deleteAllFiles(path1.."\\") Thread1.Enabled=false end |
And here is the code for everyone to get:
Code: | local result1=1
al = getAddressList()
pathOrg=getCheatEngineDir()
local pathtbl={pathOrg.."Script-Temp"}
local progtbl={[["C:\Program Files\Sublime Text\sublime_text.exe"]],[[sublime_text.exe]]}
local progMem = 0
local active={} -- open check script
function pathBytesMemory(path)
local fileName = path
if fileName~=nil then
local file = assert(io.open(fileName, 'rb'))
local t = {}
repeat
local str = file:read(4*1024)
for c in (str or ''):gmatch'.' do
t[#t+1] = c:byte()
end
until not str
file:close()
--print(#t)
return #t
end
end
function editPath(ePath,editName)
local path = ePath
lfs.mkdir(path) --assume it works, or it already exists
path1=path.."\\"..editName..".CEA"
return path1
end
function invalName(name)
str = [["\\/:*?\"<>|"]]
str:gsub(".", function(c)
if string.find(name,c) then
name = name:gsub(c,"_")
end
end)
return name
end
function scandir(directory)
local i, t, popen = 0, {}, io.popen
local pfile = popen('dir "'..directory..'" /b')
for filename in pfile:lines() do
i = i + 1
t[i] = filename
end
pfile:close()
return t
end
function deleteAllFiles(path)
aa2 = scandir(path)
for i,k in pairs(aa2) do
aa3 = extractFileExt(path..k)
if aa3==".CEA" then
--print(k)
os.remove(path..k)
end
end
end
function EditPad()
local mr=AddressList.getSelectedRecord()
--print(mr.Script)
local sl=createStringList()
sl.Text=mr.Script
--print(mr.Script)
local path1=pathtbl[1]
--local deleteContent = 'rmdir /s /q "' .. path1 .. '" > nul'
local deleteContent = 'del /q "' .. path1 .. '" > nul'
--print(path1)
path=editPath(path1,invalName(mr.Description))
--print(path)
--printf("initial path=%s", path)
if path then
sl.saveToFile(path)
--progIdx=inputQuery('Select Edit Program', pthText, progIdx)
progIdx=tonumber(1)
--if progIdx==nil then showMessage("Just type the number!")
--else
if progIdx>0 and progIdx<=#progtbl then
if progIdx==1 then
shellExecute(path)
else
prg1=progtbl[1]
shellExecute(prg1,shellExecute(path))
-- original file memory:
end
sleep(200)
progMem = pathBytesMemory(path)
--print(progMem)
if Thread1 then Thread1.Destroy() Thread1=nil end
Thread1=createTimer() Thread1.Interval=1100
Thread1.Enabled=true
Thread1.OnTimer=function()
aa=pathBytesMemory(path)
--print(aa .. " >> " .. progMem)
pd1 = getProcessIDFromProcessName(progtbl[2])
--if pd1==nil then os.remove(path) Thread1.Enabled=false end
--if pd1==nil then os.execute(deleteContent) Thread1.Enabled=false end
if pd1==nil then deleteAllFiles(path1.."\\") Thread1.Enabled=false end
if aa~=progMem then
sl.loadFromFile(path)
mr.Script=sl.Text
--print(mr.Script)
sl.destroy()
--print(aa .. " >> " .. progMem)
--shellExecute('taskkill', '/PID '..pd1)
progMem = pathBytesMemory(path)
--os.remove(path)
Thread1.Enabled=false
return true
end
end
end
end
--end
end
local mm = al.Parent.PopupMenu
if nm then nm.Destroy() nm=nil end
nm = createMenuItem(mm)
nm.Caption = "Edit in Sublime Text"
menuItem_setShortcut(nm, "Ctrl+E")
nm.OnClick = EditPad
mm.Items.insert(15,nm)
if oldOnPopup==nil then
oldOnPopup=mm.OnPopup
mm.OnPopup=function(sender)
nm.Visible=al.SelCount>0
oldOnPopup(sender)
end
end
AddressList.OnAutoAssemblerEdit=function(al,mr)
--print(mr.ID)
-- print("editing aa script")
if active[mr.ID] then return true end --already editing
EditPad()
end |
|
|
Back to top |
|
|
Game Hacking Dojo Advanced Cheater Reputation: 0
Joined: 17 Sep 2023 Posts: 70
|
Posted: Sun Apr 21, 2024 7:09 am Post subject: |
|
|
After trying the version of the Lua script for some time I found an issue.
When I open the script in Sublime Text and edit a letter without adding or removing anything, or keeping the same character count, the script does not save the changes, unless I change the character count (by adding or removing characters) and save.
Is there a way to solve this issue?
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|