Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Text file input to gdl

Anonymous
Not applicable
Can any one help me with text file input into a GDL program.

I have a text file with one letter in it and that file is sitting in the Arhicad Data Folder. I want to read that one letter and have it as a variable in my GDL program. I have been going round and round in circles by trying to follow information in the GDL help. Thank you in advance for any help.

Archicad V11
3 REPLIES 3
Anonymous
Not applicable
Look in the GDL manual for the Text I/O functions. It is toward the end since it is an add-on/extension and not a core part of GDL. The manual can be a bit cryptic at times but it does list all the file handling procedures, commands, etc.
Laszlo Nagy
Community Admin
Community Admin
You should also check the other possibilities: one is DATA I/O and I think there is also an XML ability. Maybe that would serve you purpose better.
Loving Archicad since 1995 - Find Archicad Tips at x.com/laszlonagy
AMD Ryzen9 5900X CPU, 64 GB RAM 3600 MHz, Nvidia GTX 1060 6GB, 500 GB NVMe SSD
2x28" (2560x1440), Windows 10 PRO ENG, Ac20-Ac28
Anonymous
Not applicable
Hello,

Just put this in the master script;

ch1=OPEN("TEXT","Mytextfile.txt","SEPARATOR='\t',MODE=RO")
n=INPUT(ch1,1,1,value01, value02, value03, value04, value05)
CLOSE (ch1)




...so it reads a file named "Mytextfile.txt" from your Archicad Data folder.
This example takes in five values from the first row, starting from the first value.
'\t' means that values are separated with a tab which means the same as an Excel file
saved as a 'Tab separated text'.

Hope this helps.