2014-07-10 2 views
0

이 내 전체 코드입니다 : 내가 버튼을 누르면변수가 선언하지 않고 사용

$hGUI0 = GUICreate('GUI',480,500) 
Opt("GUIOnEventMode", 1) 
$file = FileOpen("TEX.dll", 0) 
$tex = FileRead($file) 
GUISetBkColor ($tex, $hGUI0) 
;$rand=(Random(1,2,1)) 
$rand="1" 
$file = FileOpen("PNT.dll", 0) 
$pnt = FileRead($file) 
if $rand="1" Then 
    $Pic1 = GUICtrlCreatePic("Images\ANT.bmp", 5, 5, 180, 60) 
    GUICtrlSetOnEvent(-1, "antpoint") 
EndIf 
GUISetState() 
while 1 
    sleep(200) 
WEnd 
func antpoint() 
    if not FileExists("PNT.dll") then 
     fileopen("PNT.dll") 
     FileWrite("PNT.dll", "7845369875465") 
    EndIf 
    $file = FileOpen("PNT.dll", 0) 
    $pnt = FileRead($file) 
    if $pnt="7845369875465" then $points="0" 
    if $pnt="1659523976984" then $points="1" 
    if $pnt="4523691256486" then $points="2" 
    if $pnt="6254896328015" then $points="3" 
    if $pnt="0325698742531" then $points="4" 
    if $pnt="1032645798421" then $points="5" 
    if $pnt="8421455781253" then $points="6" 
    if $pnt="4763130118223" then $points="7" 
    if $pnt="1336455476895" then $points="8" 
    if $pnt="6345722484814" then $points="9" 
    if $pnt="4658522798872" then $points="10" 
    if $pnt="1548112413000" then $points="11" 
    if $pnt="5489435001878" then $points="12" 
    if $pnt="5153140897831" then $points="13" 
    if $pnt="2320164745795" then $points="14" 
    if $pnt="0446136297802" then $points="15" 
    if $pnt="4507631042900" then $points="16" 
    if $pnt="7854121321298" then $points="17" 
    if $pnt="0745942134507" then $points="18" 
    if $pnt="8496742170896" then $points="19" 
    if $pnt="3124784055213" then $points="20" 
    if $pnt="6790814267910" then $points="21" 
    if $pnt="4597800457948" then $points="22" 
    if $pnt="5731606040013" then $points="23" 
    if $pnt="2197489745302" then $points="24" 
    if $pnt="1564879645316" then $points="25" 
    if $pnt="4845021975120" then $points="26" 
    if $pnt="6789851260316" then $points="27" 
    if $pnt="2601579516715" then $points="28" 
    if $pnt="0975109780279" then $points="29" 
    if $pnt="5973123167519" then $points="30" 
    if $pnt="0579059746127" then $points="31" 
    if $pnt="9150975178107" then $points="32" 
    if $pnt="5910792192317" then $points="33" 
    if $pnt="9517917219012" then $points="34" 
    if $pnt="0218756169103" then $points="35" 
    if $pnt="2187854126789" then $points="36" 
    if $pnt="5420248751054" then $points="37" 
    if $pnt="8710329741096" then $points="38" 
    if $pnt="3584120687451" then $points="39" 
    if $pnt="6498451205448" then $points="40" 
    if $pnt="4105481510150" then $points="41" 
    if $pnt="1487049210132" then $points="42" 
    if $pnt="0165484087020" then $points="43" 
    if $pnt="0321894089748" then $points="44" 
    if $pnt="9540894865156" then $points="45" 
    if $pnt="0408945660481" then $points="46" 
    if $pnt="5684651045749" then $points="47" 
    if $pnt="1398711612984" then $points="48" 
    if $pnt="1332548484544" then $points="49" 
    if $pnt="9887411231545" then $points="50" 
    $PNTfile = FileOpen("PNT.dll", 1) 
    FileDelete("PNT.dll") 
    if $points="0" then FileWrite($PNTfile, "1659523976984") 
    if $points="1" then FileWrite($PNTfile, "4523691256486") 
    if $points="2" then FileWrite($PNTfile, "6254896328015") 
    if $points="3" then FileWrite($PNTfile, "0325698742531") 
    if $points="4" then FileWrite($PNTfile, "1032645798421") 
    if $points="5" then FileWrite($PNTfile, "8421455781253") 
    if $points="6" then FileWrite($PNTfile, "4763130118223") 
    if $points="7" then FileWrite($PNTfile, "1336455476895") 
    if $points="8" then FileWrite($PNTfile, "6345722484814") 
    if $points="9" then FileWrite($PNTfile, "4658522798872") 
    if $points="10" then FileWrite($PNTfile, "1548112413000") 
    if $points="11" then FileWrite($PNTfile, "5489435001878") 
    if $points="12" then FileWrite($PNTfile, "5153140897831") 
    if $points="13" then FileWrite($PNTfile, "2320164745795") 
    if $points="14" then FileWrite($PNTfile, "0446136297802") 
    if $points="15" then FileWrite($PNTfile, "4507631042900") 
    if $points="16" then FileWrite($PNTfile, "7854121321298") 
    if $points="17" then FileWrite($PNTfile, "0745942134507") 
    if $points="18" then FileWrite($PNTfile, "8496742170896") 
    if $points="19" then FileWrite($PNTfile, "3124784055213") 
    if $points="20" then FileWrite($PNTfile, "6790814267910") 
    if $points="21" then FileWrite($PNTfile, "4597800457948") 
    if $points="22" then FileWrite($PNTfile, "5731606040013") 
    if $points="23" then FileWrite($PNTfile, "2197489745302") 
    if $points="24" then FileWrite($PNTfile, "1564879645316") 
    if $points="25" then FileWrite($PNTfile, "4845021975120") 
    if $points="26" then FileWrite($PNTfile, "6789851260316") 
    if $points="27" then FileWrite($PNTfile, "2601579516715") 
    if $points="28" then FileWrite($PNTfile, "0975109780279") 
    if $points="29" then FileWrite($PNTfile, "5973123167519") 
    if $points="30" then FileWrite($PNTfile, "0579059746127") 
    if $points="31" then FileWrite($PNTfile, "9150975178107") 
    if $points="32" then FileWrite($PNTfile, "5910792192317") 
    if $points="33" then FileWrite($PNTfile, "9517917219012") 
    if $points="34" then FileWrite($PNTfile, "0218756169103") 
    if $points="35" then FileWrite($PNTfile, "2187854126789") 
    if $points="36" then FileWrite($PNTfile, "5420248751054") 
    if $points="37" then FileWrite($PNTfile, "8710329741096") 
    if $points="38" then FileWrite($PNTfile, "3584120687451") 
    if $points="39" then FileWrite($PNTfile, "6498451205448") 
    if $points="40" then FileWrite($PNTfile, "4105481510150") 
    if $points="41" then FileWrite($PNTfile, "1487049210132") 
    if $points="42" then FileWrite($PNTfile, "0165484087020") 
    if $points="43" then FileWrite($PNTfile, "0321894089748") 
    if $points="44" then FileWrite($PNTfile, "9540894865156") 
    if $points="45" then FileWrite($PNTfile, "0408945660481") 
    if $points="46" then FileWrite($PNTfile, "5684651045749") 
    if $points="47" then FileWrite($PNTfile, "1398711612984") 
    if $points="48" then FileWrite($PNTfile, "1332548484544") 
    if $points="49" then FileWrite($PNTfile, "9887411231545") 
    if $points="50" then FileWrite($PNTfile, "9887411231545") 
    msgbox(0,$pnt,$pnt) 
    msgbox(0,$points,$points) 
endfunc 

내가 두 MSGBOX의의를 받아 작동. 문제가 다시 시작되면 문제가 시작됩니다. 다음과 같은 오류 메시지가 표시됩니다.

"G:\Users\09stephenb\Desktop\AUTOIT\Combine\RANDOM.au3" (78) : ==> Variable used without being declared.: 
if $points="0" then FileWrite($PNTfile, "1659523976984") 
if^ERROR 

어떻게 해결할 수 있습니까?

나는 그것을 살펴 봤는데 한 번 실행되면 변수에 값이 있어야합니다.

답변

2

OK, 나는 이것이 당신이 찾고있는 희망 일부 해명 후 :

#include <Crypt.au3> 
#include <GUIConstantsEx.au3> 

;OnAutoItExitRegister("_OnAutoItExit") 
Global $count, $sFile, $sRead 
Global Const $SecurePass = "securepassword" ;Change your secure password here if you want 
;Local $rand=(Random(1,2,1)) 
Local $rand = "1" 
Local $file = FileOpen("TEX.dll", 0) 
Local $tex = FileRead($file) 
FileClose($file) 
Local $hGUI0 = GUICreate('GUI', 480, 500) 
GUISetBkColor($tex, $hGUI0) 
If $rand = "1" Then 
    $Pic1 = GUICtrlCreateButton("Images\ANT.bmp", 5, 5, 180, 60) 
EndIf 
GUISetState() 

While 1 
    $sMsg = GUIGetMsg() 
    Switch $sMsg 
     Case -3 
      ExitLoop 
     Case $Pic1 
      If $rand = "1" Then antpoint() 
    EndSwitch 
    Sleep(20) 
WEnd 


Func antpoint() 
    If Not FileExists("PNT.txt") Then 
     $count = NumberEncryptDecrypt(True, 1, $SecurePass, $CALG_3DES) 
     $sFile = FileOpen("PNT.txt", 2) 
      FileWrite($sFile, StringTrimLeft($count, 2)) 
     FileClose($sFile) 
    Else 
     $sFile = FileOpen("PNT.txt") 
     $sRead = FileRead("PNT.txt") 
     FileClose($sFile) 
     $count = NumberEncryptDecrypt(False, "0x" & $sRead, $SecurePass, $CALG_3DES) 
     $count += 1 
     $count = NumberEncryptDecrypt(True, $count, $SecurePass, $CALG_3DES) 
     $sFile = FileOpen("PNT.txt", 2) 
     FileWrite($sFile, StringTrimLeft($count, 2)) 
     FileClose($sFile) 
    EndIf 

    $sFile = FileOpen("PNT.txt") 
    $sRead = FileRead($sFile) 
    $count = NumberEncryptDecrypt(False, "0x" & $sRead, $SecurePass, $CALG_3DES) 
    FileClose($sFile) 

    If Number($count) <> 0 Then 
     MsgBox(0, "Our Line", $count) 
    Else 
     MsgBox(0, "", "failed, you need a better debug. Seriously ;)") 
    EndIf 
EndFunc ;==>antpoint 


Func NumberEncryptDecrypt($State, $Data, $Password, $ALG_ID) 
    _Crypt_Startup() 
    Local $sReturn = '' 
    If $State Then 
     $sReturn = _Crypt_EncryptData(String($Data), $Password, $ALG_ID) 
    Else 
     $sReturn = BinaryToString(_Crypt_DecryptData(String($Data), $Password, $ALG_ID)) 
    EndIf 
    _Crypt_Shutdown() 
    Return String($sReturn) 
EndFunc 


Func _OnAutoItExit() 
    $timer = TimerInit() 
    While FileExists("PNT.txt") And TimerDiff($timer) < 10000 ;; Avoid looping forever! 
     FileDelete("PNT.txt") 
     Sleep(200) 
    WEnd 
EndFunc 

PS :

;OnAutoItExitRegister("_OnAutoItExit") 
: 파일 스크립트가 종료 할 때마다 삭제하려면,이 라인을 주석
+0

감사합니다. 하지만 두 번째 시간 동안 코드를 실행 한 후 빈 상자 하나와 '0'을 제공합니다. – 09stephenb

+0

"이전에 열린 파일의 끝에 텍스트/데이터 쓰기" 이것은 FileWrite 함수의 기능입니다. PNT.dll doesnt가 ​​존재하고 $ points = "0"이니까 기본적으로 $ pnt = 7845369875465 스크립트가 처음 실행됩니다. antpoint() 함수의 두 번째 부분에서는 $ 점에 따라 FileWrite를 사용합니다. 그러면 파일이 7845369875465 + 새로운 filewrite가됩니다. 그런 다음 함수가 다시 시작됩니다. 그러나 일치하는 것이 없기 때문에 이제 모든 $ pnt 문이 실패합니다. $ 포인트는 재설정되지 않으므로 이전과 동일합니다. – user2530266

+0

그리고이 모든 것은 FileDelete가 실패했기 때문에 발생했습니다. while 루프를 추가하여 파일이 삭제되는지 확인합니다. 그러나 $ pnt는 항상 같기 때문에 스크립트는 아무런 의미가 없으므로 파일을 삭제하고 다시 작성하기 때문에 $ point가됩니다. P.S 나는 그것을 oneventmode에서 normal 모드로 변경했습니다. 나는 이벤트 모드에 익숙하지 않다. – user2530266

관련 문제