close
資料來源:兄弟論壇
作者:沉8

限制小精靈使用次數的腳本(可直接使用)

下面腳本為限制使用次數的腳本 可用於生成的小精靈
默認使用次數為10次 可自行修改
把腳本替換/////正文文件/////中的腳本可直接使用
此處我測試用的腳本是打開一個文本文件寫入一個數字
本腳本依靠讀取文本實現
文本文件設置在系統目錄c盤winnt目錄下是為了不讓使用者發現和修改
若想修改生成的txt文件路徑和名字
請注意使用者的電腦在同路徑下不能有同名txt文件
否則可能直接出現沒有使用權限

VBS Dim fso
VBS set fso=CreateObject("Scripting.FileSystemObject")
VBS const forreading=1
VBS const forwriting=2
VBS const forappending=8
VBS costfile=fso.FileExists("C:\WINNT\system32\cost.txt")
VBS ynfile=fso.FileExists("C:\WINNT\system32\yn.txt")
//判斷yn.txt文件是否存在,存在直接跳轉到腳本最後
If 0<>ynfile
    //超過使用權限次數
    VBSCall MessageBox("您沒有使用權限!")
    Goto over
EndIf
//判斷指定路徑是否存在cost.txt文件
If 0=costfile
    //否,第一次使用生成cost.txt文件
    VBS set ttfile=fso.createtextfile("C:\WINNT\system32\cost.txt",false)
EndIf
//以寫方式打開cost.txt,寫入字符"1"
VBS set fso=CreateObject("Scripting.FileSystemObject")
VBS set ttfile=fso.opentextfile("C:\WINNT\system32\cost.txt",forappending)
VBS ttfile.writeline("1")
VBS ttfile.Close
//以讀方式打開cost.txt
VBS set ttfile=fso.opentextfile("C:\WINNT\system32\cost.txt",forreading)
VBS Dim i,j
i=0
//讀取位置不在文件結尾循環
While -1<>ttfile.atendofstream
    //讀一行
    VBS read=ttfile.readline
    //計數器加1
    i=i+1
EndWhile
VBS ttfile.Close
//下面一行的10為初始使用次數
j=10-i
VBSCall MessageBox("剩餘次數:"&j&"次")
//j=0時,建立文件yn.txt
If 0=j
    VBS set fso=CreateObject("Scripting.FileSystemObject")
    VBS set ynfile=fso.createtextfile("C:\WINNT\system32\yn.txt")
EndIf
/////////////////正文腳本////////////////
VBSCall RunApp("notepad.exe")
VBSCall SayString(i)
//////////////////////////////////////////
Rem over

本腳本只為簡單的加密,意在交流
arrow
arrow
    全站熱搜

    魔幻小鱉 發表在 痞客邦 留言(2) 人氣()