wsh

Hosting WSH (VBScript, JavaScript) in your delphi application?

泄露秘密 提交于 2019-12-01 20:36:30
问题 I'm looking to execute user supplied scripts from my Delphi application. Is it possible to host the Windows Script Host engine in my application and supply it with scripts to execute? Or, is there a better way to approach this problem? P.S I'm not looking for third-party components. 回答1: This is entirely possible and there is plenty of code out there that shows how to do this. Check out: http://www.torry.net/pages.php?id=280 回答2: Allen Bauer made a blog post about using Active Scripting a few

Visual Studio 2017 debugging vbscript

我是研究僧i 提交于 2019-12-01 16:38:30
I'd like to debug a vbscript with Visual Studio 2017 Community Edition and followed the steps mentioned here for VS2015: Video I entered cscript.exe /x foo.vbs in the commandline, but no debugger starts. Is there a problem with the 2017th version of VS or are there some steps (e.g. configuration steps in VS) which are not shown in the video? Edit: I tried cscript.exe //X foo.vbs , cscript.exe foo.vbs //X , cscript.exe //X //D foo.vbs and cscript.exe foo.vbs //X //D too Thanks steff Please run your VS2017 as the admin, and then enable the script option under TOOLS->Options->Debugging->Just-In

Visual Studio 2017 debugging vbscript

感情迁移 提交于 2019-12-01 15:28:22
问题 I'd like to debug a vbscript with Visual Studio 2017 Community Edition and followed the steps mentioned here for VS2015: Video I entered cscript.exe /x foo.vbs in the commandline, but no debugger starts. Is there a problem with the 2017th version of VS or are there some steps (e.g. configuration steps in VS) which are not shown in the video? Edit: I tried cscript.exe //X foo.vbs , cscript.exe foo.vbs //X , cscript.exe //X //D foo.vbs and cscript.exe foo.vbs //X //D too Thanks steff 回答1:

Javascript, write to txt file save as UNICODE

岁酱吖の 提交于 2019-12-01 15:02:35
I have 2 strings. Would like it all to first make a .txt file and then save the strings to it as unicode. function WriteFile(file, str, str2) { var tmp=real_url.replace(/%20/g, " "); var WshNetwork=new ActiveXObject("WScript.Network"); var userid=WshNetwork.UserName; var fso = new ActiveXObject("Scripting.FileSystemObject"); if(! fso.FolderExists(tmp+"users/"+userid)) { var cf = fso.CreateFolder(tmp+"users/"+userid); } else { //alert("THIS FOLDER ALREADY EXISTS"); } delete fso; var fso = new ActiveXObject("Scripting.FileSystemObject"); var fh = fso.OpenTextFile(tmp+"users/"+userid+"/"+file, 2,

WScript.CreateObject crashes Windows Scripting Host when event handler prefix is specified for WinHTTPRequest

假装没事ソ 提交于 2019-12-01 13:40:49
According to the MSDN documentation WinHTTPRequest has four event handlers which should be accessible by specifying an event handler prefix. Unfortunately, doing so causes Windows Scripting Host to crash. The following code crashes Windows Scripting Host: Set oHTTP = WScript.CreateObject( "WinHttp.WinHttpRequest.5.1", "oHTTP_" ) This code works just fine: Set oHTTP = WScript.CreateObject( "WinHttp.WinHttpRequest.5.1" ) Any thoughts as to why? It's not part of the specification in any way. Wishful programming rarely works. Creates and returns a reference to an Automation object. CreateObject

hide Excel tab from Javascript code

家住魔仙堡 提交于 2019-12-01 12:58:16
How can I hide an Excel tab programmatically through Javascript. ExcelSheetName.Visible=False doesn't seem to work. I've googled a lot but yet not received the right solution. How to do that ? To hide an Excel sheet, set the Visible property of the corresponding Worksheet object to 0 or false . For example, if you have an Excel file with two sheets named Sheet1 and Sheet2 , the following code will open this file with the Sheet1 hidden: var objExcel = new ActiveXObject("Excel.Application"); objExcel.Visible = true; objExcel.Workbooks.Open("C:\\Book1.xlsx"); objExcel.ActiveWorkbook.Sheets(

.bat for batch rename to increment numbers in fname

我与影子孤独终老i 提交于 2019-12-01 12:12:27
I have a large folder of .cbr's, and I'm renaming them by issue number to correctly order them. What do I need to include in the ren line to have each file increment the number in the file name via windows command prompt? I'll be doing this frequently so I'll make this a .bat file. For example, where n = initial number and m = final number: n.cbr, (n+1).cbr, ..., (m-1).cbr, m.cbr The .bat thusfar: ren *.cbz *.cbr ren *.cbr <increment numbers n through m>.cbr Alternatively, how do I trim each file name so that only the numbers are left before the extension? (from issue1.cbr to 1.cbr) via either

Maximum Array of Strings VisualBasic WSH

北慕城南 提交于 2019-12-01 08:02:16
问题 I'm writing a WSH script in VB to read a massive directory listing generated with a redirected directory listing via .Run method. The directory listing is about 8400 lines, but every time I run the script, the following loop Do Until DirList.AtEndOfStream Redim Preserve arrData(i) arrData(i) = DirList.ReadLine i = i + 1 Loop cuts out early, in a seemingly random range of 1800 to 3500 lines. Does this sound like an array size issue or a shell memory limit? I have heard of people parsing LARGE

Can I initialize objects written in JScript from VBScript?

浪尽此生 提交于 2019-12-01 05:46:19
I am trying to write a WSH logon script. Administrators throughout the company need to be able to customize the execution of the script, and execute additional scripts, for specific locations and users. In order to make their jobs easier, I would like to provide an API that the administrators can access in their scripts. If I write my API using JScript, would it be possible to initialize the objects I define through VBScript? For example, consider the following code: <!-- The WSF logon script file --> <package> <job> <script language="JScript"> // A demonstration function function

How to use ANSI escape sequences with CSCRIPT on Windows 10?

醉酒当歌 提交于 2019-12-01 05:12:10
I'm trying to use the new VT100 ANSI escape sequence capabilities available in the Windows 10 console with CSCRIPT (JScript). But I cannot get it to work. Here is a really simple JScript script: test.js WScript.Echo('\x1B[7mReverse\x1B[0m Normal'); WScript.stdout.WriteLine('\x1B[7mReverse\x1B[0m Normal'); I've done a number of tests, and the escape sequences output by CSCRIPT are impotent when written directly to the screen, and only work if written to a file first and then TYPEed, or else captured by FOR /F and ECHOed. I have two questions: 1) Why doesn't the direct write to the console work