0
私はこのようなHTAファイルにVBSスクリプトを持っています。しかし、何らかの理由でdrive()
関数を実行するとdriveOpen()
がdriveWrite()
より前に実行されます。この問題を解決するにはどうすればよいですか?VBSスクリプトスキップ機能
Sub Wait(Time)
Dim wmiQuery, objWMIService, objPing, objStatus
wmiQuery = "Select * From Win32_PingStatus Where Address = '1.1.1.1' AND Timeout = " & Time
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set objPing = objWMIService.ExecQuery(wmiQuery)
For Each objStatus In objPing
Next
End Sub
Function drive()
driveWrite()
driveOpen()
End Function
Function driveWrite()
document.getElementById("appstatus").innerHTML = "<h2 style='margin-bottom: 0px;'>Launching Google Drive...</h2>"
End Function
Function driveOpen()
Set IE = CreateObject("InternetExplorer.application")
IE.Visible = False
IE.Menubar = 0
IE.Toolbar = 0
IE.Statusbar = 0
IE.Left = -7
IE.Top = 0
IE.Height = screen.AvailHeight + 7
IE.Width = screen.AvailWidth + 14
IE.Navigate "https://login.tyreso.se/wa/auth?authmech=Personal-%20och%20elevinloggning&location=https%3a%2f%2flogin.tyreso.se%2fwa%2fauth%2fsaml%2f%3fSAMLRequest%3dfVLLTgIxFN2b%252BA%252BT7ueFJpKGGYMaIgnqBEYX7krnMhT7srcD%252BveWQYIudHt67nnc3tH1h5LRFhwKowuSJxmJQHPTCN0W5LmexENyXZ6fjZApaem482s9h%252FcO0EdhUiPtHwrSOU0NQ4FUMwVIPaeL8cOMDpKMWme84UaSaHpXEL1pN1ZYZXTbrpkU2hq2ae1bw4CvltJqqdTybQ0kejnGGuxjTRE7mGr0TPsAZflVnA3jQVYPLujlkObZK4mqb6cboQ8N%252Fou1PJCQ3td1FVdPi7oX2IoG3GNgF6Q1ppWQcKP29hVDFNsAr5jEEG%252BMCM6HgLdGY6fALcBtBYfn%252Bawga%252B8t0jTd7XbJSSZlaeeXif90gCZBSBlHUvbLpX0%252F92Or%252F6dnR3dSnvRH6Q%252Bp8vvT9l2md5WRgn9GYynN7tYB86GId13oMTFOMf%252B3W57kPSKaeNVTaafRAhcrAQ2J0vLg%252Bvs6ws18AQ%253D%253D%26RelayState%3dhttps%253A%252F%252Faccounts.google.com%252FCheckCookie%253Fcontinue%253Dhttps%25253A%25252F%25252Fdrive.google.com%25252Fdrive%25252F%2526service%253Dwise%2526hl%253Den%2526checkedDomains%253Dyoutube%2526checkConnection%253Dyoutube%25253A607%25253A1%2526pstMsg%253D1"
Do Until IE.ReadyState = 4
Wait(200)
Loop
IE.Document.All.Item("username").Value = user
IE.Document.All.Item("password").Value = pass
IE.Document.All.Item("Submit1").Click
Wait(2000)
Do Until IE.ReadyState = 4
Wait(200)
Loop
url = IE.LocationURL
If url="https://login.tyreso.se/wa/auth" Then
X=MsgBox("An error occured. Please stand by and try again.",0+16,"Login")
document.getElementById("appstatus").innerHTML = "<h2 style='margin-bottom: 0px;'>An error occured</h2>"
Else
IE.Visible = True
document.getElementById("appstatus").innerHTML = "<h2 style='margin-bottom: 0px;'>Google Drive has opened sucessfully</h2>"
End If
End Function
'ドライブを()'あなたのコードのAFAICSに呼び出されることはありません。 –
これは私のコード全体ではなく、VBSスクリプトです。私はこのスクリプトの外から "drive()"関数を実行します。 – CALKing
Weird ....あなたの関数 'driveWrite()'に戻りコードを追加し、その戻りコードに基づいて 'driveOpen'関数を呼び出します。 – ManishChristian