Posting my autoexplore here since I can't get a plugin to work

December 09, 2011 06:42AM
Edit: Phorum software ate some of my less than and greater than signs in the script, the below should work now though.

When you browse for the file to read line by line, you'll have to alt+tab to the file dialog box. Windows 7 doesn't include the UserAccounts.Commondialog for making a typical file dialog in vbscript so I had to use a workaround.

How to use:
First make a text file with only the commands you want to send. You have three aliases to make it work so typing:

startexplore - Opens a file dialog box to browse to a text file you want to read line by line, remember you have to alt+tab to get to the file dialog box.
pauseexplore - Pauses reading the text file
resumeexplore - Picks up where you left after pausing.

This is what you will have to do to setup the rest.
Setup a timer:
Interval: however long you want, I use two seconds
Label: readtext
script: readline

Setup three aliases:

Alias: pauseexplore
label: pauseexplore
script: pauseexplore

Alias: resumeexplore
label: resumeexplore
script: resumeexplore

Alias: startexplore
label: startexplore
script: startexplore

Copy and paste the following into a text file named script.vbs and configure your world to use that file as script, with language being vbscript.

sub readline(name)
numLine = world.getvariable ("numLine")
fileLines = world.getvariable ("fileLines")
strFilePath = world.getvariable ("strFilePath")
if numLine = fileLines Then
world.enabletimer "readtext", FALSE
world.note "Finished..."
Exit Sub
end if
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(strFilePath, ForReading)
For i = 1 to numLine
strLine = objTextFile.ReadLine
world.send strLine
numLine = numLine + 1
world.setvariable "numLine", numLine
end sub

Function ChooseFile( )
Dim objFSO, objShell, objTempFolder, strTempFileName, strFullTempFileName, objOpenFile, objTextFile, strTempTextFileName
Const TemporaryFolder = 2
Const ForReading = 1
strTempFileName = "OpenFile.hta"
strTempTextFileName = "OpenFile.txt"
Set objFSO= CreateObject("Scripting.FileSystemObject")
Set objTempFolder = objFSO.GetSpecialFolder(TemporaryFolder)
strFullTempFileName=objTempFolder.Path & "\" & strTempFileName
Set objOpenFile = objFSO.CreateTextFile(strFullTempFileName,True)
objOpenFile.writeline("<html><head><meta http-equiv=""Content-Type"" content=""text/html; charset=windows-1252"">")
objOpenFile.writeline("<title>Open File</title>")
objOpenFile.writeline("<script language=""vbscript"">")
objOpenFile.writeline("Sub Window_Onload")
objOpenFile.writeline("WriteFile FileName.value")
objOpenFile.writeline("End Sub")
objOpenFile.writeline("Sub WriteFile(strFileName)")
objOpenFile.writeline("Dim objFSO, objTempFolder, strTempFileName, strFullTempFileName, objOpenFile")
objOpenFile.writeline("Const TemporaryFolder = 2")
objOpenFile.writeline("strTempFileName = ""OpenFile.txt""")
objOpenFile.writeline("Set objFSO=CreateObject(""Scripting.FileSystemObject"")")
objOpenFile.writeline("Set objTempFolder = objFSO.GetSpecialFolder(TemporaryFolder)")
objOpenFile.writeline("strFullTempFileName=objTempFolder.Path & ""\"" & strTempFileName")
objOpenFile.writeline("Set objOpenFile = objFSO.CreateTextFile(strFullTempFileName,True)")
objOpenFile.writeline("Set objFSO=Nothing")
objOpenFile.writeline("Set objTempFolder=Nothing")
objOpenFile.writeline("Set objSleepFile=Nothing")
objOpenFile.writeline("Set objShell=Nothing")
objOpenFile.writeline("End Sub")
objOpenFile.writeline("<hta:application applicationname=""Open File"" border=""dialog"" borderstyle=""normal"" caption=""Open File"" contextmenu=""no"" maximizebutton=""no"" minimizebutton=""no"" navigable=""no"" scroll=""no"" selection=""no"" showintaskbar=""no"" singleinstance=""yes"" sysmenu=""no"" version=""1.0"" windowstate=""minimize"">")
objOpenFile.writeline("<input Application=""True"" type=""file"" id=""FileName"" />")
Set objShell = CreateObject("WScript.Shell")
objShell.Run "mshta.exe " & strFullTempFileName,2,True
objFSO.DeleteFile strFullTempFileName, True
Set objShell=Nothing
Set objOpenFile=Nothing
strFullTempFileName = objTempFolder.Path & "\" & strTempTextFileName
Set objTextFile=objFSO.OpenTextFile(strFullTempFileName, ForReading)
ChooseFile = objTextFile.ReadLine
objFSO.DeleteFile strFullTempFileName, True
Set objTextFile=Nothing
Set objFSO=Nothing
Set objTempFolder=Nothing
End Function

sub startexplore(n, o, wc)
Const ForReading = 1
Const ForWriting = 2
strFilePath = ChooseFile
world.setvariable "strFilePath", strFilePath

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFilePath, ForReading)

Do Until objFile.AtEndOfStream
strLine = objFile.ReadLine
fileLines = i
i = i + 1

world.note "Starting the explore..."
world.setvariable "numLine", 0
world.setvariable "fileLines", fileLines
world.enabletimer "readtext", TRUE
end sub

sub pauseexplore(n, o, wc)
world.note "Pausing the explore..."
world.enabletimer "readtext", FALSE
end sub

sub resumeexplore(n, o, wc)
world.note "Resuming explore..."
world.enabletimer "readtext", TRUE
end sub

sub onClose()
world.enabletimer "readtext", FALSE
world.EnableTrigger "entrig", FALSE
world.EnableTrigger "lookatit", FALSE
world.EnableTrigger "distrig", FALSE
end sub

Edited 3 time(s). Last edit at 12/09/2011 06:49AM by reject-o.
Subject Author Posted

MUSHclient Tips and Tricks

joecloud December 08, 2011 03:18PM

Re: MUSHclient Tips and Tricks

sketch219 January 27, 2012 06:22PM

Unlimited targeting system

joecloud December 10, 2011 06:41AM

My MUSHclient triggers and aliases are these

DurNominator(VIP) December 09, 2011 11:14AM

Posting my autoexplore here since I can't get a plugin to work

reject-o December 09, 2011 06:42AM

Speedwalk/run in any direction until you cannot

joecloud December 08, 2011 07:56PM

Improved Exits Line

joecloud December 09, 2011 05:30AM

*No way! You are still fighting!

joecloud December 08, 2011 09:02PM

Timer safeguard (recommended addition)

joecloud December 08, 2011 08:15PM

Recommended becomes somewhat required

joecloud December 08, 2011 08:54PM

Prefix any command by where

joecloud December 08, 2011 06:02PM

Add target to any command (single targetting system)

joecloud December 08, 2011 05:52PM

Important fix

joecloud December 10, 2011 06:28AM

Digit Aliases for Quick Shortcuts

joecloud December 08, 2011 05:29PM

Small bug fix

joecloud December 09, 2011 03:13PM

Heh I've actually been working on some stuff for MUSHClient

reject-o December 08, 2011 03:57PM

I'd like to see some of this...

joecloud December 08, 2011 05:06PM

Here ya go..

reject-o December 09, 2011 06:08AM

Use Directions as Aliases

joecloud December 08, 2011 03:44PM

Better Command Stacking (Support Aliases)

joecloud December 08, 2011 03:37PM

OK, the forums stripped the space out of "space star." Don't miss the space. (n/t)

joecloud December 08, 2011 05:11PM

Look and Consider

joecloud December 08, 2011 03:30PM

I use something similar to this - careful if you're playing a transmuter!

Coumidin December 08, 2011 03:55PM

Yeah. I popped out deep in Aran-Gird's dungeon

daurwyn(VIP) December 12, 2011 09:55AM

Slap Self Solution

joecloud December 08, 2011 05:09PM

Just use Send instead of Execute to avoid other aliases firing, it takes less script execution time too (n/t)

Mort December 09, 2011 03:47AM

Good point -- I'm just in the habit of using Execute because I usually want other aliases to fire. In this case you don't. (n/t)

joecloud December 09, 2011 05:31AM

Quick Look/Scan/Unlock/Open

joecloud December 08, 2011 03:24PM

Combo Unlock and Open

joecloud December 08, 2011 03:38PM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 41
Record Number of Users: 59 October 25, 2015
Record Number of Guests: 341 February 12, 2018