MSFN Forum: [solved] How to use environment variables in .inf and .xml files? - MSFN Forum

Jump to content



Unattended CD/DVD Guide Homepage · MSFN Forum Rules

Welcome to the Applications Installs forum. Make sure you read the forum rules before you start posting.

Links/Requests to warez and/or any illegal material (porn, cracks, serials, etc..) will not be tolerated. Discussion of circumventing WGA/activation/timebombs/keygens or any other illegal activity will also not be tolerated.

We try our best to keep this forum clean of illegal content. If you see any illegal activity use the "report" button you find in every post to report the specific post to the moderators. If you ignore any of the rules you will be banned without notice.

Read Forum Rules
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[solved] How to use environment variables in .inf and .xml files? Neat Image and Adobe Photoshop CS3 Rate Topic: -----

#1 User is offline   radigast 

  • Junior
  • Pip
  • Group: Members
  • Posts: 79
  • Joined: 16-October 07

Posted 12 November 2007 - 08:00 AM

I am trying to figure out how to use environment variables in .ini files and .xml files.

Specfically, I am trying to install Neat Image 5.8 onto the homedrive of any partition I choose. I have already successfully got Neat Image to silently install, but not to the correct drive. Here is a snippet from NeatImageInstall.inf. I have tried "%ProgramFiles%\Neat Image", but that did not work and was not correctly recognized. Any ideas?
NeatImageInstall.inf
   [Setup]
	 Lang=default
	 Dir=C:\Program Files\Neat Image"
	 Group=Neat Image
	 NoIcons=0


The same holds true for Adobe Photoshop CS3 Extended. I also want to install this on any homedrive of any partition I choose. Here is a snippet from deployment.xml.
Deployment.xml
   <?xml version="1.0" encoding="utf-8"?><Deployment>
		 <Properties>
		 <Property name="INSTALLDIR">C:\Program Files\Adobe</Property><Property name="installLanguage">en_US</Property></Properties>
		 <Payloads>
		 <Payload adobeCode="{F0699DAC-0DC4-410B-B558-6D8CB5F3511A}"><Action>install</Action></Payload></Payloads>
	 </Deployment>


Anyone succesfully get either of these 2 programs to recognize environment variables, like %ProgramFiles% or %systemdrive% ? And if so, how did you do it? I have the silent install working for both, so would like to avoid using AutoIt if possible.

Thanks!

Radigast

This post has been edited by radigast: 13 November 2007 - 09:23 AM



#2 User is offline   radigast 

  • Junior
  • Pip
  • Group: Members
  • Posts: 79
  • Joined: 16-October 07

Posted 12 November 2007 - 10:56 AM

I figured out the .inf using some AutoIT commands. The code below shows what AutoITcode I used to export the proper installation path into the needed NeatImageInstall.inf, and then run the install file. I am not a coder, so it probably isn't pretty...but at least it gets the job done.

NeatImageInstall.au3
  ; Delete Dir= section of .inf file
   IniDelete ( "NeatImageInstall.inf", "Setup" , "Dir" )
  ; Rewrite Dir= section with environment variable install path
   IniWrite("NeatImageInstall.inf", "Setup", "Dir", @ProgramFilesDir & "\Neat Image")
  ; Exectute Neat Image Setup
   #include <Process.au3>
   _RunDOS ("NeatSetup58D.exe /LOADINF=NeatImageInstall.inf /VERYSILENT")


However...environment variables in .xml files (particularly deployment.xml for Adobe Photoshop CS3) are still a mystery. Can anyone shed light on environment variables in .xml files??

--Radigast

#3 User is offline   Acheron 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 915
  • Joined: 28-June 04

Posted 13 November 2007 - 05:44 AM

Well, there are not yet easy ways to alter xml files through commandline or autoit scripts. I use xmlstartlet to do the job. However this tool is not activily developed. Use the command option ed to edit/update xml files:

Quote

XMLStarlet Toolkit: Edit XML document(s)
Usage: xml ed <global-options> {<action>} [ <xml-file-or-uri> ... ]
where
<global-options> - global options for editing
<xml-file-or-uri> - input XML document file name/uri (stdin otherwise)

<global-options> are:
-P (or --pf) - preserve original formatting
-S (or --ps) - preserve non-significant spaces
-O (or --omit-decl) - omit XML declaration (<?xml ...?>)
-N <name>=<value> - predefine namespaces (name without 'xmlns:')
ex: xsql=urn:oracle-xsql
Multiple -N options are allowed.
-N options must be last global options.
--help or -h - display help

where <action>
-d or --delete <xpath>
-i or --insert <xpath> -t (--type) elem|text|attr -n <name> -v (--value) <valu
e>
-a or --append <xpath> -t (--type) elem|text|attr -n <name> -v (--value) <valu
e>
-s or --subnode <xpath> -t (--type) elem|text|attr -n <name> -v (--value) <val
ue>
-m or --move <xpath1> <xpath2>
-r or --rename <xpath1> -v <new-name>
-u or --update <xpath> -v (--value) <value>
-x (--expr) <xpath> (-x is not implemented yet)

XMLStarlet is a command line toolkit to query/edit/check/transform
XML documents (for more information see http://xmlstar.sourceforge.net/)


For example I use xmlstarlet to change FileZilla localdirectory path

xml ed -P -u "/FileZilla3/Servers/Server/LocalDir" -v "%USERPROFILE%\Websites" ".\settings\sitemanager.xml" > "%APPDATA%\FileZilla\sitemanager.xml"


Note xmlstarlet adds about 2MB to your install cd.

This post has been edited by Acheron: 13 November 2007 - 05:44 AM


#4 User is offline   radigast 

  • Junior
  • Pip
  • Group: Members
  • Posts: 79
  • Joined: 16-October 07

Posted 13 November 2007 - 09:21 AM

Thanks Acheron! That is exactly what I was looking for! You rock dude! I did some digging around in the help file and used your example to fudge my way into the right code.

Here are the steps I took to get Adobe Photoshop CS3 Extended slimmed down and fully functional onto any partition Windows is installed on. The Photoshop install went MUCH quicker, the Photoshop loads WAY faster, AND the total size on the CD was reduced from 478MB to 240MB! As a bonus, the notorious Bonjour service can be completely disabled after install and activation are complete.

Note: I opted out of the built-in silent install and used ScriptWriter to auto-create an AutoIT silent execuable for me. I could not figure out a way to make the silent install ONLY install the payloads I wanted. Also, I used WinRaR to extract everything to %Temp%\Photoshop, and Photoshop CS3 was installed to %ProgramFiles%\Adobe\. Change these paths to whatever you want!

Here is how I did it:

1. Use this site to pre-configure (input serial, etc...) your Photoshop install, and figure out what payload folders are safe to delete from the initial setup folder. I kept only the payload folders specified, and Photoshop runs perfectly fine for me.

2. Download xmlstartlet to modify the Deploy.xml default installation variable. If you use the code below, your Photoshop CS3 will install to %ProgramFiles%\Adobe.

3. Place xml.exe into the $OEM$\$\system32 folder of your install cd.

4. Use the following code in a .cmd file to parse the installation directory in Deployment.xml. As noted, this will install Photoshop into %ProgramFiles%\Adobe. In the "xml" line of code, note how 2 different paths were used. The first is the location/name of your fresh, unmodified Deployment.xml file. The second is where you would like the modified Deployment.xml file. Also, in the next step, we will be creating an AutoIT file to silently install Photoshop CS3, so it is necessary to call that file in our batch script.
PhotoshopSilentInstall.cmd
:: Insterting %ProgramFiles%\Adobe Environment Install Path into Deployment.xml
  xml ed -P -u "/Deployment/Properties/Property[@name='INSTALLDIR']" -v "%ProgramFiles%\Adobe" "%Temp%\Photoshop\Deployment.xml" > "%Temp%\Deployment.xml"
	   
  :: Overwriting old Deployment.xml with edited Deployment.xml
  move /Y "%Temp%\Deployment.xml" "%Temp%\Photoshop\Deployment.xml"
	   
  :: Running AutoIT Silent Install Script
"PathToFile\YourAutoITScript.exe"


5. Use the SciTE function ScriptWriter (an AutoIT tool) to create a silent AutoIT script for you. Be sure to name it the same as you did in your batch file!

6. Put all the Photoshop files, your batchfile, and your newly-created AutoIT .exe file into the same folder and use a compression program to mush them into an .exe file. I used WinRaR. For my particular install, I used the following SFX Comments. Note how the batch file you created is being called by the SFX archive.
Path=%Temp%\Photoshop
  SavePath
   Setup="PhotoshopSilentInstall.cmd"
   Silent=1
   Overwrite=1


As soon as Photoshop is installed, the temp folder created will be automatically deleted, so no worries about cleanup!

7. After Photoshop is installed and activated, you can use this link to download a super tiny .exe program that will automatically disable the Bonjour Service for you! It is called TurnOffBonour.exe.

To make this process completely silent, I used WPI to chain all the command installs so I didn't have to do a thing.

Enjoy your speedy, slimmed-down Photshop CS3.

I hope this all makes sense! I am not a coder in any way, and tend to use whatever resources I have availabe to me to make my life easy. There are probably easier ways to do what I did, but after posting on numerous forums (AutoIT, Adobe, MSFN) this is the solution that ended up working for me.

Cheers!

--radigast

This post has been edited by radigast: 13 November 2007 - 10:02 AM


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy