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 


OpenFileDialog does not attach process ? [Solved]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 152

PostPosted: Tue Sep 07, 2021 12:11 pm    Post subject: OpenFileDialog does not attach process ? [Solved] Reply with quote

see info here: [ https://imgur.com/a/HjpmexY ]

when i attach the game via 'openfiledialog' (either double-clicking or select 'Open'), the process will not attach properly most of the time. (seems like a 50/50% chance)
if i then attach manually (via File menu) or do another 'openfiledialog', it will always attach properly.
Note: CE does find the correct procId initially; just the 'process' variable (?) remains nil, it seems (just guessing here)

this is more of an annoyance then anything else, but perhaps there is some elegant workaround?!


Last edited by paul44 on Wed Sep 08, 2021 12:00 pm; edited 1 time in total
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1053
Location: 0x90

PostPosted: Tue Sep 07, 2021 1:28 pm    Post subject: Reply with quote

Update to 7.3
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

Joined: 09 May 2003
Posts: 25262
Location: The netherlands

PostPosted: Tue Sep 07, 2021 2:14 pm    Post subject: Reply with quote

after creating a process you'll have to wait for it to properly load
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
paul44
Expert Cheater
Reputation: 2

Joined: 20 Jul 2017
Posts: 152

PostPosted: Wed Sep 08, 2021 11:58 am    Post subject: compare process versus openDialog_name... Reply with quote

this seems to do the trick. while testing, did print_checks of 'process' and it seemed to "complete loading" between 2~5 secs...
detail: on 1 occassion, it still "failed" (although uncertain about its cause), which is why i've added the additional 'openprocess'.
(did 5~6 reboot tests - only way to be sure - with success)

[code]if ( bCorrectProc == '9' ) then
openProcess(myGame)
while process ~= myGame do
openProcess(myGame)
sleep(1000)
end
openProcess(myGame)
end[/code]

ps: did some googling on "how to check when program is fully loaded", and one suggestion @stackoverflow talked about "enumerating windows" ~ which made me think about the 'enumModules()' function.
did some 'print(enumModules()[1].Name)' as well, and indeed one does get the proper name upon successfull load?! unfortunately, in the while loop it gives me a 'index nil value' error. tried it with procId, but that kept giving me a nil value. and since i already got a solution...
Back to top
View user's profile Send private message
Birdi
Expert Cheater
Reputation: 0

Joined: 08 Jun 2020
Posts: 122
Location: Migrating

PostPosted: Wed Sep 08, 2021 3:09 pm    Post subject: Reply with quote

You can just toss in a case for "if procId ~= nil" to skip over execution and sleep some, until it's not? Just an idea.

Not sure if it's supported in CE's lua, but you can try a repeat-until loop as well? Not home to test it right now.

_________________
Trying to learn!

Add me on Discord if you want hands-on help: Birdi#0007
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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