Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

generate a vbscript code to delete a word using random function and retyping the same character which was deleted

$
0
0

I am new to VBscript, i want a code that can delete any random word and then replace it with the same character I deleted,!! Here is the code,

Dim SearchString, SearchChar
Dim intLength, MyPos

' Open file containing Search String and store it in variable used by all functions
'
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile1 = objFSO.OpenTextFile("D:\Google Search String.txt",1)

SearchString =objFile1.ReadLine
'


WScript.Sleep4000
' Create Shell Object used for typing command by all functions
'
Set WshShell = WScript.CreateObject("WScript.Shell")

'Call random function

TypeConstantSpeed(SearchString)

Function TypeConstantSpeed(strSearchString)

For MyPos = 1ToLen(strSearchString)

            SearchChar = Mid(strSearchString,MyPos,1)
            
            Function Rand(min,max)
            max=4
            min=1
            Randomize
            Rand =(Int((max-min+1)*Rand+min))
            EndFunction
            'WScript.Echo SearchChar
            WshShell.SendKeys SearchChar
            WScript.Sleep500

Next

WshShell.SendKeys"{ENTER}"

EndFunction

1. I know first i have to calculate the length of a string, and use random function and then write backspace code and then retype the deleted value, !I know the logic but i am finding it difficult to execute,!! If any help isgiven it will be appreciated!! Please Help! Thank you.


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>