(imported topic written by SystemAdmin)
Hi
I have a problem with replacing text in an existing file on Users directory.
What I do is first create some variables/parameters…
After that I go through the file inside C:\Documents and Settings*Username*\Local Settings\Application Data\Lotus\Notes\Data\Workspace.metadata.plugins\com.ibm.collaboration.realtime.community.sametime\community-config.xml on each user on the computer (atleast that the idea)
After I’ve found parameter “old” I replace it with parameter “new”. I go through the same file in order to replace several lines…
However when I run the task it fails at the iteration and I cannot see to find whats wrong, so would appreciate some help… I suspect it might is because there are several users in documents and settings on the machines, but Im not sure…
P.S. the reason I use: whose (name of it ends with ".txt) in “profile-files” iteration is because the filename is not the same, but user “dependent”
My task looks like this:
parameter “oldloginAtStartup” = “loginAtStartup=“false””
parameter “newloginAtStartup” = “loginAtStartup=“true””
parameter “oldloginByToken” = “loginByToken=“false””
parameter “newloginByToken” = “loginByToken=“true””
parameter “oldisAutoActiveEnabled” = “isAutoActiveEnabled=“false””
parameter “newisAutoActiveEnabled” = “isAutoActiveEnabled=“true””
Here is where it fails first time!!!
// iterate through the file replacing lines as necessary in “community-file”
appendfile {concatenation “%0d%0a” of ( if (it contains (parameter “oldloginAtStartup”)) then ((preceding text of first (parameter “oldloginAtStartup”) of it) & (parameter “newloginAtStartup”) & (following text of first (parameter “oldloginAtStartup”) of it) ) else it ) of lines of file (“Local Settings\Application Data\Lotus\Notes\Data\workspace.metadata.plugins\com.ibm.collaboration.realtime.community.sametime\community-config.xml”) of folders of folder (“C:\Documents and Settings”)}
// backup the old file
delete “{parameter “community-file”}.old”
move “{parameter “community-file”}” “{parameter “community-file”}.old”
// replace with the new file
move __appendfile “{parameter “community-file”}”
appendfile {concatenation “%0d%0a” of ( if (it contains (parameter “oldloginByToken”)) then ((preceding text of first (parameter “oldloginByToken”) of it) & (parameter “newloginByToken”) & (following text of first (parameter “oldloginByToken”) of it) ) else it ) of lines of file (“Local Settings\Application Data\Lotus\Notes\Data\workspace.metadata.plugins\com.ibm.collaboration.realtime.community.sametime\community-config.xml” of folders of folder “C:\Documents and Settings”)}
// backup the old file
delete “{parameter “community-file”}.old”
move “{parameter “community-file”}” “{parameter “community-file”}.old”
// replace with the new file
move __appendfile “{parameter “community-file”}”
appendfile {concatenation “%0d%0a” of ( if (it contains (parameter “oldisAutoActiveEnabled”)) then ((preceding text of first (parameter “oldisAutoActiveEnabled”) of it) & (parameter “newisAutoActiveEnabled”) & (following text of first (parameter “oldisAutoActiveEnabled”) of it) ) else it ) of lines of file (“Local Settings\Application Data\Lotus\Notes\Data\workspace.metadata.plugins\com.ibm.collaboration.realtime.community.sametime\community-config.xml” of folders of folder “C:\Documents and Settings”)}
// backup the old file
delete “{parameter “community-file”}.old”
move “{parameter “community-file”}” “{parameter “community-file”}.old”
// replace with the new file
move __appendfile “{parameter “community-file”}”
// iterate through the file replacing lines as necessary in “profile-files”
appendfile {concatenation “%0d%0a” of ( if (it contains (parameter “oldloginAtStartup”)) then ((preceding text of first (parameter “oldloginAtStartup”) of it) & (parameter “newloginAtStartup”) & (following text of first (parameter “oldloginAtStartup”) of it) ) else it ) of lines of file whose (name of it ends with “.txt”) of folders “Local Settings\Application Data\Lotus\Notes\Data\Workspace” of folders of folder (“C:\Documents and Settings”)}
// backup the old file
delete “{parameter “profile-files”}.old”
move “{parameter “profile-files”}” “{parameter “profile-files”}.old”
// replace with the new file
move __appendfile “{parameter “profile-files”}”
appendfile {concatenation “%0d%0a” of ( if (it contains (parameter “oldloginByToken”)) then ((preceding text of first (parameter “oldloginByToken”) of it) & (parameter “newloginByToken”) & (following text of first (parameter “oldloginByToken”) of it) ) else it ) of lines of file whose (name of it ends with “.txt”) of folders “Local Settings\Application Data\Lotus\Notes\Data\Workspace” of folders of folder (“C:\Documents and Settings”)}
// backup the old file
delete “{parameter “profile-files”}.old”
move “{parameter “profile-files”}” “{parameter “profile-files”}.old”
// replace with the new file
move __appendfile “{parameter “profile-files”}”
appendfile {concatenation “%0d%0a” of ( if (it contains (parameter “oldisAutoActiveEnabled”)) then ((preceding text of first (parameter “oldisAutoActiveEnabled”) of it) & (parameter “newisAutoActiveEnabled”) & (following text of first (parameter “oldisAutoActiveEnabled”) of it) ) else it ) of lines of file whose (name of it ends with “.txt”) of folders “Local Settings\Application Data\Lotus\Notes\Data\Workspace” of folders of folder (“C:\Documents and Settings”)}
// backup the old file
delete “{parameter “profile-files”}.old”
move “{parameter “profile-files”}” “{parameter “profile-files”}.old”
// replace with the new file
move __appendfile “{parameter “profile-files”}”