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 


ReAttach Process

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions
View previous topic :: View next topic  
Author Message
24quant42
Cheater
Reputation: 0

Joined: 19 Apr 2023
Posts: 31

PostPosted: Thu Aug 22, 2024 5:45 pm    Post subject: ReAttach Process Reply with quote

A script to display the process reconnection button.

There are cases when you need to quickly reconnect to the process, since automatic reconnection does not work in the settings, I decided to add a button to the main menu.
The extension is triggered when you first connect to any process, then you can click on the button to reconnect to the process, it's better than opening a window and searching for the process again




Instruction manual:
Create a file in the *.lua format, paste the save script there, into a folder...Cheat Engine/autorun/

Any edits for the better are welcome




Code:

function OnClickReAttachProcess()
   openProcess(process)
end

function makeBtnRetachProcess(mainForm)
   local btn = createButton(mainForm)
   btn.Left = 0
   btn.Top = 0
   btn.Width = 200
   btn.Height = 200
   btn.OnClick = OnClickReAttachProcess
   btn.Caption="ReAttach Process"
   btn.Name="btnRetachProcess"
   --print("Maked BTN")
   return btn
end

function findComponentByName(form, nameFinding)
   for i=0, form.getComponentCount() -1 do
       local component=form.getComponent(i)
       if component.Name==nameFinding then
            return component
       end
   end
   return nil
end

function getFMain()
   for i=0, getFormCount()-1 do
      local mainForm=getForm(i)
      if mainForm.Name=="MainForm" then
          return mainForm
      end
   end
end

function onStart()
    local mainForm=getFMain()
    local componentProcessLabel=findComponentByName(mainForm,"ProcessLabel")

    if componentProcessLabel.Caption ~= "No Process Selected" then
        --print(componentProcessLabel.Caption)

        local btnRetachProcess=findComponentByName(mainForm,"btnRetachProcess")
        if btnRetachProcess then
            --print("YES")
        else
            btnRetachProcess=makeBtnRetachProcess(mainForm)
            local btnMemoryView=findComponentByName(mainForm,"btnMemoryView")
            btnRetachProcess.Left=btnMemoryView.Width+20
            btnRetachProcess.Top=btnMemoryView.Top-15
            btnRetachProcess.Height=btnMemoryView.Height+20
            btnRetachProcess.Width=btnRetachProcess.Width+30
        end

        object_destroy(t1)
    else
        --print(componentProcessLabel.Caption)
    end
end

function prepare()
    t1=createTimer(nil)
    timer_setInterval(t1,1000)
    timer_onTimer(t1,onStart)
end

--Main Function Entry Point

prepare()



11.png
 Description:
 Filesize:  19.77 KB
 Viewed:  3367 Time(s)

11.png


Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites