ChatGPT and Livecode

Ludovic THEBAULT ludovic.thebault at laposte.net
Thu Dec 8 05:08:17 EST 2022


Hello all,

Chatgpt knows Livecode and can propose code on a simple description, but it remains to be improved :-)

Example : "Write a code for Livecode to read line by line a long text file. »

ChatGPT :
> on openCard
> 	put "Enter the path to the text file:"
> 	answer file
> 	set the filePath to file
> 
> 	put "Enter the maximum number of lines to read:"
> 	answer maxLines
> 
> 	put empty into lineList
> 
> 	put 0 into lineCounter
> 	put 0 into charCounter
> 
> 	open file filePath for read
> 	repeat for each line lineOfFile in file filePath
> 		if lineCounter < maxLines then
> 			add lineOfFile & cr after lineList
> 			add 1 to lineCounter
> 		else
> 			add lineOfFile to charCounter
> 		end if
> 	end repeat
> 	close file filePath
> 
> 	put lineList
> 	put charCounter & " characters remaining in file"
> end openCard



Ludovic



More information about the use-livecode mailing list