Editing .livecodescript files

A place to discuss and plan OpenSource xTalk (not exclusively LCC based)
and Community Builds of LCC ...Ask NOT what xTalk can do for you...
Get involved you DO have something to contribute, no matter your skillset!

Forum rules
A place to discuss and plan OpenSource xTalk (not exclusively LCC based) and Community Builds of LCC
Ask NOT what xTalk can do for you... get involved you DO have something to contribute, no matter your skillset!
User avatar
richmond62
Posts: 2776
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Editing .livecodescript files

Post by richmond62 »

Well, Erm, Yes . . . one can muck around with these using some type of Text Editor . . .

HOWEVER, it "would be lovely" if one could set up a stack that could 'inject' modded code into a .livecodescript file and then save it . . .

Easy enough to make one:
-
Screen Shot 2023-09-21 at 14.47.41.png
Screen Shot 2023-09-21 at 14.47.41.png (550.59 KiB) Viewed 3791 times
-
BUT, how do you then reopen it to edit it?

Aaaaah: dead easy: so 'my problem' [phone a psychiatrist?] is not THAT, what it is is how to open a .livecodescript file from inwith the IDE and muck it about before saving it.

AND, just for added fun, one with a 'rev' prefix.
https://richmondmathewson.owlstown.net/
User avatar
tperry2x
Posts: 1538
Joined: Tue Dec 21, 2021 9:10 pm
Location: Britain (Previously known as Great Britain)
Contact:

Re: Editing .livecodescript files

Post by tperry2x »

richmond62 wrote: Thu Sep 21, 2023 11:44 am so 'my problem': ...how to open a .livecodescript file from inwith the IDE and muck it about before saving it.
One livecodescript stack...
Screenshot at 2023-09-21 17-36-33.png
Screenshot at 2023-09-21 17-36-33.png (12.2 KiB) Viewed 3774 times
"test_script.livecodescript" in this case.

You can open it like a normal stack, and it'll appear in the Application Browser
Screenshot at 2023-09-21 17-38-16.png
Screenshot at 2023-09-21 17-38-16.png (65.3 KiB) Viewed 3774 times
You can then double click on the main stack "test_script" in this case, in the Application Browser and it'll pop open a window - it's not fully script only it turns out. (I think it's just set to hide it's main window on startup, otherwise seems exactly the same as a normal stack.
Screenshot at 2023-09-21 17-38-39.png
Screenshot at 2023-09-21 17-38-39.png (8.37 KiB) Viewed 3774 times
I can mess about with it after saving, closing, and reopening this way with the main window open via the Application Browser.
Screenshot at 2023-09-21 17-39-15.png
Screenshot at 2023-09-21 17-39-15.png (2.44 KiB) Viewed 3774 times
richmond62 wrote: Thu Sep 21, 2023 11:44 am AND, just for added fun, one with a 'rev' prefix.
Now that, I have no idea about. Maybe open in an old copy of runtime revolution :lol:

Also, this shows how alert dialogs aren't savvy to the rest of the system theme.
User avatar
tperry2x
Posts: 1538
Joined: Tue Dec 21, 2021 9:10 pm
Location: Britain (Previously known as Great Britain)
Contact:

Re: Editing .livecodescript files

Post by tperry2x »

tperry2x wrote: Thu Sep 21, 2023 4:46 pm Now that, I have no idea about. Maybe open in an old copy of runtime revolution :lol:
Turns out it's blindingly simple:
Screenshot at 2023-09-21 18-39-25.png
Screenshot at 2023-09-21 18-39-25.png (7.82 KiB) Viewed 3763 times
Create a new stack, with this button script in.
Click the button and locate your .rev script. You can then inspect and modify it with the Application Browser.
User avatar
tperry2x
Posts: 1538
Joined: Tue Dec 21, 2021 9:10 pm
Location: Britain (Previously known as Great Britain)
Contact:

Re: Editing .livecodescript files

Post by tperry2x »

Turns out I can add a bit more to this:
Screenshot at 2023-09-21 18-46-46.png
Screenshot at 2023-09-21 18-46-46.png (16.22 KiB) Viewed 3761 times
After you open your stack, a list of all the window names is then popped into the message box, helping you track down the right window.
User avatar
tperry2x
Posts: 1538
Joined: Tue Dec 21, 2021 9:10 pm
Location: Britain (Previously known as Great Britain)
Contact:

Re: Editing .livecodescript files

Post by tperry2x »

... and if I really put some effort in, I might even create something half-usable:
Screenshot at 2023-09-21 19-04-13.png
Screenshot at 2023-09-21 19-04-13.png (5.66 KiB) Viewed 3753 times
StackRevOpener.livecode
(1.44 KiB) Downloaded 139 times
User avatar
OpenXTalkPaul
Posts: 1574
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Editing .livecodescript files

Post by OpenXTalkPaul »

You can then double click on the main stack "test_script" in this case, in the Application Browser and it'll pop open a window - it's not fully script only it turns out. (I think it's just set to hide it's main window on startup, otherwise seems exactly the same as a normal stack.
When a script only stack, which is just a text file, is opened in the IDE the engine creates a corresponding ephemeral Stack in memory, along with a card 1 of that stack, and if it starts with 'rev' it's invisible by default, except to the Application Overview & Project Browser stacks (or via script).
I often edit script-only (BTW, .oxtscript is also valid for OXT IDE, and is what I've been using for script-only filename extension) in Atom (VSCode, BBEdit,TextMate, or similar) coding text editor that has a LCS/LCB formatter package available to it. You could use built-in script editor, use shell(script), AppleScript, or built in 'launch' command to open it in external editor from within the IDE. If a stack is made the 'topStack' front window then I like to open the files from Finder on macOS. OXT (macOS Native Tools lib) has command I use from the message box:

Code: Select all

revealFileInFinder the filename of topStack
That does exactly what the name says (no AppleScript needed), so then I can quickly open any other, often related, scripts that might be in that folder as well.
User avatar
richmond62
Posts: 2776
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Editing .livecodescript files

Post by richmond62 »

I have demonstrated what can be done with this:
-
Attachments
scriptHacker.livecode.zip
(217.11 KiB) Downloaded 127 times
https://richmondmathewson.owlstown.net/
User avatar
OpenXTalkPaul
Posts: 1574
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Editing .livecodescript files

Post by OpenXTalkPaul »

if you just want to edit a revWhatever library's script you can easily open it in the IDE's script editor using the Project Borwser's contextual menu.
Attachments
ProjectBrowserEditMenu.png
ProjectBrowserEditMenu.png (131.48 KiB) Viewed 3721 times
User avatar
richmond62
Posts: 2776
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Editing .livecodescript files

Post by richmond62 »

I don't, I want to offer end-users of the IDE the option to set IDE colours, icons, and so on: ideally this sort of thing should be rolled into the Preferences stack.
https://richmondmathewson.owlstown.net/
User avatar
richmond62
Posts: 2776
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Editing .livecodescript files

Post by richmond62 »

One could, if one were very clever, extremely devoted, and motivated, write a stack which could do the whole 'shebang' and convert, say, LC 961 to OXT 'automagically'.
https://richmondmathewson.owlstown.net/
User avatar
OpenXTalkPaul
Posts: 1574
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Editing .livecodescript files

Post by OpenXTalkPaul »

richmond62 wrote: Fri Sep 22, 2023 4:38 pm I have demonstrated what can be done with this:
-
This gives me a script error (relative path), should use special folder function or even better use the IDE library's functions that are included in the dictionary in OXT (search it for IDE and for rev).
But anyway I know you can edit script only files in memory, and then save them. Maybe I should reread this thread.
User avatar
OpenXTalkPaul
Posts: 1574
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Editing .livecodescript files

Post by OpenXTalkPaul »

OpenXTalkPaul wrote: Fri Sep 22, 2023 5:25 pm
richmond62 wrote: Fri Sep 22, 2023 4:38 pm I have demonstrated what can be done with this:
-
This gives me a script error (relative path), should use special folder function or even better use the IDE library's functions that are included in the dictionary in OXT (search it for IDE and for rev).
But anyway I know you can edit script only files in memory, and then save them. Maybe I should reread this thread.
revealFileInFinder revEnvironmentToolsetPath() &"/palettes/menubar/revmenubar.livecodescript"

New Line 3 of 'Yellow" button:
put revEnvironmentToolsetPath() &"/palettes/menubar/revmenubar.livecodescript" into PATEKA
User avatar
OpenXTalkPaul
Posts: 1574
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Editing .livecodescript files

Post by OpenXTalkPaul »

OpenXTalkPaul wrote: Fri Sep 22, 2023 5:29 pm
OpenXTalkPaul wrote: Fri Sep 22, 2023 5:25 pm
richmond62 wrote: Fri Sep 22, 2023 4:38 pm I have demonstrated what can be done with this:
-
This gives me a script error (relative path), should use special folder function or even better use the IDE library's functions that are included in the dictionary in OXT (search it for IDE and for rev).
But anyway I know you can edit script only files in memory, and then save them. Maybe I should reread this thread.
revealFileInFinder revEnvironmentToolsetPath() &"/palettes/menubar/revmenubar.livecodescript"

New Line 3 of 'Yellow" button:
put revEnvironmentToolsetPath() &"/palettes/menubar/revmenubar.livecodescript" into PATEKA
WTF, I hope I have a backup, lol(!?!) JK, I do. This replaced my OXT version revMenuBar entirely?
Attachments
Uhg!.png
Uhg!.png (84.87 KiB) Viewed 3710 times
User avatar
richmond62
Posts: 2776
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Editing .livecodescript files

Post by richmond62 »

WTF
Had you examined the stack carefully and the script in the Yellow button you would have found that the WHOLE script stack is replaced.
https://richmondmathewson.owlstown.net/
User avatar
tperry2x
Posts: 1538
Joined: Tue Dec 21, 2021 9:10 pm
Location: Britain (Previously known as Great Britain)
Contact:

Re: Editing .livecodescript files

Post by tperry2x »

richmond62 wrote: Fri Sep 22, 2023 5:55 pm ...the script in the Yellow button ... the WHOLE script stack is replaced.
Unfortunately this approach of replacing stacks won't work on Linux and Windows (I've just discovered) as a normal user does not have the necessary permissions.

It would be better if it could be made to read a config file stored in the users home /openxtalk folder.
Progress on Windows is slow, btw. Hampered by the fact that windows does not handle folder names that begin with a . which is a bit :roll:
User avatar
OpenXTalkPaul
Posts: 1574
Joined: Sat Sep 11, 2021 4:19 pm
Contact:

Re: Editing .livecodescript files

Post by OpenXTalkPaul »

richmond62 wrote: Fri Sep 22, 2023 5:55 pm
WTF
Had you examined the stack carefully and the script in the Yellow button you would have found that the WHOLE script stack is replaced.
I didn't, was too busy making it actually work, but not a big deal. It would be better if a script that does stuff like that would give a basic warning, and/or make a backup copy of the file being replaced.
Anyway, the yellow background looking bad in darkMode aside, I kind of like having that menubar-Toolbar as a floating window that can be minimized, macOS is the only platform where it's normally not that way. It would be good to make that an optional preference.
User avatar
richmond62
Posts: 2776
Joined: Sun Sep 12, 2021 11:03 am
Location: Bulgaria
Contact:

Re: Editing .livecodescript files

Post by richmond62 »

I am sorry if I offended your aesthetic sensibilities: that was NOT my intention.

What I was trying to do was work out a way to have scripts for, say, the revPreferences stack, that could open up a far larger amount of customisation that LC permits, and as such, I was working with LC 961 rather than anyone's OXT offering.
I kind of like having that menubar-Toolbar as a floating window that can be minimized, macOS is the only platform where it's normally not that way. It would be good to make that an optional preference.
Yes, it would, as, having the MenuBar 'jammed' up in the top-lefthand corner of the screen is not always what one wants.

In a perfect world [Ho, Ho, Ho] the revPreference stack would offer:

Dark mode

Light mode

LGBT mode

Lemon yellow with flying ducks mode

Barister mode [coffee]

Heavy Metal mode [now, a sort of Steam Punk one would be rather fun]

Floating MenuBar [preferably palettised like the Tools]

Vertical MenuBar

Horizontal Tools

And so on, and on, and on: probably also a colour wheel so that folk could really pimp their interface stacks to whatever they wanted ['Dog's Vomit mode'].

7 or 8 colourisation schemes for the scriptEditor

Combined MenBar & Tools in one palette

Icon choice for the Application Browser and the Project Browser.

Choice of icons (or none) for the answer and ask dialogues.

Better stop this and go to bed as have to teach 'tinies' EFL [English as a FFFFFFFed Language] tomorrow, and, among other things explain why I don't care at all if they use GB English, US English, Canadian English, or whatever: as they have silly 'English' teachers at school [who cannot understand the differences between the dialects] who insists that they stick to 'British English', but then tell them that they should spell 'Mum' 'Mom'. 8-)
https://richmondmathewson.owlstown.net/
Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests