Jump to content

.VBS Insert text into the middle of a string


Recommended Posts

to all coders i need help, i need a .vbs code that can insert an inputed key from the first line insert to the second line between the link

mac=Inputbox("Enter MAC here","EXAMPLE","001f1f658279")

ie.navigate("http://169.254.1.1/main.cgi?mac_esn=(I WANT TO INSERT THE MAC HERE)a&catindex=3&pageindex=1&Session=1979932169")

ex. outcome it looks like this

ie.navigate("http://169.254.1.1/main.cgi?mac_esn=001f1f658279a&catindex=3&pageindex=1&Session=1979932169")

and this i dont know how to code this input a key without the colon but then the autcome will include the colon.

ESN=Inputbox("Enter Canopy ESN","EXAMPLE","d8813a")

oShell.SendKeys "d8:81:3a"

ex. outcome it looks like this d8:81:3a

once again thanks for any help. TIA

Edited by arlanne2
Link to comment
Share on other sites



mac=Inputbox("Enter MAC here","EXAMPLE","001f1f658279")

ie.navigate("http://169.254.1.1/main.cgi?mac_esn=(I WANT TO INSERT THE MAC HERE)a&catindex=3&pageindex=1&Session=1979932169")


mac=Inputbox("Enter MAC here","EXAMPLE","001f1f658279")

ie.navigate("http://169.254.1.1/main.cgi?mac_esn=(mac)a&catindex=3&pageindex=1&Session=1979932169")

If You Need To Have Quotes Around "mac"

Chr(34) = "


mac=Inputbox("Enter MAC here","EXAMPLE","001f1f658279")

ie.navigate("http://169.254.1.1/main.cgi?mac_esn=(Chr(34) & mac & Che(34))a&catindex=3&pageindex=1&Session=1979932169")

Link to comment
Share on other sites

Store the HTTP string in a variable:

HTTPString = "http://169.254.1.1/main.cgi?mac_esn=XXXXXXXXXXXXa&catindex=3&pageindex=1&Session=1979932169"

Now your REPLACE to put your MAC address in the place of XXXXXXXXXXXX

FinalHTTP = Replace (HTTPString, "XXXXXXXXXXXX", YourMAC)

Then call ie.Navigate with the new string

ie.navigate(FinalHTTP)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...