如果选项卡已打开并使用 Vbscript 中的新超链接刷新,如何识别该选项卡?
我有一个脚本,可以打开一个带有变量的超链接,以拉出 Intranet 上的特定帐户。但是,如果“模块”已经打开(80% 的超链接是相同的),我只想保持相同的选项卡/窗口打开并刷新它。
现在,我的 Vbscript 仅使用脚本主机并每次在新选项卡中打开。由于用户可能打开了多个选项卡,我不确定如何识别他们是否有我想要打开的链接,然后使用该窗口刷新数据。
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
更新:
我在确定可以使用 Window.Open 方法设置目标名称并打开链接方面取得了一些进展。但是,我仍然收到错误。
语法
set varWindow = Window.Open "google.com", "targetName", "toolbar=no, menubar=no, location=no, directories=no"
这为我提供了错误预期语句结束,错误代码 800A0401,就在窗口打开行中。这一段还是过不了。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您重复使用 targetName,这是一个自动功能
因此,您可以使用相同的目标和目标名称让每个网址有一个选项卡。像这样:
我不记得 targetName 是否接受任何奇怪的字符,如果不接受,你可以替换
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:
i don't remember if targetName accepts any strange character if not, you can replace