au3能创建这样的xml文件吗?[2011.10.12]
本帖最后由 antony410 于 2011-10-13 01:41 编辑<?xml version="1.0" encoding="utf-8" ?>
- <main>
<Item configversion="17" homepagetype="0" openunclosedpagewhenstart="FALSE" opennewpage="TRUE" notshowpagewhenopenbyotherprograms="TRUE" showalertwhenclose="FALSE" autochechdefaultbrowsersetting="TRUE" multitaborapp="TRUE" appmodekeepmax="FALSE" newwindowfromoutside="0" sc_video="593" sc_soundblocking="1111"
........................
cleanaccountdata="TRUE" DynamarkEnable="TRUE" DynamarkBubble="TRUE" DynamarkFavOfen="TRUE" DynamarkStartPage="TRUE" DynamarkUseRss="TRUE" DynamarkYellow="TRUE" startpageinitdisplaycount="100" UserInstruct="00101000000000000800020010" showtime="TRUE" />
</main>au3能创建这样的xml文件吗?
或者将里面的opennewpage="TRUE"修改成opennewpage="FALSE" ??? 应该是可以的,只是我不会,好像可以创建xml对象模型来实现的 创建:其实和普通文本格式文件一样的,只是后缀名不同改为xml,就是要注意换行和格式
Or
创建读取修改:autoit3安装目录\UserInclude\_XMLDomWrapper.au3
里面包含_XMLCreateFile、_XMLFileOpen、_XMLGetChildText、_XMLReplaceChild...
自己细细研究下 回复 2# xms77
参考下:
http://www.autoitx.com/forum.php?mod=redirect&goto=findpost&ptid=10285&pid=96159 thank you a lot 一个字“能” 能实现的,比如说写入txt文件,现改名等等! 哪位大侠能给个代码,谢谢了。 等等 我去弄个例子 水平实在有限 就能写成这个模样#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 615, 438, 192, 124)
$Button1 = GUICtrlCreateButton("保存", 232, 384, 137, 33)
$Label1 = GUICtrlCreateLabel("configversion", 8, 8, 67, 17)
$Input1 = GUICtrlCreateInput("17", 168, 8, 81, 21)
$Label2 = GUICtrlCreateLabel("homepagetype", 8, 32, 74, 17)
$Input2 = GUICtrlCreateInput("0", 168, 32, 81, 21)
$Label3 = GUICtrlCreateLabel("openunclosedpagewhenstart", 8, 56, 141, 17)
$Combo1 = GUICtrlCreateCombo("FALSE", 168, 56, 81, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "TRUE|FALSE", "FALSE")
$Label4 = GUICtrlCreateLabel("opennewpage", 8, 80, 72, 17)
$Combo2 = GUICtrlCreateCombo("TRUE", 168, 80, 81, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "TRUE|FALSE", "TRUE")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Dim $_1 ,$_2 ,$_3 ,$shuchu
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$shuchu = 0
_baocun()
EndSwitch
WEnd
Func _baocun()
$_1 = $_1 & '<?xml version="1.0" encoding="utf-8" ?> '& @CRLF &'- <main>'& @CRLF
$_2 = $_2 & '<Item configversion="'& GUICtrlRead($Input1) &'" homepagetype="'& GUICtrlRead($Input2) &'" openunclosedpagewhenstart="'& GUICtrlRead($Input1) &'" opennewpage="'& GUICtrlRead($Combo1) &'" notshowpagewhenopenbyotherprograms="'& GUICtrlRead($Combo2) &'" showalertwhenclose="FALSE" autochechdefaultbrowsersetting="TRUE" multitaborapp="TRUE" appmodekeepmax="FALSE" newwindowfromoutside="0" sc_video="593" sc_soundblocking="1111" '& @CRLF
$_3 = $_3 & '........................'& @CRLF
$_3 = $_3 & 'cleanaccountdata="TRUE" DynamarkEnable="TRUE" DynamarkBubble="TRUE" DynamarkFavOfen="TRUE" DynamarkStartPage="TRUE" DynamarkUseRss="TRUE" DynamarkYellow="TRUE" startpageinitdisplaycount="100" UserInstruct="00101000000000000800020010" showtime="TRUE" /> '& @CRLF &'</main>'
$shuchu =$_1 & $_2 & $_3
$var = FileSaveDialog("输入一个名称.", @WorkingDir, "脚本 (*.xml)", 18, 'XML.xml')
FileWrite($var, $shuchu)
EndFunc 回复 10# jj119120
谢谢jj119120, 真能生成。
但又出现一个问题了。
用IE打开,提示以下信息:
无法显示 XML 页。
使用 样式表无法查看 XML 输入。请更正错误然后单击 刷新按钮,或以后重试。
文档的顶层无效。处理资源 'file:///C:/Documents and Settings/Administrator/桌面/config.xml' 时出错。第 1 行,位置: 40
<?xml version="1.0" encoding="utf-8" ?>
是不是要另存为xml格式才行,应该怎样办? 这个问题我就不清楚了没太明白什么意思……
页:
[1]