Scripting Languages

27K

Solutions

20K

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 have an AppleScript that is used to programmatically create a test script file in one of these Office 2016 app folders:

~/Library/Application Scripts/com.microsoft.Excel
~/Library/Application Scripts/com.microsoft.Word
~/Library/Application Scripts/com.microsoft.Powerpoint

This is the test.scpt file content which is programmatically generated:

on handlerTest(thisPhrase)
	say thisPhrase
end handlerTest

Open in new window


This test.scpt file contains a single handler which speaks the phrase passed to it.

When the script is created in one of these folders, I cannot see the content of the script file in Finder and calling the handler from a Microsoft Office app using the new VBA AppleScriptTask causes the Office app to crash. I think the script is being created as a byte-compiled file because it cannot be viewed in Finder as plain text.

If I then copy the script file generated programmatically by my script creator script to the Documents folder, the plain-text content of the script is viewable in Finder.

Now, if I copy the script file from the Documents folder back to the corresponding com.microsoft folder (without modifying it), I can now see the plain-text content in Finder and calling the handler using the VBA AppleScriptTask function works as expected. I don't understand how the format is apparently changing due to copy/paste actions?

How can I programmatically create the script file in the com.microsoft.xyz folder in plain text format?

Here is my VBA procedure:


Open in new window

0
Cloud Class® Course: Certified Penetration Testing
LVL 12
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

hello,
i use this command to send a print job to our printer for specific user

for that i use the username and password of user and psexec, after that the user can go to the printer and us his badge to print the document.

PsExec.exe -u domain\userName -p password cmd.exe /c print /d:\\printserver\Queue_color C:\print\test.txt

this is send a job to our printer, when i go to the printer to print this job, i see remote downlovel document for the file name, and printer wont print it.

in our old printer xerox, this is work, but with our new canon not work.

maybe you can suggest other simple way to print a document ? i test out-printer locally and it work, but i dont now if i can use it with psexec?

thanks for help
0
Hi there, we are experiencing lookouts across our network as Lync saves users' password automatically in credential manager (Win 7). When users change their passwords, the lookouts start to happen. We're aiming to develop a script to delete such entries, but the entries can't be deleted. I've been digging about this topic but I haven't come across with any solution. I get an error message saying "CMDKEY: Element not found.", but the certificate is actually stored in credential manager. This is what I'm using:

@echo on
setlocal
set Filter=LegacyGeneric:
for /f "tokens=1*" %%a in ('cmdkey.exe /list ^| find /i "%Filter%"') do (
      echo Removing credentials for target '%%~b'
      cmdkey.exe /delete:'%%~b'
)
pause

This is the entry I have in credential manager: Target: LegacyGeneric:target=Microsoft_OC1:uri=user@domain:certificate:OCS:1

I really appreciate your help. Thanks.
0
I need a batch (ie .bat or .cmd) logon script that will check if the hostname is one of the 20
& if so, then only execute a series of commands on the PC.  The pseudo code will be like:

if %computername%="host1"  or ... or %computername%="host20"
then
   (
    command 1
    command 2
   )

Basically I need to get the syntax right
0
Dear Expert

Im going to scripting a file audit powershell script code is like this below:
Is there a easier way to write this? Like one variable $Path with all the folder path include instead create each path a $path variable?
$path1 = gc "\\srvp03\logs\log*"
$path2 = gc "\\srvp04\logs\log*"
$path3 = gc "\\srvp05\logs\log*"
$path4 = gc "\\srvp06\logs\log*"
$path5 = gc "\\srvp07\logs\log*"
$path6 = gc "\\srvp08\logs\log*"
$path7 = gc "\\srvp09\logs\log*"
$path8 = gc "\\srvp10\logs\log*"
$path9 = gc "\\srvp11\logs\log*"
$path10 = gc "\\srvp12\logs\log*"
$path11 = gc "\\srvp13\logs\log*"
$path12 = gc "\\srvp14\logs\log*"
$path13 = gc "\\srvp15\logs\log*"
$path14 = gc "\\srvp16\logs\log*"
$path15 = gc "\\srvp17\logs\log*"
$path16 = gc "\\srvp18\logs\log*"
$path17 = gc "\\srvp19\logs\log*"
$path18 = gc "\\srvp20\logs\log*"
$path19 = gc "\\srvp21\logs\log*"
if($path1 -ne $null){write-host "File in $Path1"}
if($path2 -ne $null){write-host "File in $Path2"}
if($path3 -ne $null){write-host "File in $Path3"}
if($path4 -ne $null){write-host "File in $Path4"}
if($path5 -ne $null){write-host "File in $Path5"}
if($path6 -ne $null){write-host "File in $Path6"}
if($path7 -ne $null){write-host "File in $Path7"}
if($path8 -ne $null){write-host "File in $Path8"}
if($path9 -ne $null){write-host "File in $Path9"}
if($path10 -ne $null){write-host "File in $Path10"}
if($path11 -ne $null){write-host "File in $Path11"}
if($path12 -ne $null){write-host "File in $Path12"}
if($path13 -ne 

Open in new window

0
hi, please refer to the:
https://www.experts-exchange.com/questions/29066306/xlsx-xls-csv-conversion.html
thread
Bill Prew gave me the solution for converting my excel files on UTF-8 CSV (thanks again, Bill! :=))

Const xlCSV = 6
Const xlTex = -4158
Const xlTextWindows = 20
Const msoEncodingUTF8 = 65001

strDir = "C:\Perl64\eg\alma\files"

Set objFSO = CreateObject("Scripting.FileSystemObject")

With CreateObject("Excel.Application")
    .Visible = False
    .DisplayAlerts = False

    For Each objFile In objFSO.GetFolder(strDir).Files
        strExt = objFSO.GetExtensionName(objFile.Path)
        If LCase(Left(strExt, 3)) = "xls" Then
            Wscript.Echo "Reading file: [" & objFile.Path & "]"
            With .Workbooks.Open(objFile.Path, False, True)
                With .Sheets(1)
                    .Rows(1).Delete
                    .Columns(1).Delete
                End With
                strPath = Replace(objFile.Path, "." & strExt, ".csv")
                Wscript.Echo "Writing file: [" & strPath & "]"
                .WebOptions.Encoding = msoEncodingUTF8
                .SaveAs strPath, xlTextWindows
                .Close False
            End With
        End If
    Next

    .Quit
End With

Set objFSO = Nothing

Open in new window



but I've noted that the UTF-8 conversion doesn't always works well.
Please see a sample enclosed: a french address "converted" utilizing the OpenOffice Calc csv-UTF-8 conversion (openOffice.jpg) and  the same address "converted" using the script (excel2013.jpg).
You can see the presence of the double commas "" and an unsatisfactory rendering of some letters on the Excel conversion.
maybe that I need some patch to my (old) 2013 Excel? or should definitively upgrade to a more recent version?

Thanks,
Fabiano
excel2013.jpg
openOffice.jpg
0
What is the command line command to set the Windows time and date according to an internet time server?
0
To add text (hashtags) to a series of text files, each set of text files is in a named folder/directory. Recursively I want to add both #directoryname AND #filename(without extension) to the end of each text file, though anywhere will do, such as the beginning. So to do this for every folder's content in the head folder.

I am wondering if AWK can do this since I've had a bit of practice with it, albeit at a simple level.

later: ok so pwd gives me the absolute working/current directory, but I need just the cd on its own... not found anything does that yet.

Anthony


Context (i.e. the problem instead of the solution): exporting Apple Mac Notes using Exporter app. which creates the text file hierarchy, the import to Bear app, which uses the hash tags.
Doing this also to an Evernote export enex file and basecamp to follow
0
I need to connect to FTP server through Command Prompt.

When I am trying to connect to it, it says Connection Timed Out.

D:\>ftp
ftp> open
To xyz.test.com
ftp: connect :Connection timed out
ftp>

What must be the reason behind it? Please help

I can connect to it through Filezilla.
0
Outlook 2010 user has e-mail hosted by Gmail (IMAP), and has created around 50-60 subfolders.  Auto archive will not work on those folders, which requires him to do a manual cleanup archive of the Gmail account and all subfolders.  This works fine, but has to be done manually every so often.  Is there a better way and without 3rd party software?
0
Cloud Class® Course: CompTIA Cloud+
LVL 12
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

from 5:30pm - 7:30am everyday i want to forward and bcc any google email that comes in from test@test.com to test2@test2.com.
from 7:30am - 5:30pm I what to turn off the forwarding.

Can i achieve this by using a Google Apps Script ?

Ultimately i need this to be automated so it doesn't require manual intervention

Cheers

Troy
0
We have a storage in production and one storage in DR site. The link between sites are not strong enough to support replication.
How to copy last  1 day or 2 days files from production storage folder to External HDD using a script.
Then copy HDD to DR storage.

Appreciate
0
This question is related to EXTJS 4. I have a datefield which comes with picker. But the events are not fired and so not able to pass the selected date value to the controller in Spring.
In getStandardEffectiveDateFormParameters() method doesn't have date value. datefield  events not fired.
Here is the code.

var standardEffectiveDateForm = new Ext.form.FormPanel({
        title: "Update Standard Effective Date",
        width: 250,
        height: 240,
        frame: true,
        items: [
        	nationalstateSFDField = new Ext.form.Checkbox({
                xtype: 'checkboxfield',
                name : 'nationalstateChoice',
                boxLabel:'(Check this box for State Transfer)',
                fieldLabel: '<span style="color: rgb(0, 0, 0);white-space:nowrap;">State&nbsp;Transfer</span>',
                checked: false,
                listeners: {                     	   
                    'change': function () {
                    	var state_transfer = this.getValue();   
                    	if (state_transfer === true) {
                    		Ext.getCmp('stateSFDChoiceField').show();
                    	}else{
                    		Ext.getCmp('stateSFDChoiceField').hide();
                    	}
                    }
                }
        	}),
        	stateSFDField = new Ext.form.ComboBox({
        	  xtype: 'combobox',
	          allowBlank: false,
	          id: 'stateSFDChoiceField',
	          fieldLabel: '<span style="color: rgb(255,

Open in new window

0
Hello Experts, How could i use this Auto Hotkey code (ahk)
closehandle("_circleDock_")

closehandle(name){
	pid := 0
	handle := getHandle(pid,name)
	if (handle = "") {
		return ; handle not found
	}
	command := "C:\Users\Astryd\Risorse\_CircleDocks\handle.exe -p " . pid . " -c " . handle . " -y"
	Run, %comspec% /c %command%,, Hide
	}    
}

getHandle(ByRef pid,name) {
	command := "C:\Users\Astryd\Risorse\_CircleDocks\handle.exe -a " . name
	stdout := runStdout(command)
	needle := "No matching" ;when Handle found nothing return in standard output "No matching handles found."
	IfInString, stdout, %needle%
		{
		return ""
		}	
	handle := RegExReplace(stdout, "s).*(...): \\Sessions\\1\\BaseNamedObjects\\_CircleDock_.*", "$1")
	pid := RegExReplace(stdout, "s).*pid: (\d*).*", "$1")
	Return handle
}

; Run a command and return standard output
runStdout(command) {
    shell := comobjcreate("wscript.shell")
    exec := (shell.exec(comspec " /c " command))
    stdout := exec.stdout.readall()   
    Return stdout
}

Open in new window

0
hello Experts,

i need your help today to modify this powershell GUI script.
i use this script for my help desk, its a gui to change a user password (active directory account)  and send the new password to the printer, then the user can use his badge to print his new password.

in this script, actually, the password need to be entred by the administrator, what i need is generate the password automaticly with 10 char (lowercase, uppercase and number).

i need also to remove some think from the gui like the picture, I surrounded what i need to remove.

thanks for help
pic.jpg
script.txt
0
I am having issues with the Scheduled Task. I can run the script manually via PowerCLI 6.5 witch prompt for windows login every time but no issues after, but the Scheduled Task just continues to run with no stopping in sight and nothing happens.

can someone please tell me how I can Schedule this to run. things to bear in mind is that our vCenter is on a different domain so I have to use those credentials from the domain am logged from.

this is the link I have tried to follow, but am just not able to task schedule. If someone can write a batch file to run this script that don't prompt for credentials every time I manually run it?

http://www.virtu-al.net/vcheck-pluginsheaders/vcheck/

I followed the below link as well, but that didn't work and I think its because our VM is on another domain?

https://virtualdatacave.com/2015/12/vicredentialstore-and-scheduling-vcheck-with-ad-user-and-vicredentialstore/

vCenter 6.0 update 2
PowerCLI 6.5
vCheck 6.25

Thanks
1
I have a Web page where I have to traverse the DOM to find out all elements that have a class that starts with "accordion-toggle ". Each such object gets a similar class assigned, when the accordion widget is opened/closed:
The opened/closed accordion with the CSS code changing
To make an automated black-box test for Ranorex, where all accordions are clicked & their behaviour checked, I need a DOM-like object that contains all accordions in a page so that the automated testware can click through the objects & check whether they behave properly. How can I extract this information? I am trying for two days now to see the rather very hierarchical structure of the page and wonder, if there is an easy way to extract this information.

Edit:
There is a solution, but it results in an OutOfMemoryException, although there is plenty of memory on the server available. Here you go:

        /// <summary>
        /// Finds the accordion widgets
        /// </summary>
        public void FindAccordionWidgets()
        {
            Report.Log(ReportLevel.Info, "Code", "FindAccordionWidgets() started…");
            IList<Ranorex.Unknown> elementList = repo.Home.Self.Find<Ranorex.Unknown>("//*[@class~'accordion-toggle'][@visible='true']");
            Report.Log(ReportLevel.Info, "Code", "elementList populated.");
            
            foreach (Ranorex.Unknown elementItem in elementList)
            {
                Report.Log(ReportLevel.Info, "Code", "elementItem " + 

Open in new window

0
I want to download installer file from sites like Evernote or  https://www.dropbox.com/install#downloaded with curl, but I don't know how to do it to download no direct link with curl
0
Running Exchange 2013.  

When I issue the PowerShell command below, I get unusable output.  (See the attached image file.)  What can I do to get the data in a usable format?

I found the command online and it seems to work for others.  Not sure why it isn't working for me.

Thanks,


The PowerShell command is:
Get-Mailbox | Get-MailboxStatistics | ft DisplayName,@{N="Total Item Size (MB)";E={$_.TotalItemSize.value.tomb()}},@{N="Total Deleted Item Size (MB)";E={$_.TotalDeletedItemSize.value.tomb()}},@{N="IssueWarningQuota (MB)";E={(Get-Mailbox $_).IssueWarningQuota.Value.toMB()}},@{N="ProhibitSendQuota (MB)";E={(Get-Mailbox $_).prohibitsendquota.Value.ToMB()}} | export-csv c:\temp\mailbox-size.csv -NotypeInformation
Mailbox-Size-Output.PNG
0
Free Tool: SSL Checker
LVL 12
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Greeting Experts,

I need help adding some additional functionality to current PowerShell script... I currently use a power shell script along with psshutdown.exe to reboot a list of computers from a text file.  The script works as it is now, but I would like to be able to get feedback on the results (i.e., completed successfully, access-denied, etc.) for each device that is touched. Can somebody help me with this task...

$psSwitches = ” -u Domain\Username -p Password   -r -f  -t 0"

$strComputer = get-content ".\Desktop\RebootScript\Servers.txt"
$application = ".\Desktop\RebootScript\psshutdown.exe"
Foreach ($i in $strComputer)
 {
    $arguments = “\\$i” + $psSwitches 
    [System.Diagnostics.Process]::start($application,$arguments)
    # write-host $arguments
    }

Open in new window

0
Is there a script that can be attached to a windows task in Windows Task Scheduler that writes (appends) to a text file the login name and time that someone changes the task to "Disabled" or "Enabled" ?
0
Google sheets to enter Amount in a web calculator.

In the Attached image of a Special Web Calculator, I need to Enter Amount, State, Term/Interest Rate & then return the 2 resulting values given by the calculator into a google sheet.

Here is the “Inspect Code” from Chrome:
<div class="slider"><input type="range" step="100" min="0" max="100000" class="range" value="25000"><input type="text" class="mt-4 input-box" value="$ 25,000"></div>

<select class="form-control custom-select" id="addressState"><option value="">Choose a State...</option><option value="CT">Connecticut</option><option value="CO">Colorado</option><option value="FL">Florida</option><option value="MD">Maryland</option><option value="NM">New Mexico</option><option value="NY">New York</option><option value="NV">Nevada</option><option value="PA">Pennsylvania</option><option value="UT">Utah</option><option value="VA">Virginia</option></select>

<select class="form-control"><option class="text-muted" value="0">Select Loan Term...</option><option id="1" value="1">10 Year Loan 2.99%</option><option id="2" value="2">20 Year Loan 3.99%</option></select>

<button class="btn btn-non-active pointer"><span class="icon icon-calculator mr-2"></span><!-- react-text: 45 -->Calculate Payment<!-- /react-text --></button>

<p class="payment">$ 109</p>

<p class="payment">$ 157</p>

 Please note that this a follow on to: Google sheets to use a web calculator posted On 2018-04-22
0
Hi,
I need to create .exe file in Autoit which will acheive this:

search c:\xml\ folder for xml filename (specific portion in a file name) that i supply/input in textbox and show it in the listbox , then have another textbox which i can give another name and change the name i choose from listbox .

let say there is xmls files in this folder:
c:\xml\

1. 658 961324913 20180422213033.xml
2. 688 9415460918 20180422221407.xml
3. 761 963837127 20180422215149.xml
4. textfilename.txt

i insert/search in the search textbox for : "9415460918"  (it will search only the number in between 2 spaces) from the  files in the folder
the search botton will list only  file number 2 (xml file)
I insert in another textbox new name like : "2154632810"
it will change the filename to : 688 2154632810 20180422221407.xml


i have play with some example that maybe help around:
#include <GuiConstantsEx.au3>
#include <File.au3>
#include <Array.au3>

;GUI
GUICreate("Rename XML files", 300, 500)
$sourceFolder = GUICtrlCreateInput("Source Folder", 10, 10, 280, 20)
$add = GUICtrlCreateButton("Search", 10, 35, 75, 20)
$mylist = GUICtrlCreateList("", 10, 60, 280, 300)


GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $add
            $sFolder = ControlGetText("Rename XML files", "", "Edit1")
            Local $FileList = _FileListToArray($sFolder, "*.xml")

            If @error = 1 Then
                …
0
We are reviewing compliance against cis/sans top twenty cyber controls, and one of the controls is that of limiting access to script tools, which it sites an example of powershell and python. If users only have standard user rights (no local admin) what is the risk of them having powershell at their disposal on their assigned laptop/workstation?

And how from a systems admin / support perspective could you restrict access to such scripting tools to standard users? e.g. how can you hide/uninstall powershell for all?
0
I have a PS script that does an SFTP connection via WinSCP.  It's attached here.  Another PS script calls it, it connects and collects files and disconnects. However, if it cannot establish a connection, it errors but does not disconnect or reset.  How can I get this SFTP connection script to try the connection and if it fails, close the session and reset itself so it's not hanging up WinSCP?  I am attaching this SFTP-download script here.  Again, there's no failure code for when it cannot establish a connection.
SFTP-Download.txt

######
# Created by Radiology Associates of San Luis Obispo.
#   Please review Get-Help SFTP-Download -Parameter "(name or *)" for more information on parameters.
#   This script requires WinSCP .net assembly (.dll) version 5.9.2.0. See links for the download location.
#   To use the WinSCP assembly via powershell [mandatory], register it using: %WINDIR%\Microsoft.NET\Framework\(v4.0.30319 or v2.0.50727)\RegAsm.exe WinSCPnet.dll /codebase /tlb
#   Thank you WinSCP for providing a fantastic SFTP client and a robust .net assembly.
######

function SFTP-Download {
<#
.SYNOPSIS 
    SFTP-Download downloads all text files from a remote directory and then deletes the source files.
.DESCRIPTION
    After verifying files exist, SFTP-Download downloads all text files from a remote directory ($remote), 
    copys them to a destination ($local), and deletes the source files. 
    It can create logging for errors and success.                      

Open in new window

0

Scripting Languages

27K

Solutions

20K

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.