TextFile.WriteFromString("d:\\check_password.sql", [[
bla bla bla bla
want to put var in text file from SF7:
%var% or ..var.. or .......
quit
]], false);
Some one can help?
Professional Software Development Tools
TextFile.WriteFromString("d:\\check_password.sql", [[
bla bla bla bla
want to put var in text file from SF7:
%var% or ..var.. or .......
quit
]], false);
Some one can help?
Hi,
The string can have the content of a LUA variable. If the text is assigned to a Session Variable, you first have to expand it.
Session Variables are used for DISPLAYING purposes in the screens.Code:strMyText = SessionVar.Expand("%ProductName%".. " is installed in ".."%AppFolder%"); TextFile.WriteFromString("C:\\MyFile.txt", strMyText, false); Dialog.Message("C:\\MyFile.txt","The text '"..strMyText.."' is now written to the file", MB_OK, MB_ICONNONE);
i want to use a LUA var in a write.string thing (multiline). how to do then?
Something like this?
But now you have a very LONG code line. I prefer to break it up like this:Code:strMyText = SessionVar.Expand("This text has".."\r\nbe displayed".."\r\non severel lines:".."\r\n".."\r\n%ProductName%".."\r\nis installed in".."\r\n%AppFolder%"); TextFile.WriteFromString("C:\\MyFile.txt", strMyText, false);
Was this an answer to your question?Code:strMyText = SessionVar.Expand("This text has" .."\r\nbe displayed" .."\r\non severel lines:" .."\r\n" .."\r\n%ProductName%" .."\r\nis installed in" .."\r\n%AppFolder%");
Nope, i have the following code:
In this code cq text file, i want to use LUA vars...
Code:TextFile.WriteFromString(strAppSqlDir.."\\check_password.sql", [[ WHENEVER OSERROR EXIT 32767 WHENEVER SQLERROR EXIT SQL.SQLCODE SET pause off SET heading off SET feedback off SET timing off SET termout off SET echo off SET verify off SET linesize 1000 SET pagesize 1000 TRIMSPOOL on connect sys/oracle1@%DatabaseNaam%; spool %AppSqlDir%\check_dbsyspass.txt select 'Ja' from dual; spool off connect system/oracle1@%db_naam%; spool %AppSqlDir%\check_dbsystempass.txt select 'Ja' from dual; spool off connect impulse/%ImpPass%@%db_naam%; spool %AppSqlDir%\check_dbimpulsepass.txt select 'Ja' from dual; spool off quit ]], false);
Nope?
You have another string than I have in my simple example, but the principle is the same.
Just edit your string, be aware of quotation marks, and add some "\r\n" [=CR|LF].
If I understand you correctly, you want to use lua variables instead of those session variables?Originally Posted by brianlesker
It looks to me like it would be easier just to use the session variables, and expand the whole string like this:
...but if you want to use lua variables instead, you can do so like this:Code:TextFile.WriteFromString(strAppSqlDir.."\\check_password.sql", SessionVar.Expand([[ WHENEVER OSERROR EXIT 32767 WHENEVER SQLERROR EXIT SQL.SQLCODE SET pause off SET heading off SET feedback off SET timing off SET termout off SET echo off SET verify off SET linesize 1000 SET pagesize 1000 TRIMSPOOL on connect sys/oracle1@%DatabaseNaam%; spool %AppSqlDir%\check_dbsyspass.txt select 'Ja' from dual; spool off connect system/oracle1@%db_naam%; spool %AppSqlDir%\check_dbsystempass.txt select 'Ja' from dual; spool off connect impulse/%ImpPass%@%db_naam%; spool %AppSqlDir%\check_dbimpulsepass.txt select 'Ja' from dual; spool off quit ]]), false);
Code:TextFile.WriteFromString(strAppSqlDir.."\\check_password.sql", [[ WHENEVER OSERROR EXIT 32767 WHENEVER SQLERROR EXIT SQL.SQLCODE SET pause off SET heading off SET feedback off SET timing off SET termout off SET echo off SET verify off SET linesize 1000 SET pagesize 1000 TRIMSPOOL on connect sys/oracle1@]]..strDatabaseNaam..[[; spool ]]..strAppSqlDir..[[\check_dbsyspass.txt select 'Ja' from dual; spool off connect system/oracle1@]]..db_naam..[[; spool ]]..strAppSqlDir..[[\check_dbsystempass.txt select 'Ja' from dual; spool off connect impulse/]]..strImpPass.."@"..db_naam..[[; spool ]]..strAppSqlDir..[[\check_dbimpulsepass.txt select 'Ja' from dual; spool off quit ]], false);
--[[ Indigo Rose Software Developer ]]
Lorne, I didn't know about the double angle brackets
[[
to create
a block of text
]]
Is it covered in the help doc? (I can't find it.)
It's on page 273 in the user's guide.
--[[ Indigo Rose Software Developer ]]
csd214: that's easier than your "\r\n" [=CR|LF]![]()
Yes, indeed (in your case). Once again Lorne had something to teach me; this forum is indispensable.Originally Posted by brianlesker
![]()
(But the "\r\n" is working! I just tried to help you.)
You can also use the methods described to 'write-create' INI files
'on the fly'