Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Cheat Engine Forum Index
PostGo back to topic
AylinCE
Grandmaster Cheater Supreme
Reputation: 35
Joined: 16 Feb 2017
Posts: 1478

PostPosted: Fri Apr 29, 2022 3:44 pm    Post subject:

Just an idea.
1) You can report the end of editing to CE by closing Notepad++. Otherwise Notepad++ should not be open.
2) Edit the file path for Notepad++. In my case this code works.
3) Notepad or Notepad++ looks plain in my opinion. Color accents are more useful in the original. (Just an opinion.) Wink
4) To avoid unnecessary garbage in the file, I added a code to delete the file when the editing is finished. Otherwise the folder will be filled with many tmps.
5) Be sure to save the final version of the edit before closing Notepad++.


Code:
local result1=1

function LaunchCommandAndWait(command)
 local proc=getProcessIDFromProcessName(command)
 --print(proc)
  if proc==nil then
   result1=0
   else
   result1=1
  end

  return result1
end

local counter=0

local active={}

AddressList.OnAutoAssemblerEdit=function(al,mr)
 -- print("editing aa script")
  if active[mr.ID] then return true end --already editing

  mr.beginEdit()
 -- print("memrec has been marked as editing")
  local sl=createStringList()
  sl.Text=mr.Script

  local path
  if getTempFolder then
    path=getTempFolder()
  else
    path=getCheatEngineDir()
  end
  lfs.mkdir(path.."editing-ceaascripts") --assume it works, or it already exists
  path=path.."editing-ceaascripts\\"

  --printf("initial path=%s", path)

  local ms=createMemoryStream()
  ms.size=260
  if executeCodeLocalEx("GetTempFileNameA", path,"CEA",0,ms.Memory) ~=0 then
    path=readStringLocal(ms.Memory,260)
    --printf("final path=%s", path)

    ms.destroy()

    --printf("saving script to %s", path)
    sl.saveToFile(path)
    active[mr.ID]=true

      local open=shellExecute([[C:\Program Files\Notepad++\notepad++.exe]],shellExecute(path))
      sleep(200)

      if Thread1 then Thread1.Destroy() Thread1=nil end
      Thread1=createTimer() Thread1.Interval=3100
      Thread1.OnTimer=function()
      aa=LaunchCommandAndWait([[notepad++.exe]]) --..path)

      --print("AA editorthread: Finished waiting")
      if aa==0 then
       sl.loadFromFile(path)
       mr.Script=sl.Text
       --print(sl.Text)
       mr.endEdit()
       sl.destroy()

       active[mr.ID]=nil
       os.remove(path)
       Thread1.Enabled=false
       return true
      end
     -- print("done editing")
    end
    Thread1.Enabled=true
  else
      if Thread1 then Thread1.Destroy() Thread1=nil end
    print("GetTempFileNameA failed")
    sl.destroy()
    ms.destroy()
    return false
  end
end

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Post reviews:   Approve 1
Author Review
++METHOS
Review: Approve
Post reference:
ReviewPosted: Sat Apr 30, 2022 1:20 pm


Back to top
View user's profile Send private message
Display:  
Cheat Engine Forum Index


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites