如果选项卡已打开并使用 Vbscript 中的新超链接刷新,如何识别该选项卡?

发布于 2024-11-09 18:43:32 字数 858 浏览 5 评论 0原文

我有一个脚本,可以打开一个带有变量的超链接,以拉出 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

缺⑴份安定 2024-11-16 18:43:32

如果您重复使用 targetName,这是一个自动功能
因此,您可以使用相同的目标和目标名称让每个网址有一个选项卡。像这样:

Window.Open variableHere, variableHere, "toolbar=no, menubar=no, location=no, directories=no"

我不记得 targetName 是否接受任何奇怪的字符,如果不接受,你可以替换

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"

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"
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文