Scripting Languages

27K

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

In attached file, only state but not .concstate has been defined. Does concstate actually refer state ?
this.props.concstate.flights.map

Thx
FlightCards.js
0
Exploring SQL Server 2016: Fundamentals
LVL 13
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Hello experts,
I would like to understand why winmaximize works in some case and not in other case.

WinMaximize is applied as followed:

^+F12::
If(WinActive("ahk_exe chrome.exe"))
{
	WinMaximize
	Return
}
Else
  MsgBox,4144,Error,Google Drive is not the active window
Return

Open in new window


However it doesn't work as followed:
^+F12::
WinGetActiveTitle,Title
If (InStr(Title,"Google Drive"))
{
	WinMaximize
	Return
}
Else
  MsgBox,4144,Error,Google Drive is not the active window
Return

Open in new window

Thank you for your help.
0
I've got a script located at:
/Users/me/Desktop/Distributed_Lab/Scripts

I'm trying to invoke the script using:  
./myscript.sh

When the script runs it gives me this message:
Desktop/cfrtl4_all_indexer_base: No such file or directory

A portion of my script is below:
#!/bin/sh
# ----- Variables -----
SHIP="xx.xxx.xx.xxx"
# ----- Script -----

# --- Search Head ---
sudo scp -r Desktop/Distributed_Lab/Apps/cfrtl4_all_indexer_base username@$SHIP:/tmp

Open in new window


I'm initiating the script from my local system where I have administrative rights.  However, I've tried the scp command with sudo and without.  Same result.  It keeps giving me this message:

"Desktop/cfrtl4_all_indexer_base: No such file or directory"

Why is the message referring to only the Desktop/ as the path and not the entire path?  More importantly, it's not seeing the file that I need to move from my Apps directory.  I created this script to move about 10 files over from my Desktop/Distributed_Lab/Apps directory which is on my local drive, on to a remote systems /tmp directory.   Any help is greatly appreciated!
0
I have attached a PowerShell script that was written to take the 'year' ID3 tag of an mp3 file, create a corresponding folder of the decade to which it belongs (ex: 1960s, 1970s, 1980s) and then move it to that respective folder.

When I attempt to run it, it does nothing. No output, no errors. I have tried running it from PowerShell ISE, Windows PowerShell prompt, and calling it via the command line (powershell c:\scripts\mp3.ps1) all when run as administrator.

Looking in the Event Viewer, there are 8 events produced, but nothing of anything discerning to me that speaks to why it won't run. Here are the events in sequence:

Provider "Registry" is Started.

Details:
      ProviderName=Registry
      NewProviderState=Started

      SequenceNumber=1

      HostName=ConsoleHost
      HostVersion=5.1.18362.145
      HostId=61667b5b-06d4-4f03-a57d-bef692dd47c2
      HostApplication=powershell c:\scripts\mp3.ps1
      EngineVersion=
      RunspaceId=
      PipelineId=
      CommandName=
      CommandType=
      ScriptName=
      CommandPath=
      CommandLine=

Provider "Alias" is Started.

Details:
      ProviderName=Alias
      NewProviderState=Started

      SequenceNumber=3

      HostName=ConsoleHost
      HostVersion=5.1.18362.145
      HostId=61667b5b-06d4-4f03-a57d-bef692dd47c2
      HostApplication=powershell c:\scripts\mp3.ps1
      EngineVersion=
      RunspaceId=
      PipelineId=
      CommandName=
      CommandType=
      ScriptName=
      CommandPath=
      CommandLine=

Provider "Environment" is Started.

Details:
      ProviderName=Environment
      …
0
For the below code in React :

Does (city,key) is the input or output parameter for the function findAirport ?
What does "then(jsonData => {this.setState({ [key]: jsonData.Places[0].PlaceId });" mean ?
Does the code inside { } is the body of the function ?
What does .then mean ?
Can I omit 'this' for "this.findAirport" ?
Where does setState function defined ?

ThxFindFlight.js

   this.findAirport = (city, key) => {
      fetch("https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/autosuggest/v1.0/US/USD/en-US/?query="+city, {
        method: "GET",
        headers: {
          "X-Mashape-Key": process.env.REACT_APP_MASHAPE_API_KEY,
          "X-Mashape-Host": "skyscanner-skyscanner-flight-search-v1.p.rapidapi.com"
        }
      }).then(response => {
        return response.json();
      }, error =>  {
      }).then(jsonData => {
        this.setState({ [key]: jsonData.Places[0].PlaceId });
        console.log(this.state);
        if (this.state.toairport.length > 0 && this.state.fromairport.length > 0){
          this.findFlight();
        }
      })
    }

Open in new window

0
i have following commands which i run manually on a server by opening command prompt.

tabadmin stop

tabadmin clean up

tabadmin start

Is there any way i can automate this task by task scheduler .

can i save this in txt format file and save in .ps1 script but i am not sure
how to do it.
0
I need to write a script that will find all plist files in /Library/LaunchAgents/ that start with connectwisecontrol and contain onlogin in the file names then unload them.

We use ConnectWise Control for providing remote support to our users. The client is installed on the machine and runs at boot. The problem is that we have an application that is used a few times per year that conflicts with ConnectWise Control. Our solution is to close ConnectWise while the other application is running.

Running the following:

launchctl unload /Library/LaunchAgents/connectwisecontrol-xxxxxxxxxxxxxxxxx-onlogin.plist

That closes the ConnectWise Agent running in the background and allows the other application to work fine.

My ideal solution would be to use Automator or create or package a script that runs that command and then kicks off the other application when the user clicks it.

The part that I'm unsure of is how to write a script that finds the plist. The xxxxx's in that file vary depending on the computer. I need to search for that plist and then insert it into the unload statement.

Any guidance would be greatly appreciated!

Vernon
0
Hello experts,
I need to launch an AutoHotkey once I turn on my machine:
The idea is to place the following at:
AutoCorrect1:="C:\P\LD-autocorrect.ahk"
AutoCorrect2:="C:\F\LD-autocorrect.ahk"

If (FileExist(AutoCorrect1))
  Run,%AutoCorrect1%
Else
If (FileExist(AutoCorrect2))
  Run,%AutoCorrect2%
Else
  MsgBox,4112,Fatal Error, AutoCorrect does not exist on your system.
Return

Open in new window


I am aware that I can put: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
However I need to add some text at this file as a result I cannot place this file at this folder.

What is the best strategy:
1-Put a single AutoHotkey file at: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup to  automatically call autocorrect?
2-Create an AutoHotkey within my AutoHotkey file to run the autocorrect file? such as #!a:: however I need to remind every time that I need to launch this AutoHotkey to use autocorrect

Thank you for your help.
0
Hello experts,
I am trying to build the following AutoHotkey to send current dir based on Notepad ++ or Powershell:
:?*:cdx::
If (WinActive("ahk_exe notepad++.exe"))
{
  CurrentDirBlock:= "set CurrentDir=`%~dp0 `n" 
                  . "Rem Example: Base=%CurrentDir%Subfolder"
}          
If (WinActive("ahk_exe powershell_ise.exe"))
{
  CurrentDirBlock:= "$CurrentDir = Split-Path $script:MyInvocation.MyCommand.Path `n"
                    . "#Example: $Root = $CurrentDir + '\Root2'"
}
SendRaw %CurrentDirBlock%
Else
  MsgBox,4144,Error,Active window is not a supported program
Return

Open in new window

I don't understand why I have an error message If I put the final Else:
ELSE with no matching IF
And if I remove it I am able to launch the script.
If you have advice please let me know.
Thank you for your help.
0
Hello experts,
I have the following AutoHotkey which allows me to send a comment block:
:*:blc::
FormatTime,CurrentDateTime3,,yyyy/MM/dd HH:mm:ss
If ((WinActive("ahk_exe excel.exe")) or (WinActive("ahk_exe vbsedit.exe")))
  CommentBlock:="' *************************************************************************`n"
              . "' Author: `n"
              . "' Creation date: " . CurrentDateTime3 . "`n"
              . "' Description:`n"
              . "' ***************************************************************************`n"
Else
If (WinActive("ahk_exe notepad++.exe"))
  CommentBlock:="Rem ======================================================================`n"
              . "Rem Author: `n"
              . "Rem Creation date: " . CurrentDateTime3 . "`n"
              . "Rem Description:`n"
              . "Rem ======================================================================`n"
Else
If (WinActive("ahk_exe powershell_ise.exe"))
 CommentBlock:="# ===========================================================================`n"
              . "# Author:  `n"
              . "# Creation date: " . CurrentDateTime3 . "`n"
              . "# Description:`n"
              . "# ===========================================================================`n"
Else
If (WinActive("ahk_exe sciTE.exe"))
 CommentBlock:=";====================================`n"
              . ";`n"
              . ";====================================`n"
Else
If (WinActive("ahk_exe

Open in new window

0
Build an E-Commerce Site with Angular 5
LVL 13
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.

Hello experts,

I was wondering how to properly have the coordinates of MouseClick to set up in AutoHotkey.
Screenshot tools display the coordinates when I take screenshot but those coordinates are not the one to set up.
I was thinking to set up something like this:
Reference site:
https://www.autohotkey.com/boards/viewtopic.php?t=33242#p154525
+^F12::
	ToolTip, click somewhere
	KeyWait, LButton, D
	MouseGetPos, X1, Y1
	KeyWait, LButton, U
	ToolTip,  click somewhere else
	KeyWait, LButton, D
	MouseGetPos, X2, Y2
	KeyWait, LButton, U
	ToolTip
	MsgBox, X1: %X1% Y1: %Y1% X2: %X2% Y2: %Y2%
Return

Open in new window

However I don't know if there is a potential risk to add this to my AutoHotkey file as regards the options used such as:
KeyWait and Tool Tip.
If you have advice on this please let me know.
Thank you for your help.
0
I am writing a cmd file to utilize robocopy as an automated backup. I want to create a new log every time it runs that is date stamped as part of the log name. I am using the script below. The log was named Tue09172019-8212265Home. However I want the format to be yyyymmdd-hhmm so in this case 20190917-0821Home.


set tdate=%date: =%
set tdate=%tdate:/=%
set ttime=%time::=%
set ttime=%ttime:.=%
set ttime=%ttime: =%


Robocopy G:\Home F:\Home /e /b /xo /copyall /dcopy:DAT /mt /LOG:F:Logs\%tdate%-%ttime%Home.log /NFL /NDL
0
Hello experts,
I am trying to understand the logic behind WinMaximize however the documentation available at:
https://www.autohotkey.com/docs/commands/WinMaximize.htm
is not enough for me.
The need is to set a WinActive condition, maximize and send a click:
Like this:
If (WinActive("ahk_exe ssms.exe"))
{
 WinMaximize
 MouseClick, left, 55, 233
 Return
}
Else
{
  MsgBox,4144,Error,Active window is not a supported program
  Return
}

Open in new window

Thank you for your help.
0
Hello experts,
I have the following AutoHotkeys:
;====================================
; Copy current line
;====================================

+^c::
Send {END}+{Shift}+{HOME}^c{Right}
Return

;====================================
; Cut current line
;====================================

+^x::
Send, {END}+{HOME}^x{Right}
Return

;====================================
; Duplicate current line 
;====================================

+^d::
Clipboard:=""
Send, {End}+{Home}^c
ClipWait,1
Send, {Right}+{Enter}^v 
Return

;====================================
;Remove a line
;====================================

+^r::
Send, {End}+{Home}+{Delete}
Return

Open in new window


I was thinking to modify the keys by hoststrings as I those keys combination are also part of other shortcuts keys already set up in another application such as MZ-tool.
I am aware that hoststrings is not the best for select text and I also test the following and it doesn't work when the cursor is at the beginning of the line.
;====================================
; Copy current line
;====================================

:*:lc::
Send {END}+{Shift}+{HOME}^c{Right}
Return

I am little confused and I would like to have your opinion on this.
Thank you for your help.
0
Hello experts,
I was wondering how to make an opposition of If WinActive:
I read documentation related to WinActive:
here
but they don't recommend IfWin[Not]Active
Deprecated: This command is not recommended for use in new scripts. Use the WinActive function instead.
Can I make an Else instead like this:
:*:ahk::
If (WinActive("ahk_exe sciTE.exe"))
;~ Do nothing
Else 
{
Send, AutoHotkey
}
Return

Open in new window

Thank you for your help.
0
Hello experts,
I have the following AutoHotkey which allows me to send Alt + Y1 to directly select my Add-in tab on Excel .
I don't understand why it works one computer equipped by Win 10 Excel 2019 and it doesn't on my other computer equipped by Win 10 Excel 2016.
!y::
SetKeyDelay , 10 ; time to wait between send
WinGetActiveTitle, Title
IfInString, Title, Excel
{
	Send, !Y
 Send, 1
}
Return

Open in new window


Any recommendation or advice?
Thank you for your help.
0
I am trying to convert a csv file into a xls through a powershell script so that it will be viewable on sharepoint 365, without users having to convert the file, or open it in a thick client.

Any help is greatly apprenticed.

thanks

I am attaching a copy of one of the csv files i am working with.
SCORECARD-G3-MATH-RS.csv
0
Hello experts,
I have the following script which allows me to zip file with 7-zip:
;====================================
; 7zip
;====================================

#IfWinActive,ahk_class CabinetWClass
+F7::
Send, +{F10}
Sleep, 100
Send, 7
Return
#If

Open in new window

2019-09-13_16h25_09.pngMost of the time it works however sometimes,
Send, 7 

Open in new window

is not performed and I just get:
2019-09-13_16h26_40.pngIf you have recommendations on this, please let me know.
0
Hello experts,
I have the following AutoHotkey reported at: Question 29156945 which allows me to remove two consecutive blank  lines and cr lf characters:

;====================================
;Remove two consecutive blank lines
;====================================

^!Space::
  ; clipboard:="" ; Joe commented out - not needed because Ctrl+c replaces Clipboard
  Send, ^a ; Luis commented out because he prefers to select the block
  Send, ^c
  ClipWait,1 ; Joe added - good practice to do a ClipWait after Ctrl+c
  If (ErrorLevel=1)
  {
    MsgBox,4144,Error,No text appeared on clipboard after waiting for one second
    Return
  }
  clipboard:= RegExReplace(clipboard, "\R(?=\R{2,})") ;find 2 consecutive blank lines
  sleep 100
  ; Joe: see if last two chars are CR and/or LF
  LastChar:=SubStr(Clipboard,0,1)
  If ((LastChar="`r") or (LastChar="`n"))
    StringTrimRight,Clipboard,Clipboard,1
  If ((LastChar="`r") or (LastChar="`n"))
    StringTrimRight,Clipboard,Clipboard,1
  Send, ^v
  Return

Open in new window


I was wondering if there is a way to take it as a reference to remove 2 or more blank consecutive lines?
Thank you for your help.
0
Starting with Angular 5
LVL 13
Starting with Angular 5

Learn the essential features and functions of the popular JavaScript framework for building mobile, desktop and web applications.

Hello experts,
I would like to automate the following daily process through AutoHotkey:
Every time when I made a copy paste with multiple lines like this:
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
I need to manually move up from line 9 to line 1 (initial line of the copy-paste).
The idea is to:
Perform the copy-paste:
Send keys to move up automatically to the first string of the clipboard pasted.
In my example I expect to move the cursor from 9, last string of the clipboard to the first string of the clipboard l of line 1.
Obviously the AutoHotkey should be able to move up no matter the number of lines involved by the copy-paste
I expect the AutoHotkey to work on Notepad++, Word, Outlook EE block description and Excel if possible (:-))
If you have questions, please contact me.
Thank you for your help.
0
hello,

i have a powershells cipt to create shared folder and apply ntfs right on the file server, but now i have error:

the script:

$csvFile = "D:\test.csv"

$create = Import-CSV $csvFile

function DoPermissions
{
    param( $permissionGroup, $folder, $level, [switch] $NoInheritance)
    $toAdd = $permissionGroup -split ";"
    $InheritFlags = if ($NoInheritance) { 'None' } else { 'ContainerInherit,ObjectInherit' }
    Write-Host $folder
    foreach ($item in $toAdd)
    {
        $acl = (Get-Item $folder).GetAccessControl('Access')
        $ar = New-Object System.Security.AccessControl.FileSystemAccessRule($item, $level, $InheritFlags,'None','Allow')
        $acl.SetAccessRule($ar)
        Set-ACL -path $folder -AclObject $acl
    }
}

foreach ($folder in $create)
{
    $fullPath = $folder.folder #$path + $folder.folder
    if (!(Test-Path $fullPath)) {
      New-Item -ItemType Directory -Path $fullPath
      $fAcl = Get-Acl -Path $fullPath
      $fAcl.SetAccessRuleProtection($true, $true)
      Set-Acl -Path $fullPath -AclObject $fAcl
    }

    if ($folder.full_control) {DoPermissions $folder.full_control $fullPath "FullControl"}
    if ($folder.modify) {DoPermissions $folder.modify $fullPath "Modify"}
    if ($folder.read_execute) {DoPermissions $folder.read_execute $fullPath "ExecuteFile"}
    if ($folder.list_folder_content) {DoPermissions $folder.list_folder_content $fullPath "read,ExecuteFile" -NoInheritance}
    if ($folder.read) {DoPermissions 

Open in new window

0
Hello experts,
I have the following AutoHotkey script reported at: https://www.experts-exchange.com/questions/29157223/Autohotkey-assign-EE-link-option.html
;====================================
;Send blocks comment
;====================================

:*:blc::
If ((WinActive("ahk_exe excel.exe")) or (WinActive("ahk_exe vbsedit.exe")))
  CommentBlock:="' *************************************************************************`n"
              . "' Author:`n"
              . "' Creation date:`n"
              . "' Description:`n"
              . "' ***************************************************************************`n"
Else
If (WinActive("ahk_exe notepad++.exe"))
  CommentBlock:="Rem ======================================================================`n"
              . "Rem Author:`n"
              . "Rem Creation date:`n"
              . "Rem Description:`n"
              . "Rem ======================================================================`n"
Else
If (WinActive("ahk_exe powershell_ise.exe"))
 CommentBlock:="# ===========================================================================`n"
              . "# Author:`n"
              . "# Creation date:`n"
              . "# Description:`n"
              . "# ===========================================================================`n"
Else
If (WinActive("ahk_exe sciTE.exe"))
 CommentBlock:="; 

Open in new window

0
Hello experts,
I have the following script reported at:
I would like to take as a reference to close all active process.
WinGet,AllWindows,List
Loop,%AllWindows%
{
  CurrentID:=AllWindows%A_Index%
  WinGetClass,CurrentClass,ahk_id %CurrentID%
  If (CurrentClass="CabinetWClass")
    WinClose,ahk_id %CurrentID%
}
Return

Open in new window

This AutoHotkey will be used in case of emergency.
Thank you for your help.
0
Hello experts,
I am looking for an AutoHotkey that allows me to close all windows explorer windows (active, and minimized one's).
If you have advice on this please let me know.
Thank you for your help.
0
Hello experts,
The following script reported:Here
allows me to comment and uncomment a selection.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
commentChars := "//"
!^c::
    send ^c
    delimiter := "`n"
    thisvar := ""
    size := parsedTextContainerSize(clipboard,delimiter)
    Loop, parse, clipboard, `n, `r
    {
        ;MsgBox, index = %A_Index% . size = %size%
        if (A_Index < size)
        {
            thisvar := thisvar . commentChars . A_LoopField . "`n"
        }
        else
        {
            ;MsgBox, finally = %A_Index%
            thisvar := thisvar . commentChars . A_LoopField
        }
    }

    clipboard := thisvar
    send ^v
return

!^x::
    send ^c
    delimiter := "`n"
    thisvar := ""
    size := parsedTextContainerSize(clipboard,delimiter)
    Loop, parse, clipboard, `n, `r
    {
        line := ""
        firtTwoChars := ""
        pos := -1
        StringGetPos, pos, A_LoopField, %commentChars%
        if (pos = 0) 
        {
            ;StringReplace, newString, originalString, –, %A_Space%, 1
            StringReplace, line, A_LoopField, %commentChars%, ,
            ;MsgBox, line = %line%
        }
        else
        {
            line := A_LoopField
        }

        ;MsgBox, index = %A_Index% . size = %size%
        if (A_Index < size)
        {
            thisvar := 

Open in new window

0

Scripting Languages

27K

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.