Hta Error Object Required Wscript
Contents |
(עברית)المملكة العربية السعودية (العربية)ไทย (ไทย)대한민국 (한국어)中华人民共和国 (中文)台灣 (中文)日本 (日本語) HomeLibraryLearnDownloadsRepositoryCommunityForumsBlog Ask a question Quick access Forums home Browse forums users FAQ Search related threads Remove From My Forums Answered by: HTA file Windows 7 Scripting > The Official Scripting object required wscript error in vbscript Guys Forum! Question 0 Sign in to vote In my HTA i
800a01a8 Object Required
am trying to get my script to read the current directory, and then run a file based wscript.sleep object required on the current directory\anotherDirectory\filename If i use this code: Sub test() Set WshShell = CreateObject("WScript.Shell") info = WshShell.CurrentDirectory MsgBox info End Sub I get C:\Windows\System32\Wscript.exe If
Set Objshell = Wscript.createobject( Wscript.shell ) Object Required
i use this code: Sub test() Set WshShell = WScript.CreateObject("WScript.Shell") info = WshShell.CurrentDirectory MsgBox info End Sub I get an error: Object required "Wscript" The second example returns the correct current directory when run as a .vbs file. Can anyone assist me with this? Regards, Kevin Tuesday, December 22, 2009 4:49 AM Reply | Quote activex component can t create object wsh wscript Answers 1 Sign in to vote Sorry, you're right, I had scrolled down on the page and didn't read the first part of the post. The question at this point is what the OP expects the current directory to be. Most likely, mshta.exe's current directory is %SystemRoot%\system32, and the executable's starting directory is likely what the CurrentDirectory property returns. My guess is the OP could use the parent folder of the location object's pathname property. For example: Dim FSO Set FSO = CreateObject("Scripting.FileSystemObject") MsgBox FSO.GetParentFolderName(location.pathname) The pathname property of the location object returns the HTA's file name, and thus the FileSystemObject's GetParentFolderName method will return the directory where the HTA file is located. HTH, Bill Marked as answer by Kevin_Elwell Saturday, January 02, 2010 3:23 PM Tuesday, December 22, 2009 11:00 PM Reply | Quote Moderator All replies 1 Sign in to vote Hi, IIRC, the WScript object doesn't exist in HTAs. However, you can use VBScript's CreateObject function instead. That is, use this code instead: Set WshShell = CreateObject("WScript.Shell") This way you'
von GoogleAnmeldenAusgeblendete FelderNach Gruppen oder Nachrichten suchen
type your message and try again. 7 Replies Latest reply: Sep 1, 2012 8:05 PM by Luca Jonathan Panetta VBscript error: Object required: 'WScript' Anton Oskamp Sep 1, 2010 8:01 AM Hi,I have a https://community.qlik.com/thread/11831 macro that exports an object to a CSV file.I would like to display a message when the export starts and one when it is done. The first message should not require the user to click ok. So msgbox is not an option.From the net I plucked this:Dim WshShell, BtnCodeSet WshShell = WScript.CreateObject("WScript.Shell")BtnCode = WshShell.Popup("Export started", 10)The macro doesn't work:Object required: 'WScript' Note: security is object required set to System Access and Allow System Access.QV 8.5Any suggestions?ThanksAnton 26900Views Tags: none (add) macrosContent tagged with macros, wscript_shellContent tagged with wscript_shell, shellContent tagged with shell, createobjectContent tagged with createobject, macro_execute_external_programContent tagged with macro_execute_external_program This content has been marked as final. Show 7 replies VBscript error: Object required: 'WScript' Luis Laura Sep 1, 2010 8:17 AM (in response to Anton Oskamp ) Hi,i object required wscript not use wscript. and functgood luck, Luis WshShell Popup.jpg 75.7 K Like Show 0 Likes (0) Actions VBscript error: Object required: 'WScript' Anton Oskamp Sep 1, 2010 9:24 AM (in response to Luis Laura) Hi Luis,Thanks. Now I get the pop-up, but it is waiting for the user to click ok. I does not go away after 10 seconds as it should...Anton Like Show 0 Likes (0) Actions VBscript error: Object required: 'WScript' Anton Oskamp Sep 12, 2010 8:29 AM (in response to Anton Oskamp ) Hi all,No solution yet...Does anyone know of a way to show a message during the execution of a macro that does not require any action from the user?In other words: showing a message that does not interupt the macro execution?ThanksAnton Like Show 0 Likes (0) Actions Re: VBscript error: Object required: 'WScript' Luca Jonathan Panetta May 20, 2011 12:42 PM (in response to Anton Oskamp ) Hello Anton,I had the same problem and I solved it by removing the word WScript before CreateObject'CorrectSet WshShell = CreateObject("WScript.Shell")Set oExec = WshShell.Exec("calc.exe")'NOT CorrectSet WshShell = WScript. CreateObject("WScript.Shell")Set oExec = WshShell.Exec("calc.exe")RegardsLuca Jonathan PanettaPLJ Software Like Show