Scripting Languages

28K

Solutions

21K

Contributors

A scripting language is a programming language that supports scripts, programs written for a special run-time environment that automate the execution of tasks that could alternatively be executed one-by-one by a human operator. Scripting languages are often interpreted (rather than compiled). Primitives are usually the elementary tasks or API calls, and the language allows them to be combined into more complex programs. Environments that can be automated through scripting include software applications, web pages within a web browser, the shells of operating systems (OS), embedded systems, as well as numerous games. A scripting language can be viewed as a domain-specific language for a particular environment; in the case of scripting an application, this is also known as an extension language.

Share tech news, updates, or what's on your mind.

Sign up to Post

I would like to export my CUPS printer settings to apply to another MAC which is running the same O/S.
Is this possible?
0
Bootstrap 4: Exploring New Features
LVL 19
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

I would like to have a script handy (.bat) which when double clicked will kill any outlook processes that are found using tasks.
0
Hello experts,

I have more than 90 AutoHotkey/Hotstring scripts reported in my AutoHotkey/Hotstring file that I use on a daily basis.
Sometimes I forgot the ones's that I don't use frequently. I was wondering how do you manage this and if there is an approach to display the various AutoHotkey/Hotstring reported in the file. The idea will be to relate to another AutoHotkey so when I call it, it reads and displays in the clipboard or a combobox the various AutoHotkey/Hotstring reported in the file so I can swiftly access to the one that I forgot and call it. My various AutoHotkey/Hotstring have a comment above of each of them with the following structure:
Example:

;====================================
;Run Excel 
;====================================

#!e::
If (FileExist(Excel32))
  Run,%Excel32%
Else
If (FileExist(Excel64))
  Run,%Excel64%
Else
  MsgBox,4112,Error,Neither 32-bit nor 64-bit Excel exists on this system
Return

Open in new window


Therefore I was thinking to read the AutoHotkey/Hotstring file and select just the comment and the next line which contains "::" which is the AutoHotkey/Hotstring. Then if I have it in a clipboard I can paste it notepad++ and launch the search of the AutoHotkey/Hotstring that I am looking for.
Let me know what do you think or if you have another proposal.

Thank you for your help.
0
Read from Text File and Replace String using Powershell

For now , I have this command below that works fine when I run it against one remote computer named Windows7 and Replacing one string "username" with "white"
but when I have many computers, then it  does not help

((Get-Content -Path '\\Windows7\c$\test.txt' -Raw) -replace ' username', ' white') | Set-Content -Path '\\Windows7\C$\test.txt'

Open in new window


I will have to put in a separate  Text file like this:

Windows7    White
PCNT34    JDOck
FRANKIST  Ballon
...

Open in new window


the first column is the remote computer name and the second column is the string that will replace the second username.

As I stated , the command I pasted above works just fine, it needs to read from a separate text file so that the command will apply to several computers listed on the text file.

Thank you
0
Read from Text file with Batch Script

I have this Script that adds a printer to a computer named Windows7.
The Script is good when you run it against one computer, but when you have many computers, you will have to change the computer name inside the Script for every computer your run the script against.

I would like to have this script gets the computer name from a separate text file.

Thank you


@echo starting pnpport 
cscript.exe "C:\windows\system32\Printing_Admin_Scripts\en-US\prnport.vbs" -a  -s windows7 -r "printer1" -h hostname -o raw -n 9100
@echo Waiting 5 seconds
timeout 5
@echo starting setting MyPrinter
cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -a  -p "Myprinter" -m "Generic / text only" -r "printer1" -s windows7
timeout 5

Open in new window

0
Read from Text file with Powershell

I have a text file that has this data[it represents the name of the device and the user that will logon to it.

Comp1  userA
Comp5 UserX
PC1   UserD
Serv3 User5


Under C: drive of each devices above, there is a text file with a line on it that states:
aaaa bbbbb   -username username


I already have a Powershell script "ChangeString.ps1" that can  replace the second username by the string that I hardcode inside the powershell command. Actually I have to type in the command the Device name and string that will replace the username.
((Get-Content -Path '\\windows7\c$\test.txt' -Raw) -replace ' username', 'white') | Set-Content -Path '\\windows7\C$\test.txt'

you can notice, in the command above, I have to to enter the name of the device (Windows7) and the string "white" to replace the second username.

That's too much when you have so many devices.

I thought that would help if the powershell command can read from a separate text file that has device name and username and do the replacement on each device.

Any Help ?

Thank you
0
prnmngr.vbs  does not create new printer port but it accepts only existing one.

I am running this command "
C:\>cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -a  -p
"Myprinter" -m "HP 910" -r "printer1" -s Windows7

Open in new window


I got error:
Unable to add printer Myprinter Error 0x80041001 Generic failure
Operation PutInstance
Provider Win32 Provider
Description The specified port is unknown.
Win32 error code 1796

Open in new window


If I put Existing Port after -r then it will add the printer .
However I an trying to add new printer that did not exist and did not have  an existing  port on the Remote PC

Any  Help?

Thank you
0
In .Net the regex (?<=>[^<]*?)\bă works as expected (find words that start with ă and are not located within a tag).

But in JavaScript Chrome \b won't work with Unicode texts.

What would be the correct equivalent in JavaScript for the above .Net expression?

(I am referring to the latest versions of regex/regexp)
0
Add-printer command on Powershell Version 2


I am trying to run add-printer powershell command   but I m getting error.
add-printer -name "MyTest Printer" -drivername "Canon MX920 series Printer"

Thank you

PS C:\Users\administrator> add-printer -name "MyTest Printer" -drivername "Canon MX920 series Printer"
The term 'add-printer' is not recognized as the name of a cmdlet, function, script file, or operable p
 spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:12
+ add-printer <<<<  -name "MyTest Printer" -drivername "Canon MX920 series Printer" -port "Envy"
    + CategoryInfo          : ObjectNotFound: (add-printer:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\administrator>

Open in new window


the remote computer is running Version 2 of Powershell

PS C:\Users\administrator> $psversiontable

Name                           Value
----                           -----
CLRVersion                     2.0.50727.5420
BuildVersion                   6.1.7601.17514
PSVersion                      2.0
WSManStackVersion              2.0
PSCompatibleVersions           {1.0, 2.0}
SerializationVersion           1.1.0.1
PSRemotingProtocolVersion      2.1


PS C:\Users\administrator>

Open in new window

0
Find and Replace string using Powershell

I have  a file Test.txt on a remote computer  named Windows7

the Test.txt  has a line:
aaaa bbbbb   -username  username

Open in new window


I would like to replace the second username with a string 'white'. the command line below works fine, however it is replacing both -username and username with 'white', I need just the second one replaced.
Thank you

((Get-Content -path '\\windows7\c$\test.txt' -Raw) -replace 'username','white') | Set-Content -Path '\\windows7\C$\test.txt'

Open in new window

0
Build an E-Commerce Site with Angular 5
LVL 19
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

Ok I'm practically pulling my hair out on this. I have to be honest with myself and who ever helps me (cough, cough, "Joe"). I am just having a horrible time figuring out what I desire to achieve.

My Goal is this...
Using an Excel workbook and specific sheet I want the data in the range of B3:I3 to be stored as Variables preferably like this. eg. Apt1, Let1, Payee1, Amt1,  CheckNum1, PmtType1, ReceiptNum1 then Apt2, Let2, and so on. If its easier to do in a different way I'm fine with that.

This should loop the by the value of F1 on that sheet witch counts the number of fields that have a value in the Payment amount column.

All I want to do is have a list of variables in the end that I can call individually later.
A simple MsgBox showing limited data just to show it it working would be great but I can do that as well.
I know I am asking a lot but I am hoping that its not as much for someone else as it would be for me

So the UI would be...
Run the script.
Get a dialog asking for the Deposit number to process and set that as the worksheet variable.
and then variables are created.

Formatting of the sheet will always be the same.
All preceeding zeros should stay in tact on Apt #, Check #, and Receipt #
If Letter is blank I would like it to store a variable witch returns nothing (ie No space)
If possible I would like to store the date as Year1, Month1, and Day1 instead of Date1

I think that covers it all I hope I can do something in return for the lucky …
0
I am looking for a good auto hotkey recorder to record entering username and password into a specific website
0
I am trying to set a variable to the value of Cell F1 on sheet %DepNum% But not figuring it out as of yet.

Cell F1 is a countif in Excel to count the number of fields that aren't blank.

SourceFile:="C:\Users\beatified\Desktop\AHK\Copy of Deposit Form.xlsx"
InputBox, DepNum, Deposit Number, Enter the Deposit Number you would like to process
NumberColumns:=9


Output:=""
ColumnLetters:=["A","B","C","D","E","F","G","H","I"]
oWorkbook:=ComObjGet(SourceFile)
oExcel.Sheets(DepNum).Select
ExcelCells:=Object()
NumberRows:=oWorkbook.Worksheets(DepNum).Range(F1).Value
Loop,%NumberRows%

Open in new window

0
Cant SetFormat,Float,6.2 on a number formatted as currency in excel. If its formatted as text and not currency everything works fine.

Is there a way to add a decimal and 2 trailing digits some other way? I always want two trailing digits even if they are zeros.
#Warn,UseUnsetLocal
#NoEnv
#SingleInstance Force
SetBatchLines,-1

SourceFile:="C:\Documents and Settings\Administrator\Desktop\Sample.xlsx"
InputBox, DepNum, Deposit Number, Enter the Deposit Number you would like to process
NumberColumns:=9
NumberRows:=30

Output:=""
ColumnLetters:=["A","B","C","D","E","F","G","H","I"]
oWorkbook:=ComObjGet(SourceFile)
oExcel.Sheets(DepNum).Select
ExcelCells:=Object()
Loop,%NumberRows%
{
  If (A_Index=1 or A_Index=2)
    Continue ; ignore first row
  CurrentRow:=A_Index
  Loop,%NumberColumns%
  {
    If (A_Index=1)
      Continue ; ignore column A
    If (A_Index=6)
      SetFormat,Float,6.2
    If (A_Index=7 or A_Index=9)
      SetFormat,Float,6.0
    CurrentColumn:=ColumnLetters[A_Index]
    CurrentCell:=CurrentColumn . CurrentRow
    ExcelCells[CurrentColumn,CurrentRow]:=oWorkbook.Worksheets(DepNum).Range(CurrentCell).Value
    If (A_Index=2)
      Output:=Output . "10" . ExcelCells[CurrentColumn,CurrentRow] . " - "
    Else
      Output:=Output . ExcelCells[CurrentColumn,CurrentRow] . " - "
    If (A_Index=9)
      StringTrimRight,Output,Output,3
  }
  Output:=Output . "`n"
}
MsgBox, 3, Correct?, Is this the information You would like to process? (press Yes or No or 

Open in new window

0
For some reason I run a AHK Script that calls an excel file and the returned data seems to be completely different and data that doesn't exist in the xlsx file. When I copy the data to a brand new xlsx file it seems to work properly. Is there residual data in the xlsx file?

Also I am trying to call a specific sheet in the work book and it doesn't seem to be working? As I see it this is the main problem as I don't believe the problem would exist if I called the sheet correctly.

#Warn,UseUnsetLocal
#NoEnv
#SingleInstance Force
SetBatchLines,-1

SourceFile:="C:\Documents and Settings\Administrator\Desktop\Working.xlsx"
DepNum:=14871
;InputBox, DepNum, Deposit Number, Enter the Deposit Number you would like to process
NumberColumns:=9
NumberRows:=30

Output:=""
ColumnLetters:=["A","B","C","D","E","F","G","H","I"]
oWorkbook:=ComObjGet(SourceFile)
oExcel.Sheets(DepNum).Select
ExcelCells:=Object()
Loop,%NumberRows%
{
  If (A_Index=1 or A_Index=2)
    Continue ; ignore first row
  CurrentRow:=A_Index
  Loop,%NumberColumns%
  {
    If (A_Index=1)
      Continue ; ignore column A
    If (A_Index=6)
      SetFormat,Float,6.2
    If (A_Index=7 or A_Index=9)
      SetFormat,Float,6.0
    CurrentColumn:=ColumnLetters[A_Index]
    CurrentCell:=CurrentColumn . CurrentRow
    ExcelCells[CurrentColumn,CurrentRow]:=oWorkbook.Worksheets(1).Range(CurrentCell).Value
    If (A_Index=2)
      Output:=Output . "10" . ExcelCells[CurrentColumn,CurrentRow] . " - "
    Else
      

Open in new window

0
I have a code on vbscript, I am trying to debug it by tracing with Visual Studio. I start it with a command
cscript //D myscript.vbs

Open in new window

When a stop command is executed or an error happened I attach the VS.
The problem here that it only allows me to put a breakpoint to certain lines of the code (always to the one where the stop was, and some else, I did not get the rules), making the debugging process to be very frustrating.
When I'm trying to do the "Set the next statement" command to move the execution pointer (I press Ctrl+Shift+F10) to a line where it previously did not let me to put a breakpont, I got a message box, saying "Unable to set the next statement. There is no execution code at this location in the source code."

Is that a normal behaviour or something is misconfigured?
0
So I am creating an AHK Script in Windows XP with Excel 2010 and am having problems using the script in that environment.

The Excel file was originally created with Excel 2016. I'm not sure what I'm doing right but in the end all I get is my yes no and cancel buttons not the %Output%.

I don't know if maybe I am running into some compatibility issues between version or what?

Here's the code...
#Warn,UseUnsetLocal
#NoEnv
#SingleInstance Force
SetBatchLines,-1

SourceFile:="C:\Documents and Settings\Administrator\Desktop\Deposit Form.xlsx"
InputBox, DepNum, Deposit Number, Enter the Deposit Number you would like to process
NumberColumns:=9
NumberRows:=29

Output:=""
ColumnLetters:=["A","B","C","D","E","F","G","H","I"]
oWorkbook:=ComObjGet(SourceFile)
oExcel.Sheets(DepNum).Select
ExcelCells:=Object()
Loop,%NumberRows%
{
  If (A_Index=1)
    Continue ; ignore first row
  CurrentRow:=A_Index
  Loop,%NumberColumns%
  {
    If (A_Index=1 or A_Index=8)
      Continue ; ignore columns A and H
    If (A_Index=6)
      SetFormat,Float,6.2
    If (A_Index=7 or A_Index=9)
      SetFormat,Float,6.0
    CurrentColumn:=ColumnLetters[A_Index]
    CurrentCell:=CurrentColumn . CurrentRow
    ExcelCells[CurrentColumn,CurrentRow]:=oWorkbook.Worksheets(1).Range(CurrentCell).Value
    If (A_Index=2)
      Output:=Output . "10" . ExcelCells[CurrentColumn,CurrentRow] . "-"
    Else
      Output:=Output . ExcelCells[CurrentColumn,CurrentRow] . " - "
    If (A_Index=9)
      

Open in new window

0
Hello experts,

The following AutoHotkey allows me to add initial character for each line of selected text.

^+-::
Send, ^c
Sleep, 50
ClipWait,1
If (ErrorLevel=1)
{
  MsgBox,4144,Error, No text appearing after one second
  Return
}
ClipboardVar:=Clipboard
UpdatedLines:=""
Loop,Parse,ClipboardVar,`n,`r
  UpdatedLines:=UpdatedLines . "-" . A_LoopField . "`n"
Clipboard:=UpdatedLines
Sleep, 50
MsgBox,4160,Success,Your clipboard has been properly copied., 2
Return

Open in new window


I would like to take as a reference in order to set up two AutoHotkey scripts:
1-Upper the various letters of selected text.
2-Lower the various letters of selected text.

If you have questions, please contact me.
0
replace a string on a text file on a remote computer

Currently, I have to type in \\RemotecomputerName\c$ I will be prompted to type  in RemotecomputerName\administrator  and password.
then open a text file (it has extension of CMD). the file has few lines on it , but the string  I want to replace is called username and comes after -username (notice the dash before username).

example:
aaaaaa bbbbbbbb ccccccccc dddddddddd -username username
then Save the file.

I need this operation to be done by a script

Thank you
0
Amazon Web Services
LVL 19
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Hi Experts

Could you explain how Ensemble InterSystems works and what is the purpose of this tool?

Is that an ETL tool like Pentaho f.e.?

Thanks in advance
0
I have a program that uses F12 and it seems when I have a AHK Script waiting in the background it seems to intercept the F12 Key before the program can get it.

Is there a way to disable the F12 Key from being intercepted by AHK.
0
Dear expert

I would like to delete a dB table using a query, I would like to delete this bkcopy_* table. I already got one procedure to create one:
USE [TEST_dB]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [bkcopy_test]
AS
DECLARE @datum CHAR(10) = CONVERT(CHAR(8), GETDATE(), 112);
exec ('SELECT * INTO [TEST_dB_'+ @datum +'] FROM [Test]' 

Open in new window

Above query create one table with a copy content of that test table, now I would like to first check if the table exist, if it exist then delete that table with name: Test_bB* Is this possible to do?
0
Hi,

In PowerShell I rund this cmd:

move  "C:\Windows\System32\dns\$($line)_$($Year)-$($Month)-$($Day).txt" "C:\temp\DNS\Exports\${line}_$Year-$Month-$Day.txt"

Why it looks not taking the value of the variables because it gives me this error:

move : Could not find a part of the path.
At C:\temp\Export-DNS.ps1:21 char:1
+ move "C:\Windows\System32\dns\$($line)_$($Year)-$($Month)-$($Day).txt" "C:\temp\ ...
1
Hello experts,

The following script allows me to add a specific character at the beginning and end of a selected text:

;====================================
;EE Code
;====================================

!^c:: ;code
Send, ^c
Sleep, 50
ClipWait,1
If (ErrorLevel=1)
{
  MsgBox,4144,Error, No text appearing after one second
  Return
}
ClipboardVar:=Clipboard
Clipboard:="[code(string))]" . ClipboardVar . "[/code(string)]"
Sleep, 50
MsgBox,4160,Success,Your clipboard has been properly copied., 2
Return

Open in new window


I would like to take it as a reference to add specific character (-) at the beginning of the various lines of a selected text.

Example of a selected text:
Line 1
Line 2
Line 3
Line 4

Result:
-Line 1
-Line 2
-Line 3
-Line 4

If you have questions, please contact me.

Thank you for your help.
0
Bitbake is a python program. It was downloaded from:  https://github.com/openembedded/bitbake
bitbake 1.40.0 branch was selected for download.

What instantiated class ConfigParameters(object)?  I see that __init__ or constructor was executed but exactly what python code instantiated this class?


object created
filename:  cookerdata.py
class ConfigParameters(object):
    def __init__(self, argv=sys.argv):
        self.options, targets = self.parseCommandLine(argv)
        self.environment = self.parseEnvironment()

Open in new window


filename:  bitbake
if __name__ == "__main__":
    if __version__ != bb.__version__:
        sys.exit("Bitbake core version and program version mismatch!")
    try:
        sys.exit(bitbake_main(BitBakeConfigParameters(sys.argv),
                              cookerdata.CookerConfiguration()))

Open in new window

0

Scripting Languages

28K

Solutions

21K

Contributors

A scripting language is a programming language that supports scripts, programs written for a special run-time environment that automate the execution of tasks that could alternatively be executed one-by-one by a human operator. Scripting languages are often interpreted (rather than compiled). Primitives are usually the elementary tasks or API calls, and the language allows them to be combined into more complex programs. Environments that can be automated through scripting include software applications, web pages within a web browser, the shells of operating systems (OS), embedded systems, as well as numerous games. A scripting language can be viewed as a domain-specific language for a particular environment; in the case of scripting an application, this is also known as an extension language.