Indigo Rose Software

Go Back   Indigo Rose Software Forums > Old Versions > Setup Factory 7.0 Discussion

Reply
 
Thread Tools Display Modes
  #1  
Old 10-01-2004
brianlesker brianlesker is offline
Forum Member
 
Join Date: Oct 2003
Posts: 49
How to put a variabele in a WriteFromString

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?
Reply With Quote
  #2  
Old 10-01-2004
csd214 csd214 is offline
Forum Member
 
Join Date: Oct 2001
Location: Norway
Posts: 939
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.

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);
Session Variables are used for DISPLAYING purposes in the screens.
Reply With Quote
  #3  
Old 10-01-2004
brianlesker brianlesker is offline
Forum Member
 
Join Date: Oct 2003
Posts: 49
i want to use a LUA var in a write.string thing (multiline). how to do then?
Reply With Quote
  #4  
Old 10-01-2004
csd214 csd214 is offline
Forum Member
 
Join Date: Oct 2001
Location: Norway
Posts: 939
Something 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);
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%");
Was this an answer to your question?
Reply With Quote
  #5  
Old 10-01-2004
brianlesker brianlesker is offline
Forum Member
 
Join Date: Oct 2003
Posts: 49
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);
Reply With Quote
  #6  
Old 10-01-2004
csd214 csd214 is offline
Forum Member
 
Join Date: Oct 2001
Location: Norway
Posts: 939
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].
Reply With Quote
  #7  
Old 10-01-2004
Lorne's Avatar
Lorne Lorne is offline
Indigo Rose Staff Member
 
Join Date: Feb 2001
Location: Indigo Rose Software
Posts: 2,588
Quote:
Originally Posted by brianlesker
Nope, i have the following code:

In this code cq text file, i want to use LUA vars...
If I understand you correctly, you want to use lua variables instead of those session variables?

It looks to me like it would be easier just to use the session variables, and expand the whole string 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);
...but if you want to use lua variables instead, you can do so like this:

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 ]]
Reply With Quote
  #8  
Old 10-01-2004
csd214 csd214 is offline
Forum Member
 
Join Date: Oct 2001
Location: Norway
Posts: 939
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.)
Reply With Quote
  #9  
Old 10-01-2004
Lorne's Avatar
Lorne Lorne is offline
Indigo Rose Staff Member
 
Join Date: Feb 2001
Location: Indigo Rose Software
Posts: 2,588
It's on page 273 in the user's guide.
__________________
--[[ Indigo Rose Software Developer ]]
Reply With Quote
  #10  
Old 10-04-2004
brianlesker brianlesker is offline
Forum Member
 
Join Date: Oct 2003
Posts: 49
Lightbulb

csd214: that's easier than your "\r\n" [=CR|LF]
Reply With Quote
  #11  
Old 10-04-2004
csd214 csd214 is offline
Forum Member
 
Join Date: Oct 2001
Location: Norway
Posts: 939
Quote:
Originally Posted by brianlesker
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.

(But the "\r\n" is working! I just tried to help you.)
Reply With Quote
  #12  
Old 10-04-2004
SUF6NEWBIE
Guest
 
Posts: n/a
You can also use the methods described to 'write-create' INI files
'on the fly'
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How do I put a shortcut in startup menu RickJ Setup Factory 6.0 3 07-03-2003 09:17 AM
how can i put custom variables to the file ? scottlee Setup Factory 6.0 4 04-28-2003 10:42 AM
Put custom splash screen??? mandark Setup Factory 6.0 1 12-23-2002 09:07 AM
How do i put backgound music for my cd launcher ? Flea AutoPlay Media Studio 4.0 1 10-31-2002 08:44 AM
How to put a shortcut in quick launch bar? liviolee Setup Factory 6.0 2 03-19-2002 10:37 AM


All times are GMT -6. The time now is 06:06 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright Đ 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software