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.

I would like to modify the current Powershell script to produce the output data shown in the DesiredOutput.out file.

NB - Changes include - Codes to show side by side, Totals to appear for each column shown, small formatting changes.

Below are the files for your review.

Source.in
Script.ps1
Output.out
DesiredOutput.out

Thanks in advance for your help.
Script.ps1
Output.out
Source.in
DesiredOutput.out
0
Hi All

I have this php file that looks at a directory full of jpgs and I'm yet to figure out how to show a jpg (using echo ($image)) that has a filesize greater then 1mb. Below is the php file

<?php 
header('Refresh: 10');

function cmp($a, $b) 
{ 
        return strcmp($b["time"], $a["time"]); 
} 

$directory = "G:/Photo Brief/JPG/"; 
$files = scandir($directory); 
$filearray = array(); 

foreach ($files as $key => $currfile) { 
        if($currfile != "." && $currfile != "..") { 
                $filename = $directory . "/" . $currfile; 
                $filearray[$key]["filename"] = $currfile;
                if (preg_match("/\.(png|jpg|jpeg|gif)$/i", $currfile)) 
                        $filearray[$key]["time"] = filemtime($filename); 
		
					
        } 
} 

unset($currfile); 
usort($filearray, "cmp"); 
$image = file_get_contents($directory . "/" . $filearray[0]["filename"]); 
$filetype = end(explode(".", $filearray[0]["filename"])); 
header("Content-type: image/" . $filetype); 
echo($image); 
?> 

Open in new window


Hoping to get direction here. Additionally, is there a way where the echo ($image) can be echoed using fade in effect?

Any help is greatly appreciated.
0
Hello experts,

I am trying to set up an AutoHotkey script that I will use on a regular basis to swiftly export file as Pdf and open folder in which it has been saved


I need some advice with the following:
1.      Coding structure and optimization proposal.
2.      Line 6 to 8 are required?
3.      Set up a return if active document has not been saved.
Example: I open a document and I forgot to save the document. If I launch the script an if statement should be set up to block the pdf export.
4.      Find the right saveas method for powerpoint and excel the save as method applied doesn't work. File is exported however When I open the file I got an error message.
5.      End the script by opening the pdf export file
6.      Find a method to applied the same mechanism for outlook>emails
If some requirements are complicated to cover I am willing to give up
If you have questions, please contact me.
SaveAsPdfSwitchCase.txt
0
I would like to modify the attached Powershell script to product the DesiredOutput, as attached.

I have included the Script.ps1, the Source.in file, as well as the current Output.out file and the DesiredOutput.out file.

Looking forward to some assistance.  Many thanks,
Script.ps1
Source.in
Output.out
DesiredOutput.out
0
Hi All

I have put together a php code, see below. It works when I load it into Chrome, Firefox... etc. The issue is I need it to auto refresh every 5 seconds though this is not working. Not sure if I missed something here. Any help is greatly appreciated.

<?php
include_once("global.php");
$page = $_SERVER['PHP_SELF'];
$sec = "5";
?>
<html>
    <head>
    <meta http-equiv="refresh" content="<?php echo $sec?>;URL='<?php echo $page?>'">
    </head>
    <body>
    </body>
</html>

Open in new window

0
Hi All

I'm trying to copy newly created .jpg files that start with capt and end in numbers, i.e. capt0468.JPG from a network drive \\10.10.1.252\pix using a windows batch file. There are folders within the pix folder ,they look like the below and store jpg files

Snip20200220_8.png
There are other jpg files that end in SM, MD, i.e. capt0430_MD or capt0430_SM within those folders - these are files I want to ignore.

Below is a windows batch file, I'm not sure where to start - hoping to get support here.

@echo off
set source="\\10.10.1.252\pix\*"
set target="C:\inetpub\wwwroot\Images\img"

FOR /F "delims=" %%I IN ('DIR %source%\*.jpg /A:-D /O:-D /B') DO COPY %source%\"%%I" %target% & echo %%I & GOTO :END
:END
TIMEOUT 4

Open in new window


I found the windows batch file does not work and I'm sure I'm doing something wrong here. Any help is greatly appreciated.
0
Array VB Script breaks if you change the hostnames, unable to modify.

arrFolders = Array( _
        "\\cgex01.sunlife.loc\c$\Program Files\RightFax\RFaxGate\;*.tmp", _
	"\\cgex01.sunlife.loc\c$\Program Files\RightFax\RFaxGate\;*.tiff", _
	"\\cgex01.sunlife.loc\c$\Program Files\RightFax\RFaxGate\;*.PDF", _
	"\\cgex01.sunlife.loc\c$\Program Files\Microsoft\Exchange Server\V14\TransportRoles\Pickup\", _
	"\\cgex01.sunlife.loc\c$\Program Files\Microsoft\Exchange Server\V14\RightFax Exchange Connector CGEX01\" _
        )
 
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
strBlatPath = "Blat.exe"
strServer = "mail.server.org"
strTo = "server.admins@server.org"
strFrom = "SunLife.RightFaxToExchange@server.org"
strSubject = "Rightfax Email Connector, Orphaned files found in Directories" 
intFolder = 1
For Each strFolder In arrFolders
	strBody = "Please see below the folder details:"
    intCount = -1
    strFolderSpec = ""
    strFileSpec = ""
    If InStr(strFolder, ";") > 0 Then
        strFolderSpec = Split(strFolder, ";")(0)
        strFileSpec = Split(strFolder, ";")(1)
    Else
        strFolderSpec = strFolder
        strFileSpec = Null
    End If
    intCount = CountFiles(strFolderSpec, strFileSpec)
    If strFileSpec <> "" Then
        strBody = strBody & vbCrLf & strFolderSpec & " has " & intCount & " " & strFileSpec & " files in it."
    Else
        strBody = strBody & vbCrLf & strFolderSpec & " has " & 

Open in new window

0
Hi Experts,

What script or software can I use on Ubuntu 18.04.3 i386, for the following:
- Check whether there is a wlan internet connection
- if there is a internet connection, do nothing.
- if there is no internet connection reconnect to a predefined SSID
0
Sorry but I am not a Powershell expert. And I want to modify a PowerShell script which executes a command for each line of a variable containing a list.

To make it all understandable, I will simplify my example  (in the reality, that's for vmware scripting, but my problem concerns the Powershell syntax )

Imagine a list of computers, stored in a variable, result of another powershell command.
It might look like this.:
SERVERA
SERVERB
SERVERC
SERVERD

And It's stored in a variable "list_computers" ($list_computers)
I want for each computer some (powershell) commands to be executed.
For example

display the computername
ping the computername

How to do that?
How to read each line of the variable ?
Should I use Foreach of Foreach-Object?
How to execute several commands ?

NB:
command "write $list_computers" give:

SERVERA
SERVERB
SERVERC
SERVERD

Could the following syntax be correct?

$list_computers | foreach-object {
$computer = $_
write $computer
command1 $computer
command2 $computer
}

Thanks

Jm
0
A bat file called m.bat was called on within a batch script. which displays information.
At the end of the running of the batch script (which called up the m.bat file), I would like to terminate the m.bat from running before the batch script exits.
How can I do this?
0
I have  .bat file which runs various commands once triggered.
At any point during the running of the .bat file I would like to pull up a message
that informs the user at what stage they are at..  just a text which flashes up and says
"Stage 5, ..  and counting down"...
and then I want that text to cut out.. and than at another point of the .bat file I want another text message to display showing
for example "Stage 4 - preparing file"... etc..
Can I insert these pop up messages and keep them up for about 10 seconds while the background script is running?
if yes how can this be accomplished... ?+
0
Using AutoHot key I would like to navigate to an area on a site to click on Sign in..
How can I code this into AutoHot Key script?

<a class="btn btn-primary-low courtesyNavEl hdr_cn.signin" href="/SecurityAuth/home/loginCheck?ReturnUrl=/"><i class="fa fa-user-circle-o"></i>&nbsp;Sign In </a>

and then click on it?

Thanks in advance for your help.
0
Hi Guys

I have a script that looks at a folder called Freak in this directory: C:\Users\szakhour\Desktop\Freak - there are .json files within this folder, each file name will be called something though will always start with LastScore

Snip20200203_5.png
What I want to do is import whatever .json file comes into the Freak folder into SQL whenever the script is run, script below

Declare @JSON varchar(max)

select @JSON = BulkColumn from openrowset (bulk 'C:\Users\szakhour\Desktop\Freak\*.json', single_clob) as j 

SELECT *
FROM OPENJSON (@JSON)
WITH 
(
    LeaderboardName varchar(20), 
    LeaderboardNameFull varchar(20), 
    PlayerCount varchar(20), 
    PlayerName varchar(20), 
    Score nvarchar(20),
    ZombiesKilled varchar(15)'$.ScoreDetails.ZombiesKilled',
    Accuracy varchar(50)'$.ScoreDetails.Accuracy',
    DamageTaken varchar(20)'$.ScoreDetails.DamageTaken',
    SecondsInLevel varchar(30)'$.ScoreDetails.SecondsInLevel',
    Deaths varchar(50)'$.ScoreDetails.Deaths'
)

Open in new window



I hope this makes sense. If not let me know.

Any help is greatly appreciated,
0
Greeting Experts,

Can somebody help me modify the following script to export the data to a .csv file as it pings/Nslookup for each device in the input folder... any help would be approached... Please find the script below...

$InputFile = 'D:\workstationsList.txt'
$addresses = get-content $InputFile
$reader = New-Object IO.StreamReader $InputFile
    while($reader.ReadLine() -ne $null){ $TotalIPs++ }
write-host    ""    
write-Host "Performing nslookup on each address..."    
        foreach($address in $addresses) {
            ## Progress bar
            $i++
            $percentdone = (($i / $TotalIPs) * 100)
            $percentdonerounded = "{0:N0}" -f $percentdone
            Write-Progress -Activity "Performing nslookups" -CurrentOperation "Working on IP: $address (IP $i of $TotalIPs)" -Status "$percentdonerounded% complete" -PercentComplete $percentdone
            ## End progress bar
            try {
                [system.net.dns]::resolve($address) | Select HostName,AddressList
                }
                catch {
                    Write-host "$address was not found. $_" -ForegroundColor Green
                }
            }
write-host    ""            
write-Host "Pinging each address..."
        foreach($address in $addresses) {
            ## Progress bar
            $j++
            $percentdone2 = (($j / $TotalIPs) * 100)
            $percentdonerounded2 = "{0:N0}" -f $percentdone2
            Write-Progress -Activity "Performing pings" 

Open in new window

0
Dear expert

We would like to show the freespace using .Net class of powershell, because the get-wmiobject did not work due to the access policy.

Is this possuble?
Thanks
0
Hello Experts
I would like to have either one script or seperate scripts to do the following
-Create user account in Active Directory with employee info as phone number ,email address, first name ,last name and specify OU
-Add user to specific groups as member
-Enable Exchange 2016 and skype 2016 accounts for user
I could have them either in seperate ordered scripts or one script that fetch the account after creation and then add it as member of specific groups and enable mail box in exchange 2016 and enable skype  for business account in skype on premises
Waiting for your kind advice
0
I would like to extract data from a CSV perhaps into another document, such as Word, or perhaps even in an email body if possible.
Several columns need to be added together.
The CSV file thought does not have any headers just approximately 28 columns of data.
Is there scripting that could help me accomplish this type of goal?
0
Hello,

I´m trying to import users to AD, the users are exported with csvde from the old AD. Now when I´m importing csvde its complaining about empty columns. The error message is "Error reading attribute list" and when I´m searching Google I found that its probably empty columns but I can't find anything how to get rid of the problem. I have tried to add a value in the empty columns with * but it still wouldn't take it.

importing with csvde -i -f c:\users.csv
I followed this guide: https://www.petenetlive.com/KB/Article/0000794

Any ideas?
0
After quite long, i started using SSIS, and ran into issue with building an SSIS package dynamically. Below is the scenario.

I built an SSIS package to load the data from a file in a specific folder to a table in SQL Server database, and archive the file to the respective folder. Since there can be several files in a folder, i used for each loop container to load the files. Below Attached are the screenshots/snippets of the package.  This package is executing successfully without any issues. I cloned and extended the same package for few other clients as well. As part of cloning, i modified the source folder and Archive folder connections and also the respective client database connection for the staging table. And they are all executing successfully without any issues.  Now, whenever i have to make a change, i am ending up implementing the same across all the packages. This is becoming little bit of hectic. So, i'm thinking just to build 1 package in the central database which has all the necessary linked server connections, and want to dynamically pass the server/database values and the source/archive folder values. Can someone help me to achieve this. Or, if there any other better way to implement this as part of 1 package that would be helpful too. I appreciate any help from experts in advance. Thank you.

Whole Package Data Flow Task in the For Each Loop ContainerSSIS Package Variables
Just an fyi- I tried various ways but wasn't successful. For example:

I created a …
0
I notice many IT security positions are starting to ask for scripting such as python and powershell and I wanted to know which direction I should go as far as learning and making the most of it.  Which language is easier or can learn faster and makes most sense in the long run.
0
Our audit mandates that an SQL account used by SolarWinds must have
its password expired periodically (eg: every 60 days) even tho we convey
it is a service account.

a) if we forget to change the password prior to expiry, service is affected

b) if we try to set it to non-interactive, will get the error in the attached

In UNIX nagios, I have a tool "changepass" that could change the password
of the nagios interactive account periodically which I could place in crontab
to set the password to an encrypted password ie if this password is seen
by an unauthorized party, he still need to decrypt it.

Thus, I plan to set this MS SQL account's password to expire every 60 days
& then set a script in task scheduler (or some sort of automated periodic
job in MS SQL/Windows) to do something like:
   net user /domain  SolarWindsOrionDatabaseUser  F1xedP@ssw0rd
(above command is for Windows, so I'll need equivalent for MS SQL).

Certainly using the scripted/automated way of changing the password
(including re-using back the password ie bypassing the password
  history should not result in the password being expired: I know this
  is against password history but I would still want it this way, pls.
  When we have time/remembers, we'll go into the script to change
  the password to be set in the script)

Certainly the script has to be non-readable or the password
F1xedP@ssw0rd   is the encrypted password so that if it's leaked/
seen, no harm.
NPMacctpasswdNonInteract.pdf
0
hello expert
I would like to receive some information from this website with beautiful soup.
website

I tried to explain with pictures.
ı want to get datas that's home team,away team and match score .

from bs4 import BeautifulSoup
import requests

r=requests.get('http://istatistik.nesine.com/TeamStatistics/IndexPopup.aspx?sportId=1&teamId=7&tournamentId=4&languageId=1').text#I guess I can't reach the relevant area of ​​the site here.
soup=BeautifulSoup(r,'html.parser')
print(soup.findall('div',class_='homeTeam'))

Open in new window

How can I get this data with python
thanks a lot
expert.png
2.png
awayteam.png
hometeam.png
matchscorepng.png
0
Hi experts
I would like to make design for Access points with wireless controllers as The password is changed automatically every period of time and sent to authorized users as I have open budget.

How can I implement that as now I have linksys stand by access points and I have to connect manually to change the password and send manually to group of users

waiting for kind reply from experts-exchange
0
I would like to automate a daily creation of a VHDX of my current computer.
Can this be run on a schedule every day at a specific time of day?
0
I am trying to use VBA to use a scripting index to hold information about numbers written in English, French, German, Spanish or Roman numerals, each between zero and a hundred. That comes to around 500 different keys (the numbers written as strings) to return the numerical values of the string with a letter code to indicate the language of the string. My problem is that my scripting index balks at more than around 256 items. Am I doing something wrong, or is the problem insolvable?
      The attached code shows the problem. However, to run a scripting index code, you must first activate “MS Scripting Runtime.” [In the VBA Editor, click on Tools, then on References. Locate “Microsoft Scripting Runtime” and click on it. Unclicked references are in alphabetical order and this one is quite far down the list of references, but if you type the letter “m” the cursor jumps to the first reference that begins with “M.” Hold the “m” key down and the cursor goes quite quickly through all the references that begin with that letter. Slow down when you near the goal and stop when the selection is on “MS Scripting Runtime.” Then click on that box and close the window. The next time you open References you will see it among the other clicked references.]
      The attached code is self-explanatory.
Option Explicit
Sub wiTest()
' Use a scripting index to store information about numbers written as strings of letters in different languages.
Dim scrNumsDict As New Scripting.Dictionary
Dim x As 

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.