Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Rem Project Started Friday, June 17, 2016, 10:27:53 AM
- Rem Save this file as a .vbs instead of a .txt
- Dim DEVELOPER
- Rem To enable developer mode, change "DEVELOPER=False" to "DEVELOPER=True" without quotes.
- DEVELOPER=False
- Rem Declare Main
- Dim FSO
- Set FSO = WScript.CreateObject("Scripting.Filesystemobject")
- Dim Shell
- Set Shell=CreateObject ("Shell.Application")
- Dim WshShell
- Set WshShell = WScript.CreateObject("Wscript.Shell")
- Dim WatchDogPath
- Dim HotSpotPath
- Dim HotSpot
- Dim ID, TMPPath, ImmaHerePath, ImmaHere, ISExe, IconPath
- Rem has this script been converted to a direct executable
- If LCase ( FSO.GetExtensionName(WScript.ScriptFullName))="exe" Then ISExe=True Else ISExe=False
- Rem Check for Icon
- If ISExe Then
- IconPath=WScript.ScriptFullName
- Else
- IconPath=FSO.GetParentFolderName (WScript.ScriptFullName) & "\My HotSpot.ico"
- End If
- If Not FSO.FileExists (IconPath) Then
- Call CreateIcon (IconPath)
- End If
- Rem Request Administrator
- If WScript.Arguments.length =0 Then
- MsgBox "This App needs to be run as an administrator because NetSh.exe requires administrator's permission to set and start the HostedNetwork (HotSpot).",vbExclamation,"Administrator Permission required to use HostedNetwork."
- If ISExe Then
- Shell.ShellExecute WScript.ScriptFullName,"/uac","","runas",1
- Else
- Shell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName & Chr(34) & " /uac", "", "runas", 1
- End If
- WScript.Quit
- Else
- If WScript.Arguments(0)<>"/uac" Then
- MsgBox "This App needs to be run as an administrator because NetSh.exe requires administrator's permission to set and start the HostedNetwork (HotSpot).",vbExclamation,"Administrator Permission required to use HostedNetwork."
- If ISExe Then
- Shell.ShellExecute WScript.ScriptFullName,"/uac","","runas",1
- Else
- Shell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName & Chr(34) & " /uac", "", "runas", 1
- End If
- WScript.Quit
- End If
- End If
- Rem Developer false if not true
- If Not DEVELOPER Then
- DEVELOPER=False
- End If
- Rem Declare TempPath
- TMPPath=FSO.GetSpecialFolder (2) & "\HotSpot With NetShare"
- ImmaHerePath=TMPPath & "\IsThereAnybodyOUTTHERE.txt"
- Call StartHotSpotApp
- Sub StartHotSpotApp
- Rem Build temppath if it does not exist
- If Not FSO.FolderExists (TMPPath) Then
- FSO.CreateFolder (TMPPath)
- End If
- Rem Declare HotSpot Path
- ID=0
- Do
- HotSpotPath=TMPPath & "\HotSpot" & ID & ".hta"
- If FSO.FileExists (HotSpotPath) Then
- ID=ID+1
- Else
- Exit Do
- End If
- Loop
- Rem Declare WatchDog Path
- ID=0
- Do
- WatchDogPath=TMPPath & "\WatchDogTimer" & ID & ".txt"
- If FSO.FileExists (WatchDogPath) Then
- ID=ID+1
- Else
- Exit Do
- End If
- Loop
- Rem Create Watchdog
- FSO.CreateTextFile (WatchDogPath).Write ("uninitialized")
- Rem Create HotSpot app
- CreateMyHotSpot HotSpotPath
- Rem Start the HotSpot App
- Set HotSpot=Nothing
- Set HotSpot = WshShell.Exec ("mshta " & Chr (34) & HotSpotPath & Chr (34) & " /uac")
- Rem Watchdog the watchdog out of it.
- Dim UDate,LDate,DiffDate,ODate, UninitializeCount, NotDateCount, ErrCount, X, FileNotHere, FileTooSmall, MaxRetries
- MaxRetries=3
- On Error Resume Next
- LDate=Now
- UninitializeCount=0
- NotDateCount=0
- ErrCount=0
- FileNotHere=0
- FileTooSmall=0
- Do While HotSpot.Status=0
- WScript.Sleep 1200
- 'respond to ImmaHere
- If FSO.FileExists (ImmaHerePath) Then
- Set ImmaHere = FSO.GetFile (ImmaHerePath).OpenAsTextStream(2)
- ImmaHere.Write ("Welcome To The Machine")
- ImmaHere.Close
- Set ImmaHere=Nothing
- End If
- If Not FSO.FileExists (WatchDogPath) Then
- FileNotHere=FileNotHere+1
- If FileNotHere>=MaxRetries Then
- HotSpot.Terminate
- X=MsgBox ("Uh-Oh. The Watchdog file is missing. How would i know if the MyHotSpot app is still operational. Force Closed the window due to the WatchDog timer file missing. You may try to restart the My HotSpot app, your Hosted Network settings are unchanged.",vbRetryCancel + vbExclamation,"Missing WatchDogTimer.")
- If X=vbRetry Then
- Call StartHotSpotApp
- Exit Sub
- End If
- End If
- Else
- If FSO.GetFile (WatchDogPath).Size=0 Then
- FileTooSmall=FileTooSmall+1
- If FileTooSmall>=MaxRetries Then
- HotSpot.Terminate
- X=MsgBox ("It appears that the Watchdog timer function may have misfunctioned on the My HotSpot window. The Reset kept leaving the Watchdog file blank. This may be because the watchdog resetter can't access the watchdog file. Don't know why that would be. But you may try to restart the My HotSpot app. Your Hosted Network settings are unchanged.",vbRetryCancel + vbExclamation,"Empty Watchdog response.")
- If X=vbRetry Then
- Call StartHotSpotApp
- Exit Sub
- End If
- End If
- Else
- FileNotHere=0
- FileTooSmall=0
- Set ODate=FSO.GetFile (WatchDogPath).OpenAsTextStream (1,-2)
- UDate=ODate.ReadLine
- ODate.Close
- Set ODate=Nothing
- 'is the window even responsive?
- If UDate="uninitialized" Then
- UninitializeCount=UninitializeCount+1
- If UninitializeCount>=MaxRetries Then
- HotSpot.Terminate
- x=MsgBox ("It appears that the hotspot window failed to initialize properly. This is a common Bug in microsoft's MSHTA application. You can try again if you wish.",vbRetryCancel + vbExclamation,"HTA app failed to start.")
- If X=vbRetry Then
- Call StartHotSpotApp
- UninitializeCount=0
- Exit Sub
- End If
- End If
- Else
- 'it appears that the window is responsive
- 'is the window giving me a date
- If IsDate (UDate) Then
- NotDateCount=0
- 'record the date to last date for no reason
- If UDate <> LDate Then
- LDate = UDate
- End If
- 'If window has not reset the timer for a full minute (become unresponsive) then window will terminate
- If DateDiff ("s",UDate, Now) >60 Then
- HotSpot.Terminate
- X=MsgBox ("It appears that the HotSpot app has been unresponsive for at least a full minute (This could also be the result of waking the computer from sleep or hibernate. Since the Watchdog timer doesn't reset during sleep or hibernation.). So it has been terminated. However, the HostedNetwork may still be running if it was running while the My HotSpot App was open. You can try to run the program again.", vbExclamation + vbRetryCancel,"My HotSpot has become unresponsive.")
- If X=vbRetry Then
- Call StartHotSpotApp
- Exit Sub
- End If
- End If
- Else
- 'window has not given me a date or i had trouble reading it
- NotDateCount=NotDateCount+1
- If NotDateCount>=MaxRetries Then
- HotSpot.Terminate
- X=MsgBox ("There was " & MaxRetries & " consecutive errors relating to the watchdog timer's file not containing a usable date."&_
- vbCrLf & vbCrLf & "Here is what the File reads" & vbCrLf & UDate & vbCrLf & vbCrLf & " This is a Bug that the developer should be aware of. You can try restarting the app.",vbCritical + vbRetryCancel,"Error Unusable Date in Watchdog timer response file.")
- If X=vbRetry Then
- Call StartHotSpotApp
- Exit Sub
- End If
- End If
- End If
- If Err Then
- ErrCount = ErrCount+1
- Else
- ErrCount=0
- End If
- If ErrCount>=MaxRetries Then
- HotSpot.Terminate
- X=MsgBox ("ERROR there are " & MaxRetries & " consecutive errors (meaning of the last " & MaxRetries & " tries each of them resulted in an error) the last error recorded was" & vbCrLf &_
- "Source: " & Err.Source & vbCrLf &_
- "Number: " & Err.Number & vbCrLf &_
- "Description: " & Err.Description & vbCrLf & vbCrLf & vbCrLf &_
- "This is something that the developer should be aware of." & vbCrLf & vbCrLf & "You may try again if you want.",vbCritical + vbRetryCancel,MaxRetries & " Consecutive Errors")
- If X=vbRetry Then
- Call StartHotSpotApp
- Exit Sub
- End If
- End If
- Err.Clear
- End If
- End If
- End If
- Loop
- 'Clean up
- FSO.DeleteFile HotSpotPath,True
- FSO.DeleteFile WatchDogPath,True
- 'Check for other instances
- 'delete the tmpfolder if no other instances are running.
- FSO.OpenTextFile (ImmaHerePath,2,True).Write("")
- WScript.Sleep 5000
- If FSO.FileExists (ImmaHerePath) Then
- If FSO.GetFile (ImmaHerePath).OpenAsTextStream (1,-2).ReadAll="" Then
- FSO.DeleteFolder TMPPath,True
- End If
- End If
- End Sub
- Function RunAndGet (Command)
- Dim TMP, return,file,text,Textp, id
- id=1
- Do
- Textp= TMPPath & "\" & FSO.GetTempName & "out" & id & "put.txt"
- If FSO.FileExists (Textp) Then
- id=id+1
- Else
- Exit Do
- End If
- Loop
- return = WshShell.Run("cmd /c " & Command & " > " & Chr (34) & Textp & Chr(34), 0, True)
- Set file = FSO.OpenTextFile(Textp, 1)
- text = file.ReadAll
- file.Close
- Set file=Nothing
- FSO.DeleteFile Textp,True
- RunAndGet=text
- End Function
- Function CreateMyHotSpot (HotSpotPath)
- Dim HotSpot
- Set HotSpot=FSO.CreateTextFile (HotSpotPath)
- With HotSpot
- Rem Head (DO NOT IMPORT DIRECTLY FROM WINDOW)
- .WriteLine ("<!-- Rem Head (DO NOT IMPORT DIRECTLY FROM WINDOW) -->"):.WriteLine (vbTab & "<html>"):.WriteLine (vbTab & "<head>"):.WriteLine (vbTab & "<title>My HotSpot</title>"):.WriteLine (vbTab & "<HTA:APPLICATION"):.WriteLine (vbTab & "APPLICATIONNAME=""My HotSpot"""):.WriteLine (vbTab & "ID=""HotSpot"""):
- .WriteLine ("ICON=" & Chr (34) & IconPath & Chr (34)):
- .WriteLine (vbTab & "VERSION=""1.0""/>"):.WriteLine (vbTab & "</head>"):.WriteBlankLines (6)
- Rem Start Script
- .WriteLine ("<!-- Rem Start Script -->"):.WriteLine (vbTab & "<script language=""VBScript"">"):.WriteBlankLines (3)
- Rem SCRIPT: Declare Main (Objects, variablenames,etc)
- .WriteLine ("Rem SCRIPT: Declare Main (Objects, variablenames,etc)"):.WriteLine (vbTab & "Dim WatchdogPath, WatchDogTimer"):.WriteLine (vbTab & "Dim DEVELOPER"):.WriteLine("Dim WshShell,ImmaHerePath"):.WriteLine (vbTab & "Set WshShell = CreateObject(""WScript.Shell"")"):.WriteLine (vbTab & "Dim Shell"):.WriteLine (vbTab & "Set Shell=CreateObject(""Shell.Application"")"):.WriteLine (vbTab & "Dim FSO"):.WriteLine (vbTab & "Set FSO = CreateObject(""Scripting.Filesystemobject"")"):.WriteLine (vbTab & "Dim TMPPath, VbsName"):.WriteBlankLines (6)
- Rem SCRIPT: Declare TransMain (Variable Values. Caution, do not import directly from hta window source)
- .WriteLine ("Rem SCRIPT: Declare TransMain (Variable Values. Caution, do not import directly from hta window source)")
- .WriteLine (vbTab & "VbsName=" & Chr (34) & WScript.ScriptName & Chr (34)):
- .WriteLine (vbTab & "DEVELOPER=" & DEVELOPER):
- .WriteLine (vbTab & "ImmaHerePath=" & Chr (34) & ImmaHerePath & Chr (34)):
- .WriteLine (vbTab & "TMPPath=" & Chr (34) & TMPPath & Chr (34)):
- .WriteLine (vbTab & "WatchdogPath=" & Chr(34) & WatchDogPath & Chr (34)):
- .WriteBlankLines (5)
- Rem SCRIPT: Check Developer
- .WriteLine ("Rem SCRIPT: Check Developer"):.WriteLine (vbTab & "Sub CheckDeveloper"):.WriteLine (vbTab & " If Not DEVELOPER Then"):.WriteLine (vbTab & " DeveloperOptions.innerHTML=""<table border=""""10px"""" bgcolor=buttonface title=""""You can enable developer options by reading the source code of "" & VbsName & "". There are instructions on enabling it within the first 10 lines""""><tr><td bgcolor=buttonhighlight><strong><u><i><center>My Hotspot</center></i></u></strong></td></tr><tr><td>Turn your computer into a makeshift wifi LAN</td></tr></table>"""):.WriteLine (vbTab & " End If"):.WriteLine (vbTab & "End Sub"):.WriteBlankLines (3)
- Rem SCRIPT: Check UAC
- .WriteLine ("Rem SCRIPT: Check UAC"):.WriteLine (vbTab & "If Replace ( HotSpot.Commandline,""/uac"","""")=HotSpot.Commandline Then"):.WriteLine (vbTab & " MsgBox ""This App needs To be run as an administrator. because NetSh needs administrator privilages To start. No worries this program will Not harm your computer. Check the source code your self If you want."",vbExclamation"):.WriteLine (vbTab & " Shell.ShellExecute ""mshta.exe"", Chr(34) & document.location.pathname & Chr(34) & "" /uac"", """", ""runas"", 1"):.WriteLine (vbTab & " window.close"):.WriteLine (vbTab & "End If"):.WriteBlankLines (3)
- Rem SCRIPT: Window Onload
- .WriteLine ("Rem SCRIPT: Window Onload"):.WriteLine (vbTab & "Sub Window_OnLoad"):.WriteLine (" CheckDeveloper"):.WriteLine (vbTab & " WatchDogTimer= Self.setInterval (""WatchDogTimerReset"",1000)"):.WriteLine (vbTab & " output.value=UpdateConnectedList"):.WriteLine (vbTab & "End Sub"):.WriteBlankLines (3)
- Rem SCRIPT: OpenTmpPath
- .WriteLine ("Rem SCRIPT: OpenTmpPath"):.WriteLine (vbTab & "Sub OpenTmpPath"):.WriteLine (vbTab & " Shell.Explore (TMPPath)"):.WriteLine (vbTab & "End Sub"):.WriteBlankLines (3)
- Rem SCRIPT: Open With HTA Edit
- .WriteLine ("Rem SCRIPT: Open With HTA Edit"):.WriteLine (vbTab & "Sub OpenWithHTAEdit"):.WriteLine (vbTab & " On Error Resume Next"):.WriteLine (vbTab & " WshShell.Run ""htaedit "" & Chr (34) & Document.Location.Pathname & Chr (34)"):.WriteLine (vbTab & "End Sub"):.WriteBlankLines (3)
- Rem SCRIPT: Run And Get
- .WriteLine ("Rem SCRIPT: Run And Get"):.WriteLine (vbTab & "Function RunAndGet (Command)"):.WriteLine (vbTab & " Dim TMP, return,file,text,Textp, id"):.WriteLine (vbTab & " TMP=TMPPath"):.WriteLine (vbTab & " ID=1"):.WriteLine (vbTab & " Do"):.WriteLine (vbTab & " Textp= TMP & ""\"" & FSO.GetTempName & ""out"" & id & ""put.txt"""):.WriteLine (vbTab & " If FSO.FileExists (Textp) Then"):.WriteLine (vbTab & " id=id+1"):.WriteLine (vbTab & " Else"):.WriteLine (vbTab & " Exit Do"):.WriteLine (vbTab & " End If"):.WriteLine (vbTab & " Loop"):.WriteLine (vbTab & " return = WshShell.Run(""cmd /c "" & Command & "" > "" & Chr (34) & Textp & Chr(34), 0, True)"):.WriteLine (vbTab & " Set file = FSO.OpenTextFile(Textp, 1)"):.WriteLine (vbTab & " text = file.ReadAll"):.WriteLine (vbTab & " file.Close"):.WriteLine (vbTab & " Set file=Nothing"):.WriteLine (vbTab & " FSO.DeleteFile Textp,True"):.WriteLine (vbTab & " RunAndGet=text"):.WriteLine (vbTab & "End Function"):.WriteBlankLines (3)
- Rem SCRIPT: Show Hide Password
- .WriteLine ("Rem SCRIPT: Show Hide Password"):.WriteLine (vbTab & "Sub ShowHidePassword"):.WriteLine (vbTab & " If chkShowPassword.checked Then"):.WriteLine (vbTab & " passwordfield.innerhtml=""<input id=Password type=text value="" & Chr (34) & password.value & Chr (34) & ""title="" & Chr (34) & Password.Title & Chr (34) & "">"""):.WriteLine (vbTab & " Else"):.WriteLine (vbTab & " passwordfield.innerhtml=""<input id=Password type=password value="" & Chr (34) & password.value & Chr (34) & ""title="" & Chr (34) & Password.Title & Chr (34) & "">"""):.WriteLine (vbTab & " End If"):.WriteLine (vbTab & "End Sub"):.WriteBlankLines (3)
- Rem SCRIPT: StartHotSpot3
- .WriteLine ("Rem SCRIPT: StartHotSpot3"):.WriteLine (vbTab & "Sub StartHotSpot3"):.WriteLine (vbTab & " Dim asdf,jkl,jklk"):.WriteLine (vbTab & " jkl= RunAndGet (""netsh wlan Set hostednetwork mode=allow ssid="" & Chr (34) & ssid.value & Chr (34) & "" key="" & Chr (34) & password.value & Chr(34))"):.WriteLine (vbTab & " jklk= RunAndGet (""netsh wlan start hostednetwork"")"):.WriteLine (vbTab & " output.value=jkl & vbCrLf & jklk & vbCrLf & UpdateConnectedList"):.WriteLine (vbTab & "End Sub"):.WriteBlankLines (3)
- Rem SCRIPT: StopHotSpot3
- .WriteLine ("Rem SCRIPT: StopHotSpot3"):.WriteLine (vbTab & "Sub StopHotSpot3"):.WriteLine (vbTab & " Dim jkl"):.WriteLine (vbTab & " jkl=RunAndGet (""netsh wlan stop hostednetwork"")"):.WriteLine (vbTab & " output.value=jkl"):.WriteLine (vbTab & "End Sub"):.WriteBlankLines (3)
- Rem SCRIPT: UpdateConnectedList
- .WriteLine ("Rem SCRIPT: UpdateConnectedList"):.WriteLine (vbTab & "Function UpdateConnectedList"):.WriteLine (vbTab & " Dim aj,ja"):.WriteLine (vbTab & " ja=RunAndGet (""netsh wlan show hostednetwork"")"):.WriteLine (vbTab & " UpdateConnectedList=ja"):.WriteLine (vbTab & "End Function"):.WriteBlankLines (3)
- Rem SCRIPT: WatchDogTimerReset
- .WriteLine ("Rem SCRIPT: WatchDogTimerReset"):.WriteLine (vbTab & "Sub WatchDogTimerReset"):.WriteLine (vbTab & " On Error Resume Next"):.WriteLine (vbTab & " Dim asdf,jkl"):.WriteLine (vbTab & " Set asdf=FSO.GetFile (WatchdogPath).OpenAsTextStream (2)"):.WriteLine (vbTab & " asdf.Write (Now)"):.WriteLine (vbTab & " asdf.Close"):.WriteLine (vbTab & " Set asdf=Nothing"):.WriteLine (vbTab & " If FSO.FileExists (ImmaHerePath) Then"):.WriteLine (vbTab & " Set jkl = FSO.GetFile (ImmaHerePath).OpenAsTextStream (2)"):.WriteLine (vbTab & " jkl.Write(""WhenIWasAChildICaughtAFleetingGlimpseFromTheCornerOfMyEye"")"):.WriteLine (vbTab & " jkl.Close"):.WriteLine (vbTab & " Set jkl=Nothing"):.WriteLine (vbTab & " End If"):.WriteLine (vbTab & "End Sub"):.WriteBlankLines (3)
- Rem END SCRIPT
- .WriteLine ("Rem END SCRIPT"):.WriteLine (vbTab & "</script>"):.WriteBlankLines (3)
- .WriteBlankLines (10)
- Rem Start Body
- .WriteLine ("<!-- Rem Start Body -->"):.WriteLine (vbTab & "<body bgcolor=""white"">"):.WriteLine (vbTab & "<center>"):.WriteBlankLines (3)
- Rem BODY: Developer Options
- .WriteLine ("<!-- Rem BODY: Developer Options -->"):.WriteLine (vbTab & "<Span ID=DeveloperOptions>"):.WriteLine (vbTab & " <table border=""10px"" bgcolor=buttonface><tr><td bgcolor=buttonhighlight>"):.WriteLine (vbTab & " <strong><u><i><center>You Are a DEVELOPER</center></i></u></strong></td></tr><tr><td>"):.WriteLine (vbTab & " <button onclick=OpenWithHTAEdit title=""Open HTA edit with this window's source code."">Open With HTA Edit.</button>"):.WriteLine (vbTab & " <button onclick=OpenTmpPath title=""Open the path to this app and view and edit the files associated with this program."">Open TmpPath</button>"):.WriteLine (vbTab & " </td></tr></table>"):.WriteLine (vbTab & "</span>"):.WriteBlankLines (3)
- Rem BODY: SSID
- .WriteLine ("<!-- Rem BODY: SSID -->"):.WriteLine (vbTab & "Network Name (SSID): <input id=SSID type=text value=Name title=""Name of the hotspot. this Is what will be visible To other devices"">"):.WriteLine (vbTab & "<br>"):.WriteBlankLines (3)
- Rem BODY: Key
- .WriteLine ("<!-- Rem BODY: Key -->"):.WriteLine (vbTab & "Network Password      : "):.WriteLine (vbTab & "<span id=PasswordField><input id=Password type=password value=password title=""Password of the hotspot. you will need To input this password In order To connect To this hotspot.""> "):.WriteLine (vbTab & "</span>"):.WriteLine (vbTab & "<br>"):.WriteLine (vbTab & "<span onclick=showhidepassword title=""When Checked, the password will be visible. When Unchecked, the password will not be visible."">"):.WriteLine (vbTab & "<input id=CHKShowPassword type=checkbox>"):.WriteLine (vbTab & "<span onclick=""CHKShowPassword.Checked=Not CHKShowPassword.checked"" onmouseenter=""document.body.style.cursor='hand'"" onmouseleave=""document.body.style.cursor=''"">"):.WriteLine (vbTab & "Show Password"):.WriteLine (vbTab & "</span></span>"):.WriteLine (vbTab & "<br>"):.WriteBlankLines (3)
- Rem BODY: Buttons
- .WriteLine ("<!-- Rem BODY: Buttons -->"):.WriteLine (vbTab & "<button onclick=StartHotSpot3 title=""Launches the hotspot With the SSID And Password provided"">Launch</button>"):.WriteLine (vbTab & "<button onclick=StopHotSpot3 title=""Terminate the hotspot"">Stop</button>"):.WriteLine (vbTab & "<button onclick=""output.value=updateconnectedlist"" title=""Update the info"">Update List</button>"):.WriteLine (vbTab & "<br>"):.WriteBlankLines (3)
- Rem BODY: OutPut
- .WriteLine ("<!-- Rem BODY: OutPut -->"):.WriteLine (vbTab & "<textarea id=output cols=100 rows=20 title=""Displays the informations, errors, warnings, status, etc. from the netsh command""></textarea>"):.WriteBlankLines (3)
- Rem END
- .WriteLine ("<!-- Rem END -->"):.WriteLine (vbTab & "</center>"):.WriteLine (vbTab & "</body>"):.WriteLine (vbTab & "</html>")
- .Close
- End With
- End Function
- Sub CreateIcon (Path)
- Dim FSO
- Set FSO = CreateObject("Scripting.Filesystemobject")
- Dim asdf, return
- Rem binary data for the Icon
- Return="!;!;#;!;#;!;E;E;!;!;#;!;*;!;Ð;*;!;!;9;!:3;M;!:3;E;!:3;e;!:3;#;!;*;!:5;¨;&;!:11;#;!:10;@:3;!;¨;!;¨;!;¨;¨;!;!;¨:3;!;¨;@;@;!;+8;†;e;!;+8:3;!;+8;è;è;!;+8;e;E;!;+8;@;@;!;e;+8;†;!;+8;¨;†;!;E;+8;†;!;è;¨;È;!;+8;!;è;!;@;+8;+8;!;†;+8;†;!;E;è;¨;!;e;+8;¨;!;+8;¨;È;!;E;¨;È;!;e;¨;È;!;è;è;È;!;e;†;è;!;+8;+8;è;!;È;!;è;!;E;!;+8;!;¨;!;+8;!;+8;E;+8;!;È;E;!;!;e;e;E;!;E;¨;¨;!;!;È;¨;!;!;È;È;!;E;È;È;!;†;È;È;!;+8;è;È;!;+v:3;!;+v;@;@;!;+u;¨;‘;!;+v;+g;+g;!;+u;°;š;!;+g;+v;+v;!;@;+v;+v;!;+g;ð;è;!;+g;+8;+0;!;+u;+(;†;!;+u;¸;+(;!;+g;è;à;!;+g;ø;ð;!;+g;+0;+0;!;Ð;+(;];!;+g;°;š;!;+g;à;Ð;!;+g;+0;ø;!;+g;+u;+8;!;+v;+u;+u;!;+v;+v;+g;!;+v;+v;@;!;Ð;š;U;!;¸;š;];!;È;M;‘;!;+g;Ð;À;!;+g;+u;+u;!;+g;¨;‘;!;+g;+g;+u;!;ð;+g;+v;!;+g;+v;@;!;+u;¨;†;!;À;M;‘;!;À;U;‘;!;+u;°;‘;!;+v;¸;+(;!;+v;Ø;È;!;+g;à;Ø;!;+v;à;Ø;!;+v;+8;+8;!;@;+v;+g;!;@;+v;@;!;Ø;‘;M;!;Ð;š;];!;Ð;+(;e;!;š;M;};!;‘;u;};!;š;†;};!;¨;M;†;!;È;M;†;!;È;U;‘;!;+v;¨;‘;!;+v;°;‘;!;+v;°;š;!;+g;¸;+(;!;+g;À;¨;!;+u;à;Ð;!;+v;è;Ø;!;+g;ð;à;!;+g;+g;+v;!;ø;+v;+v;!;Ð;š;M;!;°;+(;e;!;¨;+(;m;!;‘;e;u;!;È;" &_
- "m;u;!;‘;e;};!;È;e;};!;Ð;m;};!;†;};};!;+(;†;};!;°;M;†;!;š;¸;‘;!;‘;À;+(;!;+u;À;°;!;+g;È;°;!;+u;È;¸;!;‘;Ð;¸;!;+v;Ð;¸;!;+u;Ð;À;!;‘;Ø;À;!;‘;Ø;È;!;†;à;È;!;+(;Ø;Ð;!;+g;Ø;Ð;!;è;à;Ð;!;à;ø;ð;!;¸;+0;+0;!;+v;+8;+0;!;À;+8;+8;!;+v;+u;+8;!;ø;+g;+v;!;+8;+v;@;!;+u;+v;@;!;È;‘;U;!;°;š;U;!;À;š;U;!;À;‘;];!;À;š;];!;¸;+(;];!;Ø;+(;];!;+(;};e;!;°;};e;!;Ð;};e;!;Ð;†;e;!;°;š;e;!;Ð;š;e;!;¨;+(;e;!;¸;+(;e;!;È;m;m;!;Ð;m;m;!;Ð;u;m;!;+(;‘;m;!;È;‘;m;!;°;¨;m;!;+(;U;u;!;†;];u;!;+(;e;u;!;};m;u;!;Ð;u;u;!;+(;};u;!;Ð;};u;!;¨;‘;u;!;†;M;};!;‘;U;};!;†;];};!;¨;];};!;†;e;};!;};m;};!;†;u;};!;‘;};};!;š;};};!;¨;‘;};!;è;+(;};!;+0;+(;};!;+u;+(;};!;†;°;};!;°;E;†;!;+(;U;†;!;+(;e;†;!;†;m;†;!;‘;m;†;!;};u;†;!;+(;u;†;!;‘;†;†;!;¨;+(;†;!;À;+(;†;!;+8;+(;†;!;+g;+(;†;!;à;¨;†;!;ð;¨;†;!;‘;°;†;!;š;°;†;!;‘;¸;†;!;+(;¸;†;!;¸;E;‘;!;°;U;‘;!;Ð;U;‘;!;š;m;‘;!;e;};‘;!;‘;†;‘;!;‘;š;‘;!;¸;š;‘;!;Ð;+(;‘;!;†;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;Z;^;K:3;!:4;K;W;O;O;Z;+r;+m;Ý;c;l;k;Ž;‰;¬;¬;a;a;¶;l;c;Ñ;+m;[;f;W;K:3;!:4;];[;O;O;M;›;L;+h;Â;–;c;’;¿;Y;w;Y;v;’;–;Í;+s;r;¢;M;d;e;K;N;!:4;X;O;M;M;T;œ;L;+=;Ó;•;Œ;x;´;®;b;±;¾;Â;•;ä;n;\;M:3;S;K;N;!:4;^;d;œ;d;š;W;K;S;+o;Ÿ;+p;+6;@:3;¥;¤;+9;+f;›;„;g;d;œ;œ;];K;N;!:4;P;K:4;`;N;K;P;P;t;Q;#:3;t;Q;Q;P;P;K:8;!:66;@:8;è;!;!;);è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;" &_
- "!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;è;!;!;%;@;@;@;@;@;@;@;@"
- asdf=ConvertTextToBinary (return)
- FSO.CreateTextFile (Path).Write asdf
- End Sub
- '##########################################
- '# #
- '# Function #
- '# #
- '# ConvertByte Function #
- '# #
- '##########################################
- '# #
- '# This function is used by ConvertTextto #
- '# Binary function and the convertbinary #
- '# toText function. Opt is the string to #
- '# be converted opt2 is conversion method #
- '# Opt2 is true when converting binary to #
- '# text, opt2 is false when converting #
- '# text to binary. #
- '# #
- '##########################################
- Function ConvertByte (stringToBeConverted,Method)
- Dim ArrChrList,iconvertine,Opt,Opt2
- Opt=stringToBeConverted
- Opt2=Method
- ArrChrList=Array ("!","#","$","%","&","'","(",")","*",",","-",".","/",_
- "0","1","2","3","4","5","6","7","8","9","<","=",">","?","+@","A","B","C",_
- "D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U",_
- "V","W","X","Y","Z","[","\","]","^","_","`","a","b","c","d","e","f","g",_
- "h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y",_
- "z","{","|","}","~","","€","‚","ƒ","„","…","†","‡","ˆ","‰","Š","‹","Œ",_
- "Ž","‘","’","“","”","•","–","—","™","š","›","œ","ž","Ÿ","+#","+$","+%",_
- "+(","¡","¢","£","¤","¥","¦","§","¨","©","ª","«","¬","","®","¯","°","±",_
- "²","³","´","µ","¶","·","¸","¹","º","»","¼","½","¾","¿","À","Á","Â","Ã",_
- "Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ",_
- "Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç",_
- "è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù",_
- "ú","û","ü","ý","þ","ÿ","+0","+1","+2","+3","+4","+5","+6","+7","+8","+9",_
- "+q","+w","+e","+r","+t","+y","+u","+i","+o","+p","+a","+s","+d","+f","+g",_
- "+h","+j","+k","+l","+z","+x","+c","+v","+b","+n","+m","+~","+=","+!","@")
- If opt2 Then
- 'Convert asc (Binary) to Text
- ConvertByte=ArrChrList (opt)
- Else
- 'Convert Text to asc(Binary)
- For iconvertine=0 To 255
- If opt=ArrChrList (iconvertine) Then
- ConvertByte=iconvertine
- Exit Function
- End If
- Next
- End If
- End Function
- '##########################################
- '# #
- '# Function #
- '# #
- '# ConvertTextToBinary Function #
- '# #
- '##########################################
- '# #
- '# This function will convert text data #
- '# to binary data. use with LoadImage #
- '# function to (re)create the picture. #
- '# #
- '##########################################
- Function ConvertTextToBinary (sText)
- Dim FSO
- Set FSO = WScript.CreateObject("Scripting.Filesystemobject")
- Dim I, ID, FileObject, Reading, arrBytes, arrText, Return
- Dim XIDI, BenjaminFranklin, StrText
- Dim Text, LastRead, SameReads, SplitText, IDI
- ' Dim FilePath
- StrText=sText
- arrText=Split (Replace (Replace (StrText,vbLf,""),vbCr,""),";")
- arrBytes=Array
- ID=0
- IDI=0
- I=0
- ID=0
- Do
- Text=arrText(I)
- Text=Replace (Text,";","")
- 'MsgBox "Text : " & Text
- 'found possible repeating bytes
- If Replace (Text,":","")<>Text Then
- 'found repeating bytes
- SplitText=Split (Text,":")
- LastRead=SplitText (0)
- SameReads=SplitText (1)
- LastRead=ConvertByte (LastRead,False)
- IDI=I
- XIDI=I
- 'write each byte seperate
- BenjaminFranklin=Chr (LastRead)
- For IDI=0 To SameReads-1
- ' 'MsgBox "idi " & IDI & " out of " & samereads
- ReDim Preserve arrBytes(ID)
- arrBytes(ID)=BenjaminFranklin
- ID=ID+1
- Next
- Else
- 'Did not find a repeating byte
- Text=ConvertByte (Text,False)
- ReDim Preserve arrBytes(ID)
- arrBytes(ID)=Chr(Text)
- ID=ID+1
- 'MsgBox "is " & I & " > " & UBound (arrText) & " " & ( I > UBound (arrText))
- If I > UBound (arrText) Then
- 'MsgBox " final exit do"
- Exit Do
- End If
- End If
- I=I+1
- If I>UBound (arrText) Then
- 'MsgBox "I think an error shows here"
- Exit Do
- End If
- Loop
- Return=Join (arrBytes,"")
- ConvertTextToBinary=Return
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement