Chinasmoker Posted August 7, 2007 Share Posted August 7, 2007 (edited) Hey,guys,I ve a trouble. I wrote a program by au3 yesterday, and when I was ready for testing it, I found If run this program twice(shortly),it was not working ,Not appeare intended effect! R there some way can resolve this trouble,Thanks any way Edited August 7, 2007 by Chinasmoker One is never too old to learn Link to comment Share on other sites More sharing options...
Generator Posted August 7, 2007 Share Posted August 7, 2007 #include<misc.au3> _Singleton("my script") Link to comment Share on other sites More sharing options...
argumentum Posted August 7, 2007 Share Posted August 7, 2007 ...post the code, that way you can get an acurate answer. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Chinasmoker Posted August 7, 2007 Author Share Posted August 7, 2007 #include<misc.au3>_Singleton("my script")Thanks ,Can you give me an explanation of that two line code ? I didnt get it One is never too old to learn Link to comment Share on other sites More sharing options...
Chinasmoker Posted August 7, 2007 Author Share Posted August 7, 2007 ...post the code, that way you can get an acurate answer. code:CODE#include <GUIConstants.au3> #NoTrayIcon run ("\\vdisk\新游戏更新$\调用程序\a.bat","",@SW_HIDE);先连接虚拟磁盘 $var = DriveGetDrive( "ALL") ;读取所有类型驱动器的总数量 Select Case $var[0] = 5 ;如果总数有5个,则直接执行use() use() Case $var[0] <> 5 ;如果没有5个。执行GUI,直到出现I盘 main() EndSelect Func use() run ("\\vdisk\新游戏更新$\调用程序\原调用.exe") WinWaitActive ("欢迎光临捷胜网吧") ControlClick ("欢迎光临捷胜网吧","",$CMDline[1]) EndFunc Func main() $Form1 = GUICreate("欢迎光临捷胜网吧", 287, 105, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR ($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE)) GUISetIcon("F:\网络游戏\QQ堂\Client.exe") GUISetBkColor(0xA6CAF0) $Label1 = GUICtrlCreateLabel("正在连接虚拟磁盘,请稍候...", 18, 16, 198, 24, $WS_CLIPSIBLINGS, $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetBkColor(-1, 0xA6CAF0) $Progress1 = GUICtrlCreateProgress(48, 64, 150, 16, BitOR($PBS_SMOOTH,$WS_CLIPSIBLINGS)) GUICtrlSetData(-1, 25) $Label2 = GUICtrlCreateLabel("0%", 120, 40, 25, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x008000) GUICtrlSetBkColor(-1, 0xA6CAF0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### run ("\\vdisk\新游戏更新$\调用程序\a.bat","",@SW_HIDE) $s=0 $wait=100 While 1 $Msg = GUIGetMsg() For $i = $s To 100 GUICtrlSetData ($Progress1,$i) GUICtrlSetData ($Label2,$i &"%") Sleep($wait) If GUICtrlRead($Progress1) = 100 Then Exit Next WEnd EndFunc One is never too old to learn Link to comment Share on other sites More sharing options...
WolfWorld Posted August 7, 2007 Share Posted August 7, 2007 (edited) expandcollapse popup#include <GUIConstants.au3> #include<misc.au3> #NoTrayIcon If _Singleton("What Ever",1) = 0 Then msgbox(0,'ERROR','SCRIPT EXITS') Exit Endif run ("\\vdisk\新游戏更新$\调用程序\a.bat","",@SW_HIDE);先连接虚拟磁盘 $var = DriveGetDrive( "ALL") ;读取所有类型驱动器的总数量 Select Case $var[0] = 5 ;如果总数有5个,则直接执行use() use() Case $var[0] <> 5 ;如果没有5个。执行GUI,直到出现I盘 main() EndSelect Func use() run ("\\vdisk\新游戏更新$\调用程序\原调用.exe") WinWaitActive ("欢迎光临捷胜网吧") ControlClick ("欢迎光临捷胜网吧","",$CMDline[1]) EndFunc Func main() $Form1 = GUICreate("欢迎光临捷胜网吧", 287, 105, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR ($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE)) GUISetIcon("F:\网络游戏\QQ堂\Client.exe") GUISetBkColor(0xA6CAF0) $Label1 = GUICtrlCreateLabel("正在连接虚拟磁盘,请稍候...", 18, 16, 198, 24, $WS_CLIPSIBLINGS, $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetBkColor(-1, 0xA6CAF0) $Progress1 = GUICtrlCreateProgress(48, 64, 150, 16, BitOR($PBS_SMOOTH,$WS_CLIPSIBLINGS)) GUICtrlSetData(-1, 25) $Label2 = GUICtrlCreateLabel("0%", 120, 40, 25, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x008000) GUICtrlSetBkColor(-1, 0xA6CAF0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### run ("\\vdisk\新游戏更新$\调用程序\a.bat","",@SW_HIDE) $s=0 $wait=100 While 1 $Msg = GUIGetMsg() For $i = $s To 100 GUICtrlSetData ($Progress1,$i) GUICtrlSetData ($Label2,$i &"%") Sleep($wait) If GUICtrlRead($Progress1) = 100 Then Exit Next WEnd EndFunc Edited August 7, 2007 by athiwatc Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
Chinasmoker Posted August 7, 2007 Author Share Posted August 7, 2007 About "_Singleton("What Ever",1)", why use "what ever",what mean,Is that a file name of my script expandcollapse popup#include <GUIConstants.au3> #include<misc.au3> #NoTrayIcon If _Singleton("What Ever",1) = 0 Then msgbox(0,'ERROR','SCRIPT EXITS') Exit Endif run ("\\vdisk\新游戏更新$\调用程序\a.bat","",@SW_HIDE);先连接虚拟磁盘 $var = DriveGetDrive( "ALL") ;读取所有类型驱动器的总数量 Select Case $var[0] = 5 ;如果总数有5个,则直接执行use() use() Case $var[0] <> 5 ;如果没有5个。执行GUI,直到出现I盘 main() EndSelect Func use() run ("\\vdisk\新游戏更新$\调用程序\原调用.exe") WinWaitActive ("欢迎光临捷胜网吧") ControlClick ("欢迎光临捷胜网吧","",$CMDline[1]) EndFunc Func main() $Form1 = GUICreate("欢迎光临捷胜网吧", 287, 105, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR ($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE)) GUISetIcon("F:\网络游戏\QQ堂\Client.exe") GUISetBkColor(0xA6CAF0) $Label1 = GUICtrlCreateLabel("正在连接虚拟磁盘,请稍候...", 18, 16, 198, 24, $WS_CLIPSIBLINGS, $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetBkColor(-1, 0xA6CAF0) $Progress1 = GUICtrlCreateProgress(48, 64, 150, 16, BitOR($PBS_SMOOTH,$WS_CLIPSIBLINGS)) GUICtrlSetData(-1, 25) $Label2 = GUICtrlCreateLabel("0%", 120, 40, 25, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x008000) GUICtrlSetBkColor(-1, 0xA6CAF0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### run ("\\vdisk\新游戏更新$\调用程序\a.bat","",@SW_HIDE) $s=0 $wait=100 While 1 $Msg = GUIGetMsg() For $i = $s To 100 GUICtrlSetData ($Progress1,$i) GUICtrlSetData ($Label2,$i &"%") Sleep($wait) If GUICtrlRead($Progress1) = 100 Then Exit Next WEnd EndFunc One is never too old to learn Link to comment Share on other sites More sharing options...
Generator Posted August 7, 2007 Share Posted August 7, 2007 直接把那两行code放在script的开头, 这样如果重复运行就会自动关闭 Link to comment Share on other sites More sharing options...
Chinasmoker Posted August 7, 2007 Author Share Posted August 7, 2007 直接把那两行code放在script的开头, 这样如果重复运行就会自动关闭谢谢,你在国内是吧,有QQ吗? One is never too old to learn Link to comment Share on other sites More sharing options...
Generator Posted August 7, 2007 Share Posted August 7, 2007 我在加拿大,QQ地震之后就没有用了,如果有问题可以PM我 Link to comment Share on other sites More sharing options...
Chinasmoker Posted August 7, 2007 Author Share Posted August 7, 2007 我在加拿大,QQ地震之后就没有用了,如果有问题可以PM我好的。多谢,这二天要给网吧装系统,写这个方便连接虚拟磁盘,还有个小问题,二个自定义function,能不能相互调用,刚发出来的code中在main()最后我需要用到use() One is never too old to learn Link to comment Share on other sites More sharing options...
Generator Posted August 7, 2007 Share Posted August 7, 2007 你这个脚本的主要用途是什么? 我怎么看也看不出来 Link to comment Share on other sites More sharing options...
WolfWorld Posted August 7, 2007 Share Posted August 7, 2007 English Plaese How Can I Help You ?? Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
WolfWorld Posted August 7, 2007 Share Posted August 7, 2007 What Ever Is Your Script Name Or What Ever You Want Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
Chinasmoker Posted August 7, 2007 Author Share Posted August 7, 2007 (edited) about my script It is used to connect virtual Disk(Its computer name is vdisk and its ip is 192.168.0.245) so ,I was according tatol of drive to judge if it needs to connect virtual Disk If tatol of drive = 5 This mean to connect virtual Disk successfully,then run use() If not This mean to need connect virtual Disk ,so must run main(), Edited August 7, 2007 by Chinasmoker One is never too old to learn Link to comment Share on other sites More sharing options...
Generator Posted August 7, 2007 Share Posted August 7, 2007 According to your code, your main function doesn't do anything, besides shows a gui and show a progress bar(it doesn't even work). Link to comment Share on other sites More sharing options...
Chinasmoker Posted August 7, 2007 Author Share Posted August 7, 2007 (edited) According to your code, your main function doesn't do anything, besides shows a gui and show a progress bar(it doesn't even work).yep.In fact ,in main() ,There is a run bat ,This is connect to vdisk , in the end of main() ,I need to add use() in main(),but It still didnt work.damn it, Can two UDFs call each other? CODE#include <GUIConstants.au3> #NoTrayIcon #include<misc.au3> _Singleton("my script") run ("\\vdisk\新游戏更新$\调用程序\a.bat","",@SW_HIDE) $var = DriveGetDrive( "ALL") Select Case $var[0] = 5 use() Case $var[0] <> 5 main() EndSelect Func use() run ("\\vdisk\新游戏更新$\调用程序\原调用.exe") WinWaitActive ("欢迎光临捷胜网吧") ControlClick ("欢迎光临捷胜网吧","",$CMDline[1]) EndFunc Func main() $Form1 = GUICreate("欢迎光临捷胜网吧", 287, 105, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR ($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE)) GUISetIcon("F:\网络游戏\QQ堂\Client.exe") GUISetBkColor(0xA6CAF0) $Label1 = GUICtrlCreateLabel("正在连接虚拟磁盘,请稍候...", 18, 16, 198, 24, $WS_CLIPSIBLINGS, $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetBkColor(-1, 0xA6CAF0) $Progress1 = GUICtrlCreateProgress(48, 64, 150, 16, BitOR($PBS_SMOOTH,$WS_CLIPSIBLINGS)) GUICtrlSetData(-1, 25) $Label2 = GUICtrlCreateLabel("0%", 120, 40, 25, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x008000) GUICtrlSetBkColor(-1, 0xA6CAF0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### run ("\\vdisk\新游戏更新$\调用程序\a.bat","",@SW_HIDE) $s=0 $wait=100 While 1 $Msg = GUIGetMsg() For $i = $s To 100 GUICtrlSetData ($Progress1,$i) GUICtrlSetData ($Label2,$i &"%") Sleep($wait) If GUICtrlRead($Progress1) = 100 Then Exit Next WEnd use() EndFunc Edited August 7, 2007 by Chinasmoker One is never too old to learn Link to comment Share on other sites More sharing options...
Generator Posted August 7, 2007 Share Posted August 7, 2007 Maybe expandcollapse popup#include <GUIConstants.au3> #NoTrayIcon #include<misc.au3> _Singleton("my script") run ("\\vdisk\新游戏更新$\调用程序\a.bat","",@SW_HIDE) $var = DriveGetDrive( "ALL") Select Case $var[0] = 5 use() Case $var[0] <> 5 main() EndSelect Func use() run ("\\vdisk\新游戏更新$\调用程序\原调用.exe") WinWaitActive ("欢迎光临捷胜网吧") ControlClick ("欢迎光临捷胜网吧","",$CMDline[1]) EndFunc Func main() $Form1 = GUICreate("欢迎光临捷胜网吧", 287, 105, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR ($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE)) GUISetIcon("F:\网络游戏\QQ堂\Client.exe") GUISetBkColor(0xA6CAF0) $Label1 = GUICtrlCreateLabel("正在连接虚拟磁盘,请稍候...", 18, 16, 198, 24, $WS_CLIPSIBLINGS, $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetBkColor(-1, 0xA6CAF0) $Progress1 = GUICtrlCreateProgress(48, 64, 150, 16, BitOR($PBS_SMOOTH,$WS_CLIPSIBLINGS)) GUICtrlSetData(-1, 25) $Label2 = GUICtrlCreateLabel("0%", 120, 40, 25, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x008000) GUICtrlSetBkColor(-1, 0xA6CAF0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### run ("\\vdisk\新游戏更新$\调用程序\a.bat","",@SW_HIDE) $s=0 $wait=100 While 1 $Msg = GUIGetMsg() For $i = $s To 100 GUICtrlSetData ($Progress1,$i) GUICtrlSetData ($Label2,$i &"%") Sleep($wait) If GUICtrlRead($Progress1) = 100 Then use() Exit EndIf Next WEnd EndFunc Link to comment Share on other sites More sharing options...
Paulie Posted August 7, 2007 Share Posted August 7, 2007 My ChinesePera-Kun just had a brain-fart deciphering this thread! Link to comment Share on other sites More sharing options...
Chinasmoker Posted August 7, 2007 Author Share Posted August 7, 2007 tetsed it It should be While 1 $Msg = GUIGetMsg() For $i = $s To 100 GUICtrlSetData ($Progress1,$i) GUICtrlSetData ($Label2,$i &"%") Sleep($wait) If GUICtrlRead($Progress1) = 100 Then use() and Exit Next WEnd EndFunc Thanks ,bye the way ,,speak a chinese ,谢谢 Maybe expandcollapse popup#include <GUIConstants.au3> #NoTrayIcon #include<misc.au3> _Singleton("my script") run ("\\vdisk\新游戏更新$\调用程序\a.bat","",@SW_HIDE) $var = DriveGetDrive( "ALL") Select Case $var[0] = 5 use() Case $var[0] <> 5 main() EndSelect Func use() run ("\\vdisk\新游戏更新$\调用程序\原调用.exe") WinWaitActive ("欢迎光临捷胜网吧") ControlClick ("欢迎光临捷胜网吧","",$CMDline[1]) EndFunc Func main() $Form1 = GUICreate("欢迎光临捷胜网吧", 287, 105, -1, -1, BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_GROUP,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR ($WS_EX_OVERLAPPEDWINDOW,$WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE)) GUISetIcon("F:\网络游戏\QQ堂\Client.exe") GUISetBkColor(0xA6CAF0) $Label1 = GUICtrlCreateLabel("正在连接虚拟磁盘,请稍候...", 18, 16, 198, 24, $WS_CLIPSIBLINGS, $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) GUICtrlSetBkColor(-1, 0xA6CAF0) $Progress1 = GUICtrlCreateProgress(48, 64, 150, 16, BitOR($PBS_SMOOTH,$WS_CLIPSIBLINGS)) GUICtrlSetData(-1, 25) $Label2 = GUICtrlCreateLabel("0%", 120, 40, 25, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x008000) GUICtrlSetBkColor(-1, 0xA6CAF0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### run ("\\vdisk\新游戏更新$\调用程序\a.bat","",@SW_HIDE) $s=0 $wait=100 While 1 $Msg = GUIGetMsg() For $i = $s To 100 GUICtrlSetData ($Progress1,$i) GUICtrlSetData ($Label2,$i &"%") Sleep($wait) If GUICtrlRead($Progress1) = 100 Then use() Exit EndIf Next WEnd EndFunc One is never too old to learn Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now