Page 1 of 1

New Video : Lets hack the LiveCode IDE with a plugin

Posted: Sat May 30, 2020 5:55 pm
by AndyP
Time for another vid?

A simple tutorial showing how to create a plugin to add a button to the LiveCode MenuBar.

https://www.youtube.com/watch?v=LpvtZNPiuIg&t=36s

Re: New Video : Lets hack the LiveCode IDE with a plugin

Posted: Sun May 31, 2020 5:15 pm
by SparkOut
Thanks Andy, just one question though:
what does

Code: Select all

set the destroyMode of stack "theStackName"
do, apart from set a new custom property called destroyMode? There isn't a built-in property called destroyMode that I am aware of.

(For that matter, I can't get my IDE editing plugins to purge from memory either, no matter the settings of the destroyWindow and destroyStack properties.)

Re: New Video : Lets hack the LiveCode IDE with a plugin

Posted: Sun May 31, 2020 7:04 pm
by bogs
I thought that was when 'destroyStack' and 'destroyWindow' just wasn't enough, then you go into 'destroyMode' where anything / one can be the target :twisted:
The second sounds like a bug to me, but I haven't actually done any testing with it :?
Aside from that, like my comment on the vid page says, very well done Andy :)

Re: New Video : Lets hack the LiveCode IDE with a plugin

Posted: Sun May 31, 2020 11:19 pm
by SparkOut
Well I had a feeling that closing the stack inside the openStack handler was like trying to levitate by standing in two buckets and pulling up on the handles. So to solve the issue of the plugin "launcher" stack not purging from memory, instead of putting the close stack command in as the last line of the openStack handler, I made that

Code: Select all

send "closeMe" to stack "IDE hack stack" in 200 milliseconds
and put the close stack command into the closeMe handler in the stack script. That lets the openStack handler finish before trying to close itself.
And thanks again Andy, I have made various tweaks and hacks to the IDE in various ways before, but never bothered to make the effort to do this sort of plugin before. Which is of course, less effort than the hacky-tweak way.
(Now I've reappropriated the Dictionary icon and it fires up tinyDictionary instead, and responds much quicker and is more legible with less white space and fewer formatting anomalies.)

Re: New Video : Lets hack the LiveCode IDE with a plugin

Posted: Mon Jun 01, 2020 1:06 pm
by bogs
Tiny Dictionary is the bomb! And your right, Andy's method is far easier than the hacky tweaky method you and I share, I just have come to appreciate the hacky tweaky method itself ;)

Re: New Video : Lets hack the LiveCode IDE with a plugin

Posted: Mon Jun 01, 2020 1:43 pm
by AndyP
Ah yes, of course it should be destroyStack and not destroyMode.
I've made a note in the video description.
Thanks for pointing this out.

Hopefully no mistakes next time!

I will be covering special folders in the next video, anything you think should be included, gotchas etc.

Obviously this YouTube channel is unlikely to have a high view count but its an interesting exercise for me, I am learning a lot as I go along, not only with LiveCode but video editing etc, also in this video I've been working on my vocals as I know my voice is pretty monotone, most of all just trying to keep the grey matter active and spread the word on how great LiveCode is for desktop apps across the 3 main platforms.

Again thanks for any comments or ideas for future videos.

Re: New Video : Lets hack the LiveCode IDE with a plugin

Posted: Mon Jun 01, 2020 2:09 pm
by bogs
AndyP wrote:
Mon Jun 01, 2020 1:43 pm
I will be covering special folders in the next video, anything you think should be included, gotchas etc.
Biggest gotcha I can think of is to be aware that they are slightly different for all 3 desktops, and that if someone changes the name of say, any of those locations, Lc probably won't be pointing at the right one.

Re: New Video : Lets hack the LiveCode IDE with a plugin

Posted: Mon Jun 01, 2020 5:13 pm
by SparkOut
specialFolderPath("resources") > specialFolderPath("engine")

specialFolderPath names resolve without trailing slashes so ensure to include a slash when concatenating with subfolder and file names.

Re: New Video : Lets hack the LiveCode IDE with a plugin

Posted: Mon Jun 15, 2020 9:23 am
by mrcoollion
Love this tutorial and used it :D .
But how can I add the Run and Edit buttons to the MenuBar as well as a toggle for the Tools menu on which those buttons reside?

Regards,

Paul

Re: New Video : Lets hack the LiveCode IDE with a plugin

Posted: Mon Jun 15, 2020 11:53 am
by mrcoollion
mrcoollion wrote:
Mon Jun 15, 2020 9:23 am
Love this tutorial and used it :D .
But how can I add the Run and Edit buttons to the MenuBar as well as a toggle for the Tools menu on which those buttons reside?

Regards,

Paul
After some more digging, I found the solution
Anyone interested let me know and I will post the stack here.

regards,

Paul

Re: New Video : Lets hack the LiveCode IDE with a plugin

Posted: Mon Jun 15, 2020 10:23 pm
by anmldr
Yes. Put your stack here.

Thanks,
Linda

Re: New Video : Lets hack the LiveCode IDE with a plugin

Posted: Tue Jun 16, 2020 7:54 am
by mrcoollion
Hi Linda,

Here are the stack(s). Yes I made two. 'Hack_LC_IDE_01.livecode' is for development and the MenuHack01_Run.livecode is for in the externals/plugin folder. The only difference is that in the run version at the preOpenStack part I make the stack invisible and the stack also closes itself after placing the buttons in the menubar.

Just copy the MenuHack01_Run.livecode into your User Extensions > plugins folder and after re-starting LC and starting the plugin the additional Buttons in your toolbar are: Save, Tools, Project Browser, Run mode and Edit Mode.

There is still a lot of room for improvement. E.g. place information in the tooltip of the buttons, better alignment, other icons... whatever you prefer.

have fun :wink:

Regards,

Paul

Hack LC IDE.zip
(3.42 KiB) Downloaded 430 times

Re: New Video : Lets hack the LiveCode IDE with a plugin

Posted: Tue Jun 16, 2020 10:22 am
by AndyP
Thanks for the positive comments.
The easiest way is to use the send command with this format
send "menuPick" && "MENU-ITEM" to button "MENU-HEADING" of stack "revMenuBar"

So for run and edit;
send "menuPick" && "Browse Tool" to button "Tools" of stack "revMenuBar"
or
send "menuPick" && "Pointer Tool" to button "Tools" of stack "revMenuBar"

Other examples;
send "menuPick" && "Dictionary (API)" to button "Help" of stack "revMenuBar"
send "menuPick" && "Backdrop" to button "View" of stack "revMenuBar"
send "menuPick" && "Save" to button "File" of stack "revMenuBar"

Warning -- Once you get into hacking the IDE, its hard to stop!

Re: New Video : Lets hack the LiveCode IDE with a plugin

Posted: Tue Jun 16, 2020 2:21 pm
by bogs
Might want to check the result on any send menu pick commands there Andy, as I had some fun finding this bug doing that.

This thread is what led me to it.