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 


CT Name And Decimal PID
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions
View previous topic :: View next topic  
Author Message
mgr.inz.Player
I post too much
Reputation: 217

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Jul 28, 2016 12:43 pm    Post subject: CT Name And Decimal PID This post has 1 review(s) Reply with quote

Features:
- current cheat table name. Something similar to "project name" known from other applications.
- decimal process ID
- popup menus - you can copy file name, file full path, decimal PID to the clipboard.





Just place it in autorun folder.


Script:
Code:
local mf = getMainForm()
local sd = mf.SaveDialog1
local od = mf.OpenDialog1
local filefullpath
local filename
local mi

local function returnFileName(path)
 --extracts file name from full path (not full path => return nil)
 return (path~=nil) and (path:match("\\([^\\]+)$"))
end

-- currentTableNameLabel
local currentTableNameLabel = createLabel(mf)
currentTableNameLabel.Name = 'currentTableNameLabel'
currentTableNameLabel.Caption = ''
currentTableNameLabel.Font.Assign(mf.foundcountlabel.Font)
currentTableNameLabel.Parent = mf.Panel5
currentTableNameLabel.AnchorSideLeft.Control = mf.foundcountlabel
currentTableNameLabel.AnchorSideLeft.Side = asrBottom
currentTableNameLabel.AnchorSideTop.Control = mf.foundcountlabel
currentTableNameLabel.AnchorSideTop.Side = asrCenter
currentTableNameLabel.BorderSpacing.Left = 20
currentTableNameLabel.ShowHint = true
currentTableNameLabel.PopupMenu=createPopupMenu(currentTableNameLabel)

mi = createMenuItem(currentTableNameLabel.PopupMenu)
currentTableNameLabel.PopupMenu.Items.add(mi)
mi.Caption="cheat table file name - copy to clipboard"
mi.OnClick=function () writeToClipboard(filename) end

mi = createMenuItem(currentTableNameLabel.PopupMenu)
currentTableNameLabel.PopupMenu.Items.add(mi)
mi.Caption="cheat table file full path - copy to clipboard"
mi.OnClick=function () writeToClipboard(filefullpath) end

-- decimalPIDLabel
local decimalPIDLabel = createLabel(mf)
decimalPIDLabel.Name = 'decimalPIDLabel'
decimalPIDLabel.Caption = ''
decimalPIDLabel.Font.Assign(mf.ProcessLabel.Font)
decimalPIDLabel.Parent = mf.Panel5
decimalPIDLabel.AnchorSideLeft.Control = mf.ProcessLabel
decimalPIDLabel.AnchorSideLeft.Side = asrBottom
decimalPIDLabel.AnchorSideTop.Control = mf.ProcessLabel
decimalPIDLabel.AnchorSideTop.Side = asrCenter
decimalPIDLabel.BorderSpacing.Left = 5
decimalPIDLabel.PopupMenu=createPopupMenu(decimalPIDLabel)

mi = createMenuItem(decimalPIDLabel.PopupMenu)
decimalPIDLabel.PopupMenu.Items.add(mi)
mi.Caption="decimal PID - copy to clipboard"
mi.OnClick=function () writeToClipboard(decimalPIDLabel.Caption:sub(2,-2)) end

-- change ProcessLabel positioning
mf.ProcessLabel.Anchors = '[akTop,akLeft]'
mf.ProcessLabel.AnchorSideLeft.Control = mf.Panel5
mf.ProcessLabel.AnchorSideLeft.Side = asrCenter


-- updateLabelsCaptionsTimer
local updateLabelsCaptionsTimer = createTimer(mf)
updateLabelsCaptionsTimer.Interval = 500
updateLabelsCaptionsTimer.OnTimer = function (t)
  filefullpath = sd.Filename or od.Filename or ''
  filename = returnFileName(filefullpath)
  currentTableNameLabel.Hint = filefullpath

  if filename then currentTableNameLabel.Caption = 'CT Name: '..filename
              else currentTableNameLabel.Caption = 'CT Name:' end

  local OpenedProcessID = getOpenedProcessID()
  decimalPIDLabel.Caption = (OpenedProcessID==4294967295) and '' or ('('..OpenedProcessID..')')
end




Below file contains (up do date ) script.



currentCTNameAndDecimalPID.lua
 Description:

Download
 Filename:  currentCTNameAndDecimalPID.lua
 Filesize:  2.87 KB
 Downloaded:  1409 Time(s)


_________________


Last edited by mgr.inz.Player on Sun Apr 12, 2020 9:39 am; edited 3 times in total
Back to top
View user's profile Send private message MSN Messenger
panraven
Grandmaster Cheater
Reputation: 54

Joined: 01 Oct 2008
Posts: 938

PostPosted: Thu Jul 28, 2016 1:40 pm    Post subject: Reply with quote

Thank you~

May be replacing timer with CommonDialog's OnClose event?
It seems sd.FileName will contain filename of the CT executing from the Explorer.

btw, using event then the caption trail with os.date'%X' will show the last save/load time.

_________________
- Retarded.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 217

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Jul 28, 2016 3:05 pm    Post subject: Reply with quote

Unfortunately there's no dialog result exposed to lua:
Code:
local mf = getMainForm()
local sd = mf.SaveDialog1

print( getPropertyList(sd).Text )

Name
Tag
HelpContext
Width
Height
Title
DefaultExt
FileName
Filter
FilterIndex
InitialDir
Options


We can not check (inside OnClose event) if dialog was cancelled.


But. I can use OnClose event to enable the timer at right moment and only when it is needed.
Timer will disable itself after updating a label. First post updated with new file.


Edit:
Removed not needed source. It's in first post anyway.

_________________


Last edited by mgr.inz.Player on Sun Oct 30, 2016 12:54 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
panraven
Grandmaster Cheater
Reputation: 54

Joined: 01 Oct 2008
Posts: 938

PostPosted: Thu Jul 28, 2016 3:57 pm    Post subject: Reply with quote

It seems the original timer method update the label correctly in the right time.
But event base method may have a delay(?) in case of asking user to merge 2 table.

_________________
- Retarded.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 217

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Jul 28, 2016 4:23 pm    Post subject: Reply with quote

I see.

When you click YES in "do you wish to merge" window:
- file name is correct, because you added stuff to existing CT file from other CT
- time is wrong

When you click NO in "do you wish to merge" window:
- file name is wrong, you just opened other CT file
- time is correct



Also, pressing CTRL+S do not update the time. I have to dig more.

_________________
Back to top
View user's profile Send private message MSN Messenger
jaejunks
How do I cheat?
Reputation: 0

Joined: 29 May 2016
Posts: 4

PostPosted: Sat Jan 21, 2017 9:20 am    Post subject: Reply with quote

I think I've fixed the table name not get updated after opening a different table.

I've removed some of the code lines since they aren't necessary, and shorten the timer interval so that the name update is more snappy.



currentCheatTableName.lua
 Description:

Download
 Filename:  currentCheatTableName.lua
 Filesize:  1.24 KB
 Downloaded:  2025 Time(s)

Back to top
View user's profile Send private message
jaejunks
How do I cheat?
Reputation: 0

Joined: 29 May 2016
Posts: 4

PostPosted: Thu Jan 26, 2017 6:43 am    Post subject: Reply with quote

Script update:

- Added label tooltip to display table full file path.

- Made the "Delete all addresses from the list" button prompts user to clear the table name if there's a table currently loaded.

The second one is mainly to prevent the Save menu item from accidental overwriting of a possibly good table file because both the menu and the button don't clear the table file name that was previously loaded or saved.

I haven't managed to apply the second modification to the Save menu item (the `New1` component) because somehow, changes to its OnClick property seems to be ineffective. i.e. the newly assigned handler is never called. Anyone can shed some lights on this?



currentCheatTableName.lua
 Description:

Download
 Filename:  currentCheatTableName.lua
 Filesize:  1.9 KB
 Downloaded:  2061 Time(s)

Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 217

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Thu Jan 26, 2017 8:04 am    Post subject: Reply with quote

Hi, I'll check your modifications later.
_________________
Back to top
View user's profile Send private message MSN Messenger
mgr.inz.Player
I post too much
Reputation: 217

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sun Apr 12, 2020 9:41 am    Post subject: Reply with quote

updated
_________________
Back to top
View user's profile Send private message MSN Messenger
DaSpamer
Grandmaster Cheater Supreme
Reputation: 52

Joined: 13 Sep 2011
Posts: 1578

PostPosted: Sun Apr 12, 2020 4:27 pm    Post subject: Reply with quote

Don't know how I missed this, this is awesome, thanks mate! saved so much time Smile
_________________
HEY Hitler
Do you get lazy when making trainers?
Well no more!
My CETrainer will generate it for you in seconds, so you won't get lazy! Very Happy

http://forum.cheatengine.org/viewtopic.php?t=564919
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sun Apr 12, 2020 11:37 pm    Post subject: Reply with quote

Maybe better-using getMainForm.Caption ?.

Something like (need to be fixs):

Code:
local mf = getMainForm()
local sd = mf.SaveDialog1
local od = mf.OpenDialog1
local filefullpath
local filename
local decimalPIDLabel

local function returnFileName(path)
 --extracts file name from full path (not full path => return nil)
 return (path~=nil) and (path:match("\\([^\\]+)$"))
end

local updateLabelsCaptionsTimer = createTimer(mf)
updateLabelsCaptionsTimer.Interval = 500
updateLabelsCaptionsTimer.OnTimer = function (t)
  filefullpath = sd.Filename or od.Filename or ''
  filename = returnFileName(filefullpath)
  local OpenedProcessID = getOpenedProcessID()

 if not filename then
   if OpenedProcessID == nil then
      decimalPIDLabel = ''
     mf.Caption = 'Cheat Engine 7.0'
      return nil
   else
      decimalPIDLabel = string.format('%X',OpenedProcessID)--(OpenedProcessID==4294967295) and '' or ('('..OpenedProcessID..')')
   end
   mf.Caption = 'Cheat Engine - '..filename..' - '..OpenedProcessID..' ('..decimalPIDLabel..')'
   else
     mf.Caption = 'Cheat Engine 7.0 - '..filename
  end
end


Just suggestion. Very Happy

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 217

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Mon Apr 13, 2020 5:48 am    Post subject: Reply with quote

I'm using custom CE which has there git revision info.
Also I have other extensions which adds some other infos and stats to the main form caption: 64bit or 32bit CE, Lua memory usage, etc.

A simple example with only git revision and 32/64 bit info:


You see how many D are in caption and in in label below progressbar.

_________________
Back to top
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Mon Apr 13, 2020 7:53 am    Post subject: Reply with quote

Aha...I see 100 D over there. Okay, then we able to make some changes (custom CE) which asjusted to our needs.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 217

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Mon Apr 13, 2020 8:03 am    Post subject: This post has 1 review(s) Reply with quote

This is why I prefer using additional currentTableNameLabel and decimalPIDLabel labels.
Sometimes I have CT files with very long names, e.g. "dropdownlist looping tester, cheat engine version 6.8.3 commit XXXXXXX.CT" (XXXXXXX - commit SHA)
As you see, it wouldn't fit in CE caption. Of course I can resize main window... but I prefer CE width not bigger than 1/3 of my screen.





Of course you can adjust my script to your needs and post working script here.

_________________
Back to top
View user's profile Send private message MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Mon Apr 13, 2020 9:17 am    Post subject: Reply with quote

I got the reason and thank so much for allow use your script.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
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
Goto page 1, 2  Next
Page 1 of 2

 
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