jscript.net

How I can use Add-Type in powershell through command line in order to execute VB.NET or C# (or JScript.net) code?

青春壹個敷衍的年華 提交于 2020-05-16 07:30:52
问题 Here's the MS documentation concerning Add-Type So I'm trying to add type through command line: >powershell Add-Type -TypeDefinition "public class T{public static int Add(int a, int b){return (a + b);}}" -Language CSharp or >powershell Add-Type -TypeDefinition "@"""public class T{public static int Add(int a, int b){return (a + b);}}"""@" -Language CSharp or >powershell Add-Type -TypeDefinition "@"""public class T{public static int Add(int a, int b){return (a + b);}}"""@" -Language CSharp or

How I can use Add-Type in powershell through command line in order to execute VB.NET or C# (or JScript.net) code?

蓝咒 提交于 2020-05-16 07:28:28
问题 Here's the MS documentation concerning Add-Type So I'm trying to add type through command line: >powershell Add-Type -TypeDefinition "public class T{public static int Add(int a, int b){return (a + b);}}" -Language CSharp or >powershell Add-Type -TypeDefinition "@"""public class T{public static int Add(int a, int b){return (a + b);}}"""@" -Language CSharp or >powershell Add-Type -TypeDefinition "@"""public class T{public static int Add(int a, int b){return (a + b);}}"""@" -Language CSharp or

Fiddler/Jscript.NET :How do I append a string to specific search query?

倖福魔咒の 提交于 2019-12-24 10:46:48
问题 The problem with the below code is that it appends string at the very end of the URL if (oSession.uriContains("search?q=")) { var str = oSession.fullUrl; var sAppend = "+test1+test2+test3"; if (!oSession.uriContains(sAppend)) { oSession.fullUrl = str + sAppend; } } So, How can I conditionally place +test1+test2+test3 right next to search?q= ? Thank you 回答1: What's the problem with replace function: if (oSession.uriContains("search?q=")) { var str = oSession.fullUrl; var sAppend = "+test1

Fiddler: Is it possible to replace part of URL using OnBeforeResponse function?

爱⌒轻易说出口 提交于 2019-12-12 01:58:52
问题 if (oSession.HostnameIs("www.youtube.com") && oSession.oResponse.headers.ExistsAndContains("Content-Type","text/html")){ oSession.utilDecodeResponse(); oSession.utilReplaceInResponse("old string","new string"); } Please tell me if I'm using the above script correctly or not. Basically, How do I to replace/hide the word dolphin from the search query ? I don't want the client browser(my Google Chrome) to see it by any means. Example : http://www.youtube.com/results?search_query= dolphin &page=3

Matching and storing part of a string in a variable using JScript.NET

邮差的信 提交于 2019-12-11 06:03:19
问题 I am fiddling with some a script for Fiddler, which uses JScript.NET. I have a string of the format: {"params":{"key1":"somevalue","key2":"someothervalue","key3":"whatevervalue", ... I want to match and show "key2":"someothervalue" where someothervalue could be any value but the key is static. Using good old sed and bash I can replace the part I am looking for with: $ a='{"params":{"key1":"somevalue","key2":"someothervalue","key3":"whatevervalue", ...' $ echo $a | sed -r 's/"key2":"[^"]+"

$Find returns null

大憨熊 提交于 2019-12-10 13:13:43
问题 I have the following JScript on a page <script type="text/javascript"> function ProcessButtonDisable() { var button = $find("<%=ProcessButton.ClientID %>"); button.disabled = true; } </script> and later <asp:Button ID="ProcessButton" Text="Process All" runat="server" OnClick="Process_Click" OnClientClick="ProcessButtonDisable()" /> when running the page and firing off the button i get Microsoft JScript runtime error: Unable to set value of the property 'disabled': object is null or undefined

How do I set assembly attributes (version, etc) in JScript.NET?

非 Y 不嫁゛ 提交于 2019-12-08 07:52:07
问题 I have some javascript that I'm compiling with Microsoft's jsc.exe compiler into a .NET assembly. I would like to set some assembly metadata, such as the file version, but it is unclear to me how to do that. How can I set these assembly-level attributes in JScript.NET? 回答1: import System.Reflection; [assembly: AssemblyCompanyAttribute("Your Company")] [assembly: AssemblyCopyrightAttribute("Copyright Your Company 2014")] [assembly: AssemblyDescriptionAttribute("Description")] [assembly:

Get command line arguments with jscript.net

浪尽此生 提交于 2019-12-06 14:38:09
问题 None of these work: var arguments = System.Environment.GetCommandLineArgs(); ~ var arguments = Environment.GetCommandLineArgs(); ~ var arguments:String[] = System.Environment.GetCommandLineArgs(); ~ var arguments:String[] = Environment.GetCommandLineArgs(); it prints JS1135: Variable 'System' has not been declared or error JS1135: Variable 'Environment' has not been declared . Even in MSDN there's no example with jscript. Is is possible to get the arguments in jscript.net ? 回答1: This works:

When creating a JavascriptConverter, how to return an array?

霸气de小男生 提交于 2019-12-06 11:19:42
I'm trying to write a custom JavascriptConverter for use with a WebService I'm writing. I have to write a custom converter, because Microsoft.JScript.JSObject doesn't support IDictionary, so it gets treated as an array. I have this part working fine. However, because Microsoft.JScript.ArrayObject is a subclass of Microsoft.JScript.JSObject, it also trys to convert it using the same method. How can I return something that will be serialized as a JSON array? I have to return an IDictionary, which will become a JSON object. Is there something I'm missing? Specifically, how do I return something

List of computers in Active Directory that are online

瘦欲@ 提交于 2019-12-06 10:33:02
问题 I'm using this snippet of code to output a list of all the computers on my network (the language is jscript.net, but it's just a small manipulation of C#). var parentEntry = new DirectoryEntry(); parentEntry.Path = "WinNT:"; for(var childEntry in parentEntry.Children) { if(childEntry.SchemaClassName == "Domain") { var parentDomain = new TreeNode(childEntry.Name); this.treeView1.Nodes.Add(parentDomain); var subChildEntry : DirectoryEntry; var subParentEntry = new DirectoryEntry();