New Video : Lets hack the LiveCode IDE with a plugin

Find out what's going on with LiveCode (the company), product releases, announcements, and events.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
AndyP
Posts: 485
Joined: Wed Aug 27, 2008 12:57 pm
Location: Seeheim, Germany (ex UK)
Contact:

New Video : Lets hack the LiveCode IDE with a plugin

Post by AndyP » Sat May 30, 2020 5:55 pm

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
Andy Piddock

http://2108.co.uk/tinyide/ - Mini LC IDE alternative

http://2108.co.uk/script-editor-themer/ - Script Editor colour theming

http://livecodeshare.runrev.com/stack/897/LiveCode-Multi-Search - Search across 8 LC resources

SparkOut
Posts: 2323
Joined: Sun Sep 23, 2007 4:58 pm

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

Post by SparkOut » Sun May 31, 2020 5:15 pm

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.)

bogs
Posts: 4791
Joined: Sat Feb 25, 2017 10:45 pm

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

Post by bogs » Sun May 31, 2020 7:04 pm

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 :)
Image

SparkOut
Posts: 2323
Joined: Sun Sep 23, 2007 4:58 pm

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

Post by SparkOut » Sun May 31, 2020 11:19 pm

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.)

bogs
Posts: 4791
Joined: Sat Feb 25, 2017 10:45 pm

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

Post by bogs » Mon Jun 01, 2020 1:06 pm

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 ;)
Image

AndyP
Posts: 485
Joined: Wed Aug 27, 2008 12:57 pm
Location: Seeheim, Germany (ex UK)
Contact:

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

Post by AndyP » Mon Jun 01, 2020 1:43 pm

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.
Andy Piddock

http://2108.co.uk/tinyide/ - Mini LC IDE alternative

http://2108.co.uk/script-editor-themer/ - Script Editor colour theming

http://livecodeshare.runrev.com/stack/897/LiveCode-Multi-Search - Search across 8 LC resources

bogs
Posts: 4791
Joined: Sat Feb 25, 2017 10:45 pm

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

Post by bogs » Mon Jun 01, 2020 2:09 pm

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.
Image

SparkOut
Posts: 2323
Joined: Sun Sep 23, 2007 4:58 pm

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

Post by SparkOut » Mon Jun 01, 2020 5:13 pm

specialFolderPath("resources") > specialFolderPath("engine")

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

mrcoollion
Posts: 587
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

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

Post by mrcoollion » 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

mrcoollion
Posts: 587
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

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

Post by mrcoollion » Mon Jun 15, 2020 11:53 am

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

anmldr
Posts: 438
Joined: Tue Sep 11, 2012 11:13 pm

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

Post by anmldr » Mon Jun 15, 2020 10:23 pm

Yes. Put your stack here.

Thanks,
Linda

mrcoollion
Posts: 587
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

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

Post by mrcoollion » Tue Jun 16, 2020 7:54 am

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 52 times

AndyP
Posts: 485
Joined: Wed Aug 27, 2008 12:57 pm
Location: Seeheim, Germany (ex UK)
Contact:

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

Post by AndyP » Tue Jun 16, 2020 10:22 am

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!
Andy Piddock

http://2108.co.uk/tinyide/ - Mini LC IDE alternative

http://2108.co.uk/script-editor-themer/ - Script Editor colour theming

http://livecodeshare.runrev.com/stack/897/LiveCode-Multi-Search - Search across 8 LC resources

bogs
Posts: 4791
Joined: Sat Feb 25, 2017 10:45 pm

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

Post by bogs » Tue Jun 16, 2020 2:21 pm

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.
Image

Post Reply

Return to “Announcements”