如何使用installShield 2010中的现有xml文件设置变量 [英] How to set variables using existing xml file in installShield 2010

查看:76
本文介绍了如何使用installShield 2010中的现有xml文件设置变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在InstallShield 2010中使用Basic MSI Project构建了一个安装程序.

我的设置包含带有诸如textBoxes之类的输入的自定义对话框.每个TextBox都有一个具有默认值的变量.该软件包工具包还包含一个.xml文件,该文件由安装程序生成,并具有在向导中在特定路径中设置的值.效果很好.

问题是我有很多这样的文本框和很多步骤.我想增加一种可能性,使用户可以在向导的步骤之一中浏览.xml文件,然后跳过所有步骤以在文本框中插入数据.

我猜想在安装程序的项目中,我必须为每个变量设置一个带有值或路径的默认值(我确切知道我需要的值在xml中的位置),以便用户指向xml.

如果浏览的xml没有所需的模板,我现在将忽略,假设我将找到路径.

问题是在浏览xml文件的情况下如何在项目中设置变量?

感谢您的时间.

I build an installer with Basic MSI Project in InstallShield 2010.

My setup has custom dialogs with inputs like textBoxes. Each TextBox has associated a variable with a default value. The package kit contain also an .xml file wich is generated by installer and has in it the values setted in wizard in a specific path. That works very well.

The problem is I have a lot of this textBoxes and a lot of steps. I want to add the possibility for a user to browse an .xml file in one of the wizard''s steps and then skip all the steps to insert data in textboxes.

I guess that inside my installer''s project I have to set the default values for each variables with a value or with a path (I know exactly where the value I need is in xml) in condition that the user points to an xml.

I will ignore for now if the browsed xml has not the same template I need, let''s say that I will find the paths.

The question is how I set the variables in my project in case that xml file is browsed?

Thanks for your time.

推荐答案

经过几天的阅读,我写了以下内容:

我的xml:

After some days I read about that, I write next things:

my xml:

<settings>
    <sitenames>
        <setting property="prop1">value1</setting>
        <setting property="prop2">value2</setting>
    </sitenames>
</settings>


我的.vbs:


my .vbs:

Dim xmlPath  
    Dim xmlDoc
    xmlPath = Session.Property("IS_BROWSE_FILEBROWSED")
	set xmlDoc = CreateObject("Microsoft.XMLDOM")

	xmlDoc.async = "false"
	xmlDoc.load(xmlPath)    
	
	for each x in xmlDoc.getElementsByTagName("Setting")           
		Session.Property(x.getAttribute("property")) = x.text
    next 



而且效果很好:D



and it works very well :D


这篇关于如何使用installShield 2010中的现有xml文件设置变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆