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 have the following XSL which gives me 'dow' as 0-6 which I can call later on (see below).
I need the same sort of code which will also allow me to call 'doy' for day of year.  So, October 31st would result as 305 or something similar.  January 1st would be a 1.  

Any guidance on this would be great.  
Thanks

	<xsl:template match="/dataset">
		<dataset>
			<xsl:variable name="year" select="number(substring($date, 1, 4)) "/>
			<xsl:variable name="month" select="number(substring($date, 5, 2)) "/>
			<xsl:variable name="day" select="number(substring($date, 7, 2)) "/>
			<xsl:variable name="a" select="floor((14 - $month) div 12)"/>
			<xsl:variable name="y" select="$year - $a"/>
			<xsl:variable name="m" select="$month + 12 * $a - 2"/>
			<!-- 0-6, where 0=Sunday. -->
			<xsl:variable name="dow" select="($day + $y + floor($y div 4) - floor($y div 100) + floor($y div 400) + floor((31 * $m) div 12)) mod 7"/>

Open in new window

0
I need an Outlook 2013 to 2019 MACRO that MOVES
emails to a folder ONLY after I request the move
since I have 200+ folders and don't want to
manually drag items into their associated folders ?

Example #1
1. View new email from "Jane Doe"
2. Click "Move to Person's Folder" Toolbar ICON
3. Outlook automatically CREATES "Inbox/Jane Doe"
   folder if need and moves it there

1. View new email from "Bob Smith"
2. Click "Move to Person's Folder" Toolbar ICON
3. Outlook automatically CREATES "Inbox/Bob Smith"
   folder if need and moves it there
0
Need a PowerShell script to fulfill requirement below:

We are on various tiers E1, E3, E5 of O365 & would like to do remote wiping for staff
who read company emails on their phones (various Android models & iPhone).

Vendor told us we don't need inTune but MDM is part of our subscription which allows
us to manually 'enable'/'enforce' mobile users to use MDM but we want a script
to automate this for newly onboarded users.

o   Requirement: to set rule so that any newly added users will be automatically added into the MDM group
·         tested with MS engineer & confirmed that the only feature that can fulfil the requirement is Dynamic Group
          which only available in Azure AD Premium 1 license

·         Our goal is to enforce all members (new or existing users) to use MDM
0
Hi Experts - Does anyone have a VBScript that will pull all groups in Active Directory and then list the "Member Of" attributes assigned to those groups?  Any help with this is greatly appreciated.
0
Hello experts,

The following AutoHotkey allows me to run cmd as admin.
;====================================
;Run Cmd
;====================================
#!c::
If !(A_IsAdmin) ;you are not admin
;If (A_IsAdmin) you are admin
{
;~ Run,%comspec% /k
  Run, *RunAs %comspec% /k
  Return
}
Else
{
  msgbox,ADMIN=%A_IsAdmin%
  Return
}

Open in new window


I was wondering if there is a way to put an error level and review the procedure if necessary.
Thank you for your help.
0
Hello experts,

I was wondering if there is a way to set up an AutoHotkey to zip & unzip files.
I used 7zip application.
I know that 7zip proposed some commands to zip & unzip files so I was wondering if there is a way to converge commands with AutoHotkey or if there is another away through AutoHotkey to attempt this.

The most frequently commands that I used are the following:
-Zip (archive): this command allows me to zip one file
C:\PCR\Tools\Zip\7za.exe a "C:\Downloads\FileSelected.doc" "C:\Downloads\FileSelected.zip"
-Unzip (extract): this command allows me to unzip one file
C:\PCR\Tools\Zip\7za.exe e "C:\Downloads\ZipFile.zip"

The idea is to define two AutoHotkey to performed above actions by taking into account the following:
-Zip (archive)
>File to archive is the one selected (it can be more than one) destination zip file will be named as following YYYYMMDDMMHHMMSS_ZipFile.zip
Unzip (extract)
-Be able to unzip one or multiple files based on selection

If multiple file management is complicated to set up I can accept individual file management.

Thank you for your help.
0
Hello experts,

The following AutoHotkey allows me to copy files path to clipboard and do the same for notepad++ by using send input.

;====================================
;Windows Explorer: copy full path of active Excel, PowerPoint, or Word file to the clipboard. 
;====================================

+F8::
WinGet ActiveWindowPID,PID,A ; save active window PID
WinActivate % "ahk_id " DllCall("GetDesktopWindow","ptr") ; register Office app in ROT - thanks to lexikos for this line of code
WinActivate,ahk_pid %ActiveWindowPID% ; after registering Office app in ROT, reactivate Office app
If (WinActive("ahk_exe excel.exe"))
  Clipboard:=ComObjActive("Excel.Application").ActiveWorkbook.FullName
Else
If (WinActive("ahk_exe powerpnt.exe"))
  Clipboard:=ComObjActive("PowerPoint.Application").ActivePresentation.FullName
Else
If (WinActive("ahk_exe winword.exe"))
  Clipboard:=ComObjActive("Word.Application").ActiveDocument.FullName
Else
If (WinActive("ahk_exe notepad++.exe"))
  Sendinput ^+p
Else
  Clipboard:="Active window is not Excel, PowerPoint, Word or Notepad++"
Return

Open in new window


I would like to take as a reference to open containing folder:
20191223_103502-open-file-location.png
Defined shortcut on notepad to open containing folder is: ^!0

If you have questions, please contact me.
Thank you for your help.
0
Run Install.exe for remote Computers using Powershell

I have HP Drivers folder in the Network , inside the HP Drivers folder there is a file called Install.exe.
I would like to have a script reads computer names from csv file and run the Install.exe silently on each computer listed on CSV file.
The Install.exe will install printer , I would like it to pick up the "HP Universal Printing PCL 6" as driver.

Any Help will be very much appreciated.

Thank you
0
Script to Manage Wireless Networks

I have a list of computers on a CSV file. example:

ComputerName,UserName
CompA, User1
Comp2,User35
Comp3, User62
etc....

Open in new window


for now each technician will go to each computer:

-open Network and Sharing Center
-Click on Manager Wireless Networks
-Right-Click on  one of the Wireless Networks icon , for instance called: CompWireless  and click on its properties to open  properties window
-Click on Security tab , then click on Advanced, then click on Save Credentials
- in the popup window type in DomainName\username  and password then click OK ,OK, OK on all those windows to close them

I thought if this can be done through script that might save a lot of hassle.

Note: the password is the same for all user accounts on the csv file.

Any help will be very much appreciated.

Thank you
0
add work group computers to  DNS (A and PTR Records)

I have computers in work group. I want their hostnames to be add to DNS Forward and Reverse lookup zones( A & PTR Records)


Thank you
0
Vmware View Command line
I have this Vmware  view command line that I want an expert to explain  its function.

Thank you
vmware-view.exe -serverURL VM.DomainName -username Myuseraccount -domainname Mydomainname -password  Mypassword  -ConnectUSBOnStartup true -ConnectUSBOnInsert true -unattended

logoff

Open in new window

0
Which INF file is used by "HP Universal Printing PCL 6"

I would like to know which INF file is used by "HP Universal Printing PCL 6".
When I go to any remote computer and install a printer using the Wizard and select "HP Universal Printing PCL 6", it will install and after install if  I right-click the printer and select properties, it will open up the properties without any issue.

if I remotely install the printer using the script below, it will install the printer, and  after install if  I right-click the printer and select properties, it will first throw an error message shown on the screenshot below then  open up the properties window, when I send test print job, it will not print.

for /f %%a in (C:\Scripts\CalledScripts\CompOnly.CSV) do (


@echo Creating Printer Port on %%a
 cscript.exe "C:\windows\system32\Printing_Admin_Scripts\en-US\prnport.vbs" -u administrator -w "Bouandas1!" -a  -s %%a -r "Printerhostname" -h hostname -o raw -n 9100





\cscript.exe "C:\windows\system32\Printing_Admin_Scripts\en-US\Prndrvr.vbs" -u administrator -w "Bouandas1!" -l -v 3 -e “Windows x64” -m "HP Universal Printing PCL 6"  -h hostname -s %%a



@echo Setting Printer on %%a
cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs" -u administrator -w "Bouandas1!" -d -a -p "Printer Queue Name" -m "HP Universal Printing PCL 6" -r "Printerhostname" -s %%a

)

Open in new window



d
0
Hello experts,

I was wondering how to restrict specific AutoHotkey for application and turn off them for other applications.
Example:
I would like to use the following AutoHotkey exclusively when I used Excel:
;====================================
;Excel paste special
;====================================
;$if the send contains same letters of hotstring
$^#v::
If (WinActive("ahk_exe excel.exe")) 
{
  Send, !esvt
  Sleep, 100
  Send, {Enter}
  Return
}
Else
{
  MsgBox,4144,Error,Active windows is not an excel windows
  Return
}

Open in new window


The benefit of If approach condition is that I restrict the AutoHotkey for Excel however the drawback is that I cannot turn off for other applications.
Let's suppose that I change the AutoHotkey for:
;====================================
;Excel paste special
;====================================
;$if the send contains same letters of hotstring
#d::
If (WinActive("ahk_exe excel.exe")) 
{
  Send, !esvt
  Sleep, 100
  Send, {Enter}
  Return
}
Else
{
  MsgBox,4144,Error,Active windows is not an excel windows
  Return
}

Open in new window

When Notepad ++ process is running.
I would have error message instead of having the default windows action related to #d which is open desktop.
This question is crucial for my daily actions as I want to avoid clash between other default windows shortcuts.
Thank you for your help.
0
Finding out status of printspooler empty or not
In Vb6 we do shelling this

I use ( advised by : Steve Knight )   this to turn a printer(s) off line
cscript "C:\Windows\System32\Printing_Admin_Scripts\nl-nl\prncnfg.vbs" -t  -p "HP OfficeJet One" +workoffline
cscript "C:\Windows\System32\Printing_Admin_Scripts\nl-nl\prncnfg.vbs" -t  -p "HP OfficeJet Two" +workoffline
this 5 total printers

Then start the job by setting the first printer on line
 cscript "C:\Windows\System32\Printing_Admin_Scripts\nl-nl\prncnfg.vbs" -t  -p "HP OfficeJet One" -workoffline
Start printwork for this one

Now before turning next printer on line I must know that spooler for this first Job is empy at printer
then next job , etc.
0
I would like to automate Disk2VHD using a script, perhaps Powershell or Batch, or VBS.
Is this possible?
I would like to automate this so that it saves that latest copy of my computer every night.
0
hello, expert.
there is one home listings site.
I would like to receive some information within this site.
this site's url is https: =  //www.hurriyetemlak.com/satilik
I marked the information I want with a red square.
I want to get the data I marked with beautifulsoup.
and I want to get this data in json format.
I'm new to python.
import bs4
import requests

r=requests.get("https://www.hurriyetemlak.com/satilik")
print(r.status_code)
soup=bs4.BeautifulSoup(r.content,"html.parser")
#print(soup.find_all("div",attrs={"class":"col-lg-12 mt-1 box list-container"}))
adresler=(soup.find_all("div",attrs={"class":"col-lg-12 mt-1 box list-container"}))
for x in adresler:
    print(x)

Open in new window

ı did something in its own right.
but I didn't make much progress
I don't know how.
I need your help.
thanks
Ads-z.png
0
Hi,

I d need to run a powershell script on a remote server with specific admin credentials, passing also local parameters. I do need the output LOCALLY.

It should really run ON the remote computer otherwise you have the double hop issue (f.e.you cannot do a test-path $path via blue-collar).

How could I achieve that?
Something like

invoke-command {start-job $MyCommand parameters -credentials} -session $session -asjob -credentials $credentials

?

Tried it but result is empty
---
Found something here:

https://devblogs.microsoft.com/scripting/powershell-jobs-week-remote-jobs/

Please see also:

https://www.experts-exchange.com/questions/29167473/Invoke-Pssession-Parameter-set-cannot-be-resolved-using-the-specified-named-parameters.html
0
Having these  lasers with 5 papertrays  for input
only 1 output bin

I print mutiple  sets of documents per document  setting a papertray  due to different color in paper
then the colors must stay together in output bin
if I start printing right away they are unsorted by color in output bin

I  print  some  50 documents to  printers called BLEU, WHITE , GREEN ,YELLOW,PINK wich are installed copies of same printer
with each having their preferred  tray

Thus printing to each printer based on tray

Now by hand BEFORE starting print job I set  all printers to offline
then start printing
all output will be in  each printer buffer on hold

Then by hand turn one by one the printer online again after a set in each named printer is empty
this way all colors are on output bin  together

so to make it automatic i need a  programmable  way ,   to turn printers on and off line
printer is a  Kyocera ECOSYS P3260dn KX
0
pass username and password in batch file

I have this Script that adds a printer on each computer listed on text file , then at the end it calls a powershell, printer.ps1 that enables on the printer the option "Print Directly to printer"

Everything works fine.
I would like to run the script from my computer which is joined to the Domain against the computers listed on the text file which are not joined to the domain. So I need to pass username and password on this script ..the remote computers all have the same local Administrator account and password of Pass2020.

@echo off
setlocal
for /f %%a in (CompPrinterConf.txt) do (
@echo starting pnpport on %%a

 cscript.exe "C:\windows\system32\Printing_Admin_Scripts\en-US\prnport.vbs" -a  -s %%a -r "AAAA" -h hostname -o raw -n 9100
@echo Waiting 5 seconds
timeout 5
@echo starting setting MyPrinter on %%a
cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -a  -p "XXXX-YYYY" -m "HP Universal Printing PCL 6" -r "AAAA"  -s %%a
REM Not really needed, because the script will continue with the next machine
REM timeout 5


)
@echo starting powershell
PowerShell.exe -ExecutionPolicy Bypass -Command  c:\Scripts\printer.ps1
REM timeout 5

Open in new window

0
list non-accessible Remote computers via a Script

I have a script below that add printer and it  works just fine when I run it against accessible computers that are listed on the file "CompPrinterConf.txt"

I would like to have the script generate another file that displays computers that the script could not access.

usually if try \\remotecomputer\c$  and am able to access the remote computer then the script will run successful , otherwise it fails.
However when you have so many remote computers then it would be better to have a script that generates non accessible computers in a separate file.


Thank you

@echo off
setlocal
for /f %%a in (CompPrinterConf.txt) do (
	@echo starting pnpport on %%a
	cscript.exe "C:\windows\system32\Printing_Admin_Scripts\en-US\prnport.vbs" -a  -s %%a -r "PortName" -h hostname -o raw -n 9100
	@echo Waiting 5 seconds
	timeout 5
	@echo starting setting MyPrinter on %%a
	cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -a  -p "Myprinter" -m "Generic / text only" -r "PortName" -s %%a
	REM Not really needed, because the script will continue with the next machine
	REM timeout 5
)

@echo starting powershell
PowerShell.exe -ExecutionPolicy Bypass -Command  c:\Scripts\printer.ps1
REM timeout 5

Open in new window

0
Pass username and password in windows batch

I have this code that enables direct print on the printers of each computer read from csv file CompOnly.csv
each computer is accessed with the same username and password. I just want the code below to pass username and password , so that I do not get access denied or popu to enter user name and password for each computer.

Thank you

FOR /f "delims=" %%G in (c:\Scripts\CompOnly.csv) DO wmic.exe /node:%%G printer where "Name='Myprinter'" set Direct=1

Timeout 5

Open in new window

0
My site gets a cookie error in the console:

I use a plug-in called:
http://3dflipbook.net/


I decided to Inspect the page and found these errors...

===
query-migrate.min.js?ver=1.4.1:2

JQMIGRATE: Migrate is installed, version 1.4.1

A cookie associated with a cross-site resource at http://www.pagespeed-mod.com/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.
pdf.worker.js:1

The provided value 'moz-chunked-arraybuffer' is not a valid enum value of type XMLHttpRequestResponseType.
e @ pdf.worker.js:1

====

This is a new site, but I am not promoting it yet. I have no Terms of Use, but plan to do that. I guess what I can conclude from this error is that the plug-in (mention above) uses a cookie.

What shall I do about this error? What does it mean?

Thanks
0
Hello experts,
I am trying to set up an AutoHotkey to add quotes of a selected text:

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

I was wondering if I can proceed as above or I need to add a loop as performed for adding specific character at the beginning of each line:

^+-::
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


Thank you for your help.
0
Hello experts,

Most of my EE questions are related to a directory created in my machine.
in order to properly manage this process, I would like to set up and AutoHotkey to cover the following requirement:
Once I select a file, I would like to activate an AutoHotkey to rename the selected file with current directory name.

Example:

If this file is located at Download directory.
20191211_152815-screenshot.pngI select the file and activate the AutoHotkey it should be rename it as following:
20191211_152858-screenshot.png
If you have questions, please contact me.

Thank you for your help.
0
Dear expert

See script code below:
$serverlist = Get-Content -Path 'c:\Scripts\serverlistOP.txt'
try{
foreach ($server in $serverlist) {
$server
query user /server:$server
}
}
catch{
"$Server do not have users"
}

Open in new window


Error return like this:
query : No User exists for *
At line:5 char:1
+ query user /server:$server
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (No User exists for *:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
And this:
query : Error 0x000006BA enumerating sessionnames
At line:5 char:1
+ query user /server:$server
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Error 0x000006B...ng sessionnames:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
Error [1722]:The RPC server is unavailable.
the RPC error in catch, I would like to show in catch message, RPC is unavailable, and  query : No User exists for * I want to show text: No users currently login now.

How do I corret show those?

Thanks
1

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.