I have a job to modify a file in the Firefox profile directory. Firefox randomly generates the folder name for each profile on each computer and that’s fine. I have relevance to find the name of the folder as follows:
if exists file (“C:\Users” & name of logged on user as string & “\Application Data\Mozilla\Firefox\profiles.ini”)
then following texts of firsts “Path=Profiles/” of lines whose (it contains “Path=Profiles/” and it contains
“.default”) of file (“C:\Users” & name of logged on user as string & "\AppData\Roaming\Mozilla\Firefox
\profiles.ini") else “n/a”
I know I can’t take the result of this directly and pipe it straight to another command, but I’m hoping I can pipe the result to a text file, then use a read command to pull that text into another command. I also have the relevance to append the file I need. I’d do this through vbscript, but the line of text has dollar signs and that’s giving the script unbelievable fits no matter how I try to escape the characters. Anyway, if anyone has thoughts on how to pull the text from a txt file and use that as a path variable, awesome. If not, is it possible to set up the above statement as a custom retrieved property in TEM to get what I need? Thank you for your time.
Are you familiar with relevance substitution in actionscript? Any relevance statement that’s contained in curly braces will be substituted into the actionscript when the action is run. For example, if you take a custom action with the action script:
appendfile {"The time is now: " & now as string}
copy __appendfile C:\time.txt
The file C:\time.txt will have the current time. Does this help? If not, can you post some of the action that’s giving you trouble?
I already found this somewhere else on the forums and that’s the third part of the process:
// store the file location
parameter “filename” = “C:\temp\profile.txt”
// add some new text
appendfile {concatenation of lines of file (parameter “filename”) & “%0d%0a” & “|$npatgpc.dll|$C:\Program Files (x86)\Mozilla Firefox\browser\plugins\npatgpc.dll|$28.4.2012.718|$1369972522000|0|0|$ActiveTouch General Plugin Container Version 105|$ActiveTouch General Plugin Container|$10|application/x-atgpc-plugin|General Plugin Container File|gpc|” & “%0d%0a”}
The first part also had me doing > “C:\Temp\profile.txt”, so the append is fine and finding the Firefox path is fine, it’s taking the text from profile.txt and dropping that into a path variable, such as
("C:\Users" & name of logged on user as string & "\AppData\Roaming\Mozilla\Firefox\Profiles(parameter “filename”)
"), though that specifically won’t work, I know.
Edit For what it’s worth, that relevance actually did work. The final text is as follows:
if exists file ("C:\Users" & name of logged on user as string & “\Application Data\Mozilla\Firefox\profiles.ini”) then following texts of firsts “Path=Profiles/” of lines whose (it contains “Path=Profiles/” and it contains “.default”) of file ("C:\Users" & name of logged on user as string & “\AppData\Roaming\Mozilla\Firefox \profiles.ini”) else “n/a” > “C:\Temp\profile.txt”
//store the file location
parameter “filename” = “C:\Temp\profile.txt”
//add some new text
appendfile {concatenation of lines of file ("C:\Users" & name of logged on user as string & “\AppData\Roaming\Mozilla\Firefox\Profiles(parameter “filename”)\pluginreg.dat”) & “%0d%0a” & “|$npatgpc.dll|$C:\Program Files (x86)\Mozilla Firefox\browser\plugins\npatgpc.dll|$28.4.2012.718|$1369972522000|0|0|$ActiveTouch General Plugin Container Version 105|$ActiveTouch General Plugin Container|$10|application/x-atgpc-plugin|General Plugin Container File|gpc|” & “%0d%0a”}
Unfortunately I was looking at the wrong file to do what I needed, but this still was a good learning experience.