View previous topic :: View next topic |
Author |
Message |
Merlini Advanced Cheater Reputation: 2
Joined: 12 Jun 2016 Posts: 53
|
Posted: Thu Oct 20, 2016 5:37 am Post subject: |
|
|
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 |
|
|
predprey Master Cheater Reputation: 24
Joined: 08 Oct 2015 Posts: 486
|
Posted: Thu Oct 20, 2016 5:50 am Post subject: |
|
|
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 |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Thu Oct 20, 2016 8:07 am Post subject: |
|
|
Try this one:
Code: | shellExecute(extEditor,'"'..filePath:gsub('"','')..'"') |
_________________
|
|
Back to top |
|
|
predprey Master Cheater Reputation: 24
Joined: 08 Oct 2015 Posts: 486
|
Posted: Thu Oct 20, 2016 8:40 am Post subject: |
|
|
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 |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Thu Oct 20, 2016 9:34 am Post subject: |
|
|
predprey wrote: | so this deletes all the quotes in filePath and then enclose the entire string in quotes again? |
Yes.
_________________
|
|
Back to top |
|
|
predprey Master Cheater Reputation: 24
Joined: 08 Oct 2015 Posts: 486
|
Posted: Thu Oct 20, 2016 9:38 am Post subject: |
|
|
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 |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Thu Oct 20, 2016 10:04 am Post subject: |
|
|
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 |
|
|
predprey Master Cheater Reputation: 24
Joined: 08 Oct 2015 Posts: 486
|
Posted: Thu Oct 20, 2016 3:06 pm Post subject: |
|
|
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 |
|
|
Merlini Advanced Cheater Reputation: 2
Joined: 12 Jun 2016 Posts: 53
|
Posted: Thu Oct 20, 2016 4:24 pm Post subject: |
|
|
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 |
|
|
predprey Master Cheater Reputation: 24
Joined: 08 Oct 2015 Posts: 486
|
Posted: Thu Oct 20, 2016 5:01 pm Post subject: |
|
|
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 |
|
|
Merlini Advanced Cheater Reputation: 2
Joined: 12 Jun 2016 Posts: 53
|
Posted: Thu Oct 27, 2016 7:57 pm Post subject: |
|
|
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 |
|
|
predprey Master Cheater Reputation: 24
Joined: 08 Oct 2015 Posts: 486
|
Posted: Thu Oct 27, 2016 9:21 pm Post subject: |
|
|
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 |
|
|
Merlini Advanced Cheater Reputation: 2
Joined: 12 Jun 2016 Posts: 53
|
Posted: Fri Oct 28, 2016 3:51 pm Post subject: |
|
|
Works perfectly thank you.
|
|
Back to top |
|
|
predprey Master Cheater Reputation: 24
Joined: 08 Oct 2015 Posts: 486
|
Posted: Sat Oct 29, 2016 10:14 am Post subject: |
|
|
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 |
|
|
predprey Master Cheater Reputation: 24
Joined: 08 Oct 2015 Posts: 486
|
Posted: Fri Dec 02, 2016 7:05 pm Post subject: |
|
|
Update 27:
- Batch Edit Hotkeys: Added support for children records.
|
|
Back to top |
|
|
|