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 


CEnhancer - Improvements for CE's inbuilt functions
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting -> Lua Extensions
View previous topic :: View next topic  
Author Message
Merlini
Advanced Cheater
Reputation: 2

Joined: 12 Jun 2016
Posts: 53

PostPosted: Thu Oct 20, 2016 5:37 am    Post subject: Reply with quote

predprey wrote:
7. External Editor

Thank you for fulling my request.

How did I not see this post for last 2 weeks!
I've started using it a few hours ago and I've had a very measurable
improvement in concentration and speed in coding.

It could be just me, but I could not originally run the script.

First issue was that mf.Count on line 120 was undefined (mf).
I switcheed that to mainMenu.Count and it seems to work,
but i can't be sure.

Secondly, my editor had problem openning files that had white space
in the path. In particular the "Cheat Engine" temp folder could
not be loaded. So I changed the filePath to something simpler like
"d:/tmp/" and everything is working perfectly.

Again, thank you very much for this script. It is just brilliant.
Back to top
View user's profile Send private message
predprey
Master Cheater
Reputation: 15

Joined: 08 Oct 2015
Posts: 366

PostPosted: Thu Oct 20, 2016 5:50 am    Post subject: Reply with quote

Merlini wrote:
First issue was that mf.Count on line 120 was undefined (mf).
I switcheed that to mainMenu.Count and it seems to work,
but i can't be sure.


yep, it's a bug there, thanks. mf was defined for me due to some other extensions i was using, so CE did not popup an undefined error and i missed it. fixing it now, thanks.

EDIT: turns out the if conditional did not activate for me because i already had an "Extra" menu item added by my other extensions. so it completely skipped the mf line.

Merlini wrote:
Secondly, my editor had problem openning files that had white space
in the path. In particular the "Cheat Engine" temp folder could
not be loaded. So I changed the filePath to something simpler like
"d:/tmp/" and everything is working perfectly.


i used the %TEMP% environment variable to get the temp folder path. are you perhaps not using windows?
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 148

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

PostPosted: Thu Oct 20, 2016 8:07 am    Post subject: This post has 1 review(s) Reply with quote

Try this one:
Code:
      shellExecute(extEditor,'"'..filePath:gsub('"','')..'"')

_________________
Back to top
View user's profile Send private message MSN Messenger
predprey
Master Cheater
Reputation: 15

Joined: 08 Oct 2015
Posts: 366

PostPosted: Thu Oct 20, 2016 8:40 am    Post subject: Reply with quote

mgr.inz.Player wrote:
Try this one:
Code:
      shellExecute(extEditor,'"'..filePath:gsub('"','')..'"')


thank you. adding it now. were you having problems with this line of code too?

EDIT: so this deletes all the quotes in filePath and then enclose the entire string in quotes again?
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 148

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

PostPosted: Thu Oct 20, 2016 9:34 am    Post subject: Reply with quote

predprey wrote:
so this deletes all the quotes in filePath and then enclose the entire string in quotes again?

Yes.

_________________
Back to top
View user's profile Send private message MSN Messenger
predprey
Master Cheater
Reputation: 15

Joined: 08 Oct 2015
Posts: 366

PostPosted: Thu Oct 20, 2016 9:38 am    Post subject: Reply with quote

mgr.inz.Player wrote:
predprey wrote:
so this deletes all the quotes in filePath and then enclose the entire string in quotes again?

Yes.


i didn't have any problem with the original code though. i don't think there were any quotes when i do print(filePath)......was it a problem for you?
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 148

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

PostPosted: Thu Oct 20, 2016 10:04 am    Post subject: Reply with quote



Code:
print( os.getenv("systemvariablewithquotes") )
>"usingquotes"


TMP (and TEMP) variable can also have quotes. This is why I remove it. Just in case.


Final enclosing with " is something what normally installed applications set in the system registry.

For example notepad++, in HKEY_CLASSES_ROOT\Notepad++_file\shell\open\command

I have:
"C:\Users\mgrinzplayer\Desktop\np++\notepad++.exe" "%1"

You see that "%1". This is why. Notepad++ will treat passed string as one argument.

_________________
Back to top
View user's profile Send private message MSN Messenger
predprey
Master Cheater
Reputation: 15

Joined: 08 Oct 2015
Posts: 366

PostPosted: Thu Oct 20, 2016 3:06 pm    Post subject: Reply with quote

oic., that explains it clearly now. thanks.

should i also add a check for both TMP & TEMP to determine which to use, or the current one would suffice retrieving TEMP only?
Back to top
View user's profile Send private message
Merlini
Advanced Cheater
Reputation: 2

Joined: 12 Jun 2016
Posts: 53

PostPosted: Thu Oct 20, 2016 4:24 pm    Post subject: Reply with quote

mgr.inz.Player wrote:
Try this one:
Code:
      shellExecute(extEditor,'"'..filePath:gsub('"','')..'"')


Yep that did it:

Code:
      local filePath = os.getenv("TEMP")..[[\Cheat Engine\]]..extEditing[j.ID].fileName
      local scriptString = createStringlist()
      scriptString.Text = j.Script
      scriptString.saveToFile(filePath)
      extEditing[j.ID].MD5Hash = md5file(filePath)
      filePath = '"'..filePath:gsub('"', '')..'"' -- modified string for gvim
      shellExecute(extEditor,filePath, folderPath)


I think this might be OS/editor dependent so maybe
there is no need to change anything on the main script?
Perhaps having dev note at the beginning of the script and
download is enough.

Thanks.
Back to top
View user's profile Send private message
predprey
Master Cheater
Reputation: 15

Joined: 08 Oct 2015
Posts: 366

PostPosted: Thu Oct 20, 2016 5:01 pm    Post subject: Reply with quote

Merlini wrote:
mgr.inz.Player wrote:
Try this one:
Code:
      shellExecute(extEditor,'"'..filePath:gsub('"','')..'"')


Yep that did it:

Code:
      local filePath = os.getenv("TEMP")..[[\Cheat Engine\]]..extEditing[j.ID].fileName
      local scriptString = createStringlist()
      scriptString.Text = j.Script
      scriptString.saveToFile(filePath)
      extEditing[j.ID].MD5Hash = md5file(filePath)
      filePath = '"'..filePath:gsub('"', '')..'"' -- modified string for gvim
      shellExecute(extEditor,filePath, folderPath)


I think this might be OS/editor dependent so maybe
there is no need to change anything on the main script?
Perhaps having dev note at the beginning of the script and
download is enough.

Thanks.


thanks for the report since i can't test it myself. i will add the fix when i get back from work.
Back to top
View user's profile Send private message
Merlini
Advanced Cheater
Reputation: 2

Joined: 12 Jun 2016
Posts: 53

PostPosted: Thu Oct 27, 2016 7:57 pm    Post subject: Reply with quote

Everything is working perfectly with the new external editor script.



This is quite minor, but how would one go about assigning
a hotkey to the menuitem?

For example, pressing <space> toggles script,
and <enter> opens script. If I wanted to assign <e>
to open the script in an external editor, would this be possible?

Thank you.
Back to top
View user's profile Send private message
predprey
Master Cheater
Reputation: 15

Joined: 08 Oct 2015
Posts: 366

PostPosted: Thu Oct 27, 2016 9:21 pm    Post subject: Reply with quote

Merlini wrote:
Everything is working perfectly with the new external editor script.



This is quite minor, but how would one go about assigning
a hotkey to the menuitem?

For example, pressing <space> toggles script,
and <enter> opens script. If I wanted to assign <e>
to open the script in an external editor, would this be possible?

Thank you.


Code:
getMainForm().PopupMenu2.Items[15].Shortcut = [[Ctrl+E]]


I had a plan to make a shortcut configurator for all menu items in CE, so I omitted binding hotkeys to all my extensions. Unfortunately, it got stuck at the design stage and went into oblivion as I couldn't find a suitable way for handling extension menu items and the menu items of windows that are launched on demand such as "User modules".

So for now just use the above code.
Back to top
View user's profile Send private message
Merlini
Advanced Cheater
Reputation: 2

Joined: 12 Jun 2016
Posts: 53

PostPosted: Fri Oct 28, 2016 3:51 pm    Post subject: Reply with quote

Works perfectly thank you.
Back to top
View user's profile Send private message
predprey
Master Cheater
Reputation: 15

Joined: 08 Oct 2015
Posts: 366

PostPosted: Sat Oct 29, 2016 10:14 am    Post subject: Reply with quote

in case you want to set the hotkey everytime, add this to the end of "External Editor.lua"
Code:
miChangeExtEditor.Shortcut = [[Ctrl+E]]
Back to top
View user's profile Send private message
predprey
Master Cheater
Reputation: 15

Joined: 08 Oct 2015
Posts: 366

PostPosted: Fri Dec 02, 2016 7:05 pm    Post subject: Reply with quote

Update 27:
- Batch Edit Hotkeys: Added support for children records.
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 Lua Scripting -> Lua Extensions All times are GMT - 6 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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