VBS Sendkey When sending multiple keys [duplicate] - vbscript

This question already has an answer here:
how can we simulate keyboard keys using vbs?
(1 answer)
Closed 2 years ago.
Here's an example of the issue
Set a=createobject("wscript.shell")
a.sendkey (%117)
I would like to do ALT+U simultaneously in that situation but it is not reading correctly and I am unsure how to fix this issue.

Key codes are:
Alt - %
Ctrl - ^
So for Alt + U do:
Set a=createobject("wscript.shell")
a.SendKeys "%U"
For all other key codes refer to https://social.technet.microsoft.com/wiki/contents/articles/5169.vbscript-sendkeys-method.aspx

Related

How to get query parameter from URL in VBScript? [duplicate]

This question already has answers here:
Using query string in ASP (vb script)
(3 answers)
Closed 11 months ago.
I have a requirement from my client to get the query parameter of an URL with VBScript, the URL is like below:
www.xxx.com/index.asp?sn=2
Need to get the value of "sn".
What should the code be like?
No idea how to use VBScript to get the parameter.
I got the code:
dim sn
sn = Request.QueryString("sn")
It works.

Expanding IP ranges into single IP addresses using Linux bash command? [duplicate]

This question already has answers here:
bash - for loop for IP range excluding certain IPs
(2 answers)
IP range generator script [closed]
(1 answer)
Closed 5 years ago.
Which is the best method for me to handle this? I'm thinking awk might be the way to go perhaps, but not sure where to start even.
I have a text file, which contains IP addresses and ranges as per this example:
10.10.115.69
10.10.128.6 - 10.10.128.7
10.10.128.20
10.10.128.28
10.10.128.38 - 10.10.128.53
10.10.128.70 - 10.10.128.71
10.10.128.130 - 10.10.128.144
10.10.128.232 - 10.10.128.233
10.10.130.5
10.10.132.5
I'm trying to get them all into their own individual address. So as per above on the line '10.10.128.38 - 10.10.128.53' .. I would want that to convert to:
Expected output:
10.10.128.20
10.10.128.28
10.10.128.38
10.10.128.39
10.10.128.40
<snip>
10.10.128.52
10.10.128.53
10.10.128.70
10.10.128.71
<etc.>
Keeping of course the single host IPs included into output, just expanding the range parts.
Hope that makes sense.
Edit: Comments are suggesting this is a duplicate of another exact question. Please could someone link to it for me, as I'm not finding it. I am new here so not quite up to speed with things.
My expected output is as above, I'm not after a generator, rather a way to expand the ranges, the lines with '-' in them <start IP> - <end_IP> while keeping the single ones that are there still.

Ruby | 2 float number multiple not giving the exact value [duplicate]

This question already has answers here:
Is floating point math broken?
(31 answers)
Closed 5 years ago.
I have 2 float number and I try to get the multiple. But in the console it does not get the correct one. I do not know maybe there is a leak ?
{"price"=>"0.049391", "size"=>"0.001"}
When I multiple them console shows;
************
0.049391
************
0.001
************
4.9390999999999995e-05
************
Then when I push this data to array and in front end when I console.log
I get;
0.000049390999999999995
Why it is not 0.0000493901 ?
4.9390999999999995e-05 and 0.000049390999999999995 are the same number. e-05 is nothing more than notation for "move the decimal place five spots to the left".

VBScript readline from file and check equal to [duplicate]

This question already has an answer here:
VBScript equals problems
(1 answer)
Closed 8 years ago.
I am working on a VBScript login/signup program I already have the signup part done but then while logging in it has to read a line from a file with ReadLine() but the file must see if the line read and the text typed are equal variables and I don't know how to do this
For simple cases, the = operator
If sInput = sRead Then
...
Else
...
End If
works well; if you have to care for case(in)sensitivity, use StrComp().
The comparison is not affected by the way you obtained the strings. If your file justs contains the string that has to be matched,
sRead = tsIn.ReadLine()
before the comparisons will 'work'; if your file contains more than that, you'll have to publish (relevant parts of) its content and how the relevant data can be identified.

R script line numbers at error? [duplicate]

This question already has answers here:
How to get R script line numbers at error?
(6 answers)
Closed 6 years ago.
I found this post from a year ago, and I'm using R version 2.11.1 (2010-05-31), but still getting error messages without line numbers.
Any solution?
The answers given there are still valid. Returning line numbers from a script ain't that straight-forward, but R can give you a lot more information on where the error can be found.
You could use the error options to save the info in a file, for example :
options(error = quote({
sink(file="error.txt");
dump.frames();
print(attr(last.dump,"error.message"));
traceback();
sink();
q()}))
The function findLineNum() could be used if you have the name of the file somewhere available. If you have the error message, you could do something like :
dump.frames()
x <- attr(last.dump,"error.message")
ll <- gsub("Error in (.*) : .*","\\1",x)
lln <- findLineNum(srcfile,ll)
In the upcoming R 2.14, the core team is making progress toward implementing this feature. Functions in scripts loaded with source(file=..., keep.file=TRUE) will contain an attribute srcref, which identifies the range of characters corresponding to the function's definition in an in-memory copy of the source file stored as an object of class srcfilecopy.
This does not immediately provide line-level debugging, but it lets you get approximate line numbers if you're willing to get your hands dirty. Also, it's progress.

Resources