变量中的变量,搞了一晚上头都大了[已解决]
本帖最后由 xjw417 于 2011-4-8 12:06 编辑感觉是一个很简单的问题,但是脑袋总是转不过弯,请帮帮我!
假设:192.1681.1的MAC地址是11:22:33:44:55,
192.168.2.2的MAC地址是22:22:22:22:22,
192.168.3.3的MAC地址是33:33:33:33:33,
点击生成后我想要生成的TXT文件的结果:
XXXX192.168.2.2XXXXX
XXXX22:22:22:22:22XXXXX
(X是指任意字符,我试过FileWriteLine添加IP,MAC的自动添加我搞不定)
总之就是根据combo的数值生成MAC地址,我将变量赋来赋去,最后实在是放弃了。
尝试过Eval,Assign,和其它的替换命令(感觉替换没用),都不行!
请高人写个例子,谢谢了!
PS:为了截小图,IP和MAC我只假设了3个,真实应用中有10多个。 回复 1# xjw417
没看懂什么意思,下面是我理解的意思,不知道对不对#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 222, 275, 315, 334)
$Label1 = GUICtrlCreateLabel("1", 28, 24, 10, 17)
$Label2 = GUICtrlCreateLabel("2", 30, 50, 10, 17)
$Label3 = GUICtrlCreateLabel("3", 28, 78, 10, 17)
$Combo1 = GUICtrlCreateCombo("192.168.1.1", 46, 20, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "192.168.1.2|192.168.1.3")
$Combo2 = GUICtrlCreateCombo("192.168.1.1", 46, 50, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "192.168.1.2|192.168.1.3")
$Combo3 = GUICtrlCreateCombo("192.168.1.1", 48, 76, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "192.168.1.2|192.168.1.3")
$Button1 = GUICtrlCreateButton("Button1", 66, 190, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
$s1=GUICtrlRead($Combo1)
$s2=GUICtrlRead($Combo2)
$s3=GUICtrlRead($Combo3)
FileWriteLine("mac_.txt","asdasd"&$s1&"sadxcv")
FileWriteLine("mac_.txt","asdasd"&IniRead("mac.ini","mac",$s1,"00:00:00:00:00")&"sadxcv")
FileWriteLine("mac_.txt","asdasd"&$s2&"sadxcv")
FileWriteLine("mac_.txt","asdasd"&IniRead("mac.ini","mac",$s2,"00:00:00:00:00")&"sadxcv")
FileWriteLine("mac_.txt","asdasd"&$s3&"sadxcv")
FileWriteLine("mac_.txt","asdasd"&IniRead("mac.ini","mac",$s3,"00:00:00:00:00")&"sadxcv")
MsgBox(0,"","生成完毕")
EndSwitch
WEnd
ini文件内容
192.168.1.1=11:22:33:44:55
192.168.1.2=22:22:22:22:22
192.168.1.3=33:33:33:33:33 版主太谢谢你了, 是我的思路太狭窄了,现在才豁然开朗。
实现方法应该有很多种吧,AU3还是要慢慢学啊 还得慢慢学呀 ,学习一下 感谢分享,学习学习 这个问题确实简单
页:
[1]