DoctorDeploy.com - Das unabhängige Forum für Installation und Softwareverteilung Your Ad Here    
Doctor Deploy: software deployment, - distribution, repackaging, msi, windows installer, client management, installation, setup : forum - discussion boards 
  Search   •  RSS/Newsletter   •  Shop   •  Register  •  Profile  •  Log in to check your private messages  •  Log in
 WiseScript - Need a script for replacing a string View next topic
View previous topic
Post new topicReply to topic
Author Message
BuRsT
Piccolo
Piccolo


Joined: 18 Jan 2007
Posts: 2
Location: Montreal, Quebec

PostPosted: Thu, 18.Jan.2007, 17:11 Back to top

Hello there.

I hope you can help me.

I need to replace a string in a batch file with a value in INSTALLDIR

The build-in function "Insert Line into Text file" replace the whole line instead of the selected string.

Any1 of you made a custom script to do this kind of operation ?

thanks
View user's profileSend private message
Dominik Oberlin
Melchior
Melchior


Joined: 29 May 2006
Posts: 29

PostPosted: Thu, 18.Jan.2007, 20:42 Back to top

Hello BuRsT
The Action "Insert Line into text File" means, that you must insert a whole line. But you can append the not variable part in "Text to insert" field.
Set the match criteria to "Line containing Search Text" and insert action to "replace containing text".

Copy following part (example), paste it in WiseScript Package Editor and replace the filename, text to Search & replace.
Code:
item: Insert Line into Text File
  Pathname=MyTestFile.TXT
  New Text=this text was added before: %TEMP% and this text was added after
  Search Text=this text was added before:
  Line Number=0
  Flags=00101000
end
View user's profileSend private message
BuRsT
Piccolo
Piccolo


Joined: 18 Jan 2007
Posts: 2
Location: Montreal, Quebec

PostPosted: Thu, 18.Jan.2007, 21:27 Back to top

Doesn't work

Here an example :

I want to replace "FILENAME" by "DOCS" in this file.bat :

COPY C:\test\FILENAME.txt C:\test2\testfile.txt

after the string replace, it should be :

COPY C:\test\DOCS.txt C:\test2\testfile.txt

If I use the "Insert Line into Text File" with the setting you post, the whole line is replace by "DOCS"
View user's profileSend private message
Dominik Oberlin
Melchior
Melchior


Joined: 29 May 2006
Posts: 29

PostPosted: Fri, 19.Jan.2007, 08:48 Back to top

And here is an other WiseScript example. (No, it not replace the whole line with "DOCS"):

Code:
item: Set Variable
  Variable=FILEBODY
  Value=DOCS
end
item: Insert Line into Text File
  Pathname=file.bat
  New Text=COPY C:\test\%FILEBODY%.TXT  C:\test2\testfile.txt
  Search Text=FILENAME
  Line Number=0
  Flags=00101000
end
View user's profileSend private message
AddThis Social Bookmark Button
Display posts from previous:      
Post new topicReply to topic


 Jump to:   



View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Service provided by flatbyte.com :: Powered by phpBB :: FI Theme :: Imprint :: All times are GMT + 1 Hour