I have a script that opens a hyperlink with a variable to pull up the particular account on the intranet. However, if the "module" is open already (80% of the hyperlink is the same), I would like to just keep the same tab/window open and refresh it.
Right now my Vbscript merely uses the script host and opens in a new tab each time. Since the user may have multiple tabs open, I'm not sure how to indentify if they have the link I want open and then use that window to refresh the data.
Begin pseudocode Script Sub
dim LINK as string
dim variableHere as string
LINK = "link/section/comments.aspx/account=" & variableHere & "&SID=11111"
variableHere = APIAccountNumberAccessed
IF ("link/section/comments.aspx/account=" exists)
then open hyperlink in same tab: LINK
else open in new tab
End IF
End pseudocode Sub
UPDATE:
I've made some progress in identifying that one can use the Window.Open method to set the target name and open a link. However, I'm still getting an error.
Syntax
set varWindow = Window.Open "google.com", "targetName", "toolbar=no, menubar=no, location=no, directories=no"
This provides me with the error expected end of statement, error code 800A0401, right 开发者_开发百科in the Window open line. Still can't get past this part.
This is an automatic feature if you reuse the targetName
so, you can use same destination and targetName to have one tab per url. like this:
Window.Open variableHere, variableHere, "toolbar=no, menubar=no, location=no, directories=no"
i don't remember if targetName accepts any strange character if not, you can replace
validName = variableHere
validName = replace(validName,"/","_")
validName = replace(validName,".","_")
validName = replace(validName,",","_")
'... and so on ...
Window.Open variableHere, validName, "toolbar=no, menubar=no, location=no, directories=no"
精彩评论