[已解决]开机自启动程序iniRead()的问题
本帖最后由 linnsky 于 2011-7-3 10:10 编辑一个开机自启动的小脚本,读取EyooPage.dat中的配置,写入到D:\UserData$\Globalconfig\SetMenu.dat中,编译成功后,直接双击编译好的程序执行没有问题,可以从EyooPage.dat中读取到相关键值,但是把此程序加入系统启动项,无论是放到启动文件夹,还是注册表的Run下,开机后他不去读取EyooPage.dat,而是直接使用默认值,特此求助~!Func Home()
Local $time = IniRead("EyooPage.dat", "HomePage", "Time", "20") * 1000
Sleep($time)
Local $file = IniRead("EyooPage.dat", "HomePage", "Dir", "D:\UserData$\Globalconfig\SetMenu.dat")
Local $home = IniRead("EyooPage.dat", "HomePage", "Home", "http://25759.5258.net/")
MsgBox(4096 , "Test" , $home)
IniWrite($file, "Setup", "StartPage", $home)
EndFunc
Func OneHome()
Local $file = IniRead("EyooPage.dat", "HomePage", "Dir", "D:\UserData$\Globalconfig\SetMenu.dat")
Local $home = IniRead("EyooPage.dat", "HomePage", "Home", "http://25759.5258.net/")
MsgBox(4096 , "Test" , $home)
IniWrite($file, "Setup", "StartPage", $home)
EndFunc
Func Main()
Sleep(60000)
FileCreateShortcut(@ScriptFullPath , "C:\Documents and Settings\Administrator\「开始」菜单\程序\启动\EyooPage.lnk")
OneHome()
While 1
Home()
WEnd
EndFunc
Main() 回复 1# linnsky
楼主的写法真够古怪,先写自定义函数再写运行代码
Main()
Func Main()
FileChangeDir(@ScriptDir)
Sleep(60000)
FileCreateShortcut(@ScriptFullPath , "C:\Documents and Settings\Administrator\「开始」菜单\程序\启动\EyooPage.lnk")
OneHome()
While 1
Home()
WEnd
EndFunc
Func Home()
Local $time = IniRead("EyooPage.dat", "HomePage", "Time", "20") * 1000
Sleep($time)
Local $file = IniRead("EyooPage.dat", "HomePage", "Dir", "D:\UserData$\Globalconfig\SetMenu.dat")
Local $home = IniRead("EyooPage.dat", "HomePage", "Home", "http://25759.5258.net/")
MsgBox(4096 , "Test" , $home)
IniWrite($file, "Setup", "StartPage", $home)
EndFunc
Func OneHome()
Local $file = IniRead("EyooPage.dat", "HomePage", "Dir", "D:\UserData$\Globalconfig\SetMenu.dat")
Local $home = IniRead("EyooPage.dat", "HomePage", "Home", "http://25759.5258.net/")
MsgBox(4096 , "Test" , $home)
IniWrite($file, "Setup", "StartPage", $home)
EndFunc 回复 2# tryhi
谢楼上指正,把运行代码放到前面,效果还是那样,我在一楼有描述 本帖最后由 tryhi 于 2011-7-3 10:05 编辑
回复tryhi
谢楼上指正,把运行代码放到前面,效果还是那样,我在一楼有描述
linnsky 发表于 2011-7-3 10:01 http://www.autoitx.com/images/common/back.gif
我只是简单的代码放前面吗?我不是还加了一句?
另外你这种写法顺序对于运行没有任何区别,只不过看起来没那么严谨 回复 4# tryhi
Sorry,没有仔细看
FileChangeDir(@ScriptDir)
原来是因为路径的原因,非常感谢,您说的对,编码习惯得改
页:
[1]