Copying scripts to text file
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
Copying scripts to text file
Are there any utilities around for copying all of the scripts to a text file, for documentation purposes or using in "compare" exercises?
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Copying scripts to text file
Dunno: I just open the scriptEditor, do select all and then copy-paste. 
Of course, if you really want to spend the extra time, you can copy the script into a textField and export that to a Text or RTF document.

Of course, if you really want to spend the extra time, you can copy the script into a textField and export that to a Text or RTF document.
Re: Copying scripts to text file
I have done this in the past. I wrote a simple gadget that (pseudo)
You get the picture, as Klaus would say. You can also include the names of the objects as you go down the list.
Craig
Code: Select all
repeat with y = 1 to the number of cds
put the script of cd y after scriptLog
repeat with x = 1 to the number of controls of cd y
put the script of control x of cd y after scriptLog
-- and then
put the script of this stack after scriptLog
-- and then
get going on any substacks
Craig
Re: Copying scripts to text file
Script Tracker by Brian Milby on the forum here takes all of the scripts from any stack and puts them in text files so that you can use Git or whatever to track them or edit them externally. An essential piece of software for me.
https://github.com/bwmilby/scriptTracker
Thanks again Brian!
https://github.com/bwmilby/scriptTracker
Thanks again Brian!
-
- VIP Livecode Opensource Backer
- Posts: 10048
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Copying scripts to text file
Can you tell us more about the goals you're looking to serve with such a tool?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Copying scripts to text file
I'd start a bit like this:
-
-
- Attachments
-
- scriptSUCKER.livecode.zip
- Here's the stack.
- (1002 Bytes) Downloaded 211 times
-
- VIP Livecode Opensource Backer
- Posts: 10048
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Copying scripts to text file
Yeah, dumping scripts isn't the hard part. I used to have a habit of writing a script dumper with each new xTalk I picked up. But I stopped doing that when I noticed I never actually did any meaningful work with the output.
More recently I've identified a set it needs related to version comparison, and have begun the harder task of understanding needs so that the tool that emerges from this process is one I'll actually use.
My question for the OP is goal-focused for that reason. As with many things in life, implementation can become trivial once goals are well understood.
More recently I've identified a set it needs related to version comparison, and have begun the harder task of understanding needs so that the tool that emerges from this process is one I'll actually use.
My question for the OP is goal-focused for that reason. As with many things in life, implementation can become trivial once goals are well understood.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Copying scripts to text file
Yeah, my posting was meant to be mildly sarcastic.Yeah, dumping scripts isn't the hard part.

-
- Livecode Opensource Backer
- Posts: 10099
- Joined: Fri Feb 19, 2010 10:17 am
Re: Copying scripts to text file
Not clear if the OP is a teacher, but could be as 'compare and contrast' exercises are something of an obsession in certain areas.using in "compare" exercises
-
-
- VIP Livecode Opensource Backer
- Posts: 10048
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Copying scripts to text file
Yeah, the possibilities for guessing are nearly endless.
I'm eager to hear what Mark has to say.
I'm eager to hear what Mark has to say.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
Re: Copying scripts to text file
Yeah, recently someone sent me some hacks to my program, but with little information provided and no "in code" identification I couldn't find them. So I was looking for a quick way to compare the two versions to see if in fact the program sent back was the same one I sent outFourthWorld wrote: ↑Mon Dec 28, 2020 9:29 pmCan you tell us more about the goals you're looking to serve with such a tool?
PS sounds like your new planned tool would do the trick Richard.
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- VIP Livecode Opensource Backer
- Posts: 931
- Joined: Thu Nov 13, 2008 6:48 am
Re: Copying scripts to text file
Thanks KD, and hello to a fellow Canadian. This sounds a bit more involved than I was hoping for, but, also sounds like a good opportunity to get my feet wet with Git for the old version control. Currently on folder 111 for this programkdjanz wrote: ↑Mon Dec 28, 2020 7:00 pmScript Tracker by Brian Milby on the forum here takes all of the scripts from any stack and puts them in text files so that you can use Git or whatever to track them or edit them externally. An essential piece of software for me.
https://github.com/bwmilby/scriptTracker
Thanks again Brian!
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS
Targets: Mac, iOS
-
- VIP Livecode Opensource Backer
- Posts: 10048
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Copying scripts to text file
Thanks, Mark. Yes, it seems we both need the same tool.
GitHub is a wonderful system, as was Sourceforge before it and whatever will inevitably replace it in the future.
When an org has dependency on one specific tool over others, the others must be adapted to conform to the expectations/limitations of the main dependency.
The tooling available in our community for deconstructing/reconstructing LC's native format to and from GitHub-required formats have been a godsend for such teams.
But not all teams have that specific dependency.
I work with many professional devs who are drawn to LC because of the flexibility to bind code, UI, and even data into compact single files in nearly infinite ways based on the needs of a given project.
For them, adding deconstruction/reconstruction to their workflows breaks their stride, understandably given that it goes against the grain of The xTalk Way.
Exploring this last year,I noticed that the team quietly added a key component of git right into the engine: diffCompare and diffMerge.
Attempting those in script is both arduous and perilous. But with the industry standard algos now available to us easily, the rest is just comparing elements in arrays derived from object queries.
So at the moment I'm drafting the UI for this, a way to drop two different versions of a stack file into the window and review a list of property and script diffs, applying them selectively as one sees fit.
Progress has been slowed by client project needs, but work continues in the late hours as time permits.
It's not intended to replace GitHub. Not at all; where GitHub is a good fit for a team keep enjoying it.
This is a simpler, smaller-scope tool focused on review and merge. For myself, I use Nextcloud for versioned archives (with the added bonus that it keeps local copies in sync across all my machines), so I have no interest/need for handling those aspects.
I'll post more once it's ready for external testing...
GitHub is a wonderful system, as was Sourceforge before it and whatever will inevitably replace it in the future.
When an org has dependency on one specific tool over others, the others must be adapted to conform to the expectations/limitations of the main dependency.
The tooling available in our community for deconstructing/reconstructing LC's native format to and from GitHub-required formats have been a godsend for such teams.
But not all teams have that specific dependency.
I work with many professional devs who are drawn to LC because of the flexibility to bind code, UI, and even data into compact single files in nearly infinite ways based on the needs of a given project.
For them, adding deconstruction/reconstruction to their workflows breaks their stride, understandably given that it goes against the grain of The xTalk Way.
Exploring this last year,I noticed that the team quietly added a key component of git right into the engine: diffCompare and diffMerge.
Attempting those in script is both arduous and perilous. But with the industry standard algos now available to us easily, the rest is just comparing elements in arrays derived from object queries.
So at the moment I'm drafting the UI for this, a way to drop two different versions of a stack file into the window and review a list of property and script diffs, applying them selectively as one sees fit.
Progress has been slowed by client project needs, but work continues in the late hours as time permits.
It's not intended to replace GitHub. Not at all; where GitHub is a good fit for a team keep enjoying it.
This is a simpler, smaller-scope tool focused on review and merge. For myself, I use Nextcloud for versioned archives (with the added bonus that it keeps local copies in sync across all my machines), so I have no interest/need for handling those aspects.
I'll post more once it's ready for external testing...
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Copying scripts to text file
ScriptTracker is very simple and does NOT require you to use GIT - in fact it is the other way around. By using ScriptTracker you can turn scripts locked inside LiveCode into text files that you can put on Git or use Diff or whatever other tools you have that work with text files. His cool extra (that I confess I have not used) is that ScriptTracker monitors those text files, so if you make changes outside with another text editor or tool, it can be set to automatically update your stack when you re-open it.Thanks KD, and hello to a fellow Canadian. This sounds a bit more involved than I was hoping for, but, also sounds like a good opportunity to get my feet wet with Git for the old version control. Currently on folder 111 for this program
My usual use for ST is to dump all of my scripts to text, then put them all together in another text editor (BBedit for preference) and then print them so that I can get a big picture of the flow of my program. When I have scripts everywhere in different objects, I lose track of the big picture and printing them out gives me an overview of being able to see everything at once. I guess not being able to hold it all in your head at once is a symptom of age, so I have to work out my own coping strategies.
Do try! You literally have nothing to lose!
Kelly
Re: Copying scripts to text file
This sounds very interesting. The goal of my tool is just to allow tracking of differences in the scripts themselves, so other object changes are not detected. I've given some thought of how to add something like that, but it would involve serializing the rest of the stack file into a text format compatible with diff. Doing that for the non-binary parts of the stack wouldn't be that difficult. Binary wouldn't be all that hard, but would just end up with large chunks of encoded data that would increase the file size. Most of the work has probably already been done with the lcVCS code, but my goal wouldn't be to go that far with it (especially the number of files/folders created). If I did add it, the data elements that would be tracked would probably be limited somewhat.FourthWorld wrote: ↑Tue Dec 29, 2020 5:18 pmSo at the moment I'm drafting the UI for this, a way to drop two different versions of a stack file into the window and review a list of property and script diffs, applying them selectively as one sees fit.
My personal reason for using ScriptTracker is so I can easily track what has changed in scripts when contributing to projects. The project uses GitHub as the repository so all of the script only stuff is tracked easily. My tool allows me to check in the new script files along with the binary stack so it is easy for a reviewer to know what scripts where changed and be able to go back if needed. The project is moving much of the code to script only stacks, but for those that have not been updated yet it is very helpful to me. For my personal projects, it allows others to suggest code changes (via a PR) that I can easily incorporate back into my binary stack using the tool.