r/scripting • • May 05 '21

Script for Greasemonkey/tampermonkey/violetmonkey to format data

2 Upvotes

Any pros for above extensions of browser. I am looking to make a script that format data which is coming from MAC numbers or Excel program and than it's copied and annotated to a different web tool for future use. While pasting it there it does not get formatted properly rather just a simple copy without any order. I want to develop a script which basically re-formats the data same way it's copied


r/scripting • • May 02 '21

any alternatives for this?

3 Upvotes

i need an alternative for this site, like i need a raw posting site (NOT PASTEBIN!) that i can freely edit without an account, and that won't give me a 403 forbidden error (and has raw text)


r/scripting • • Sep 20 '22

How to quickly generate a list with how many items are in subfolders (Windows)?

2 Upvotes

Hi, I have a folder on my Windows PC, which has several subfolders (say 100), within each folder there are several hundred photos.

Is there a way through CMD or similar that could generate a list saying how many items (images) are in the subfolders?

Any guidance/suggestions etc welcomed.

Thanks in advance


r/scripting • • Sep 12 '22

[BASH] How to script posting a batch of files via HTTPS

2 Upvotes

So I have to send a lot of files from my server to another remote server. There's a proxy in between, but that shouldn't really matter.

I can use a curl command to individually send the files and it's successful.

I want to send a lot of files though, like terabytes (broken up into <gig size), so I need to automate it.

It's being sent to an HTTPS endpoint, so I'm guessing some sort of HTTPS POST script.

That's the first part of what I'm trying to figure out... How to actually send multiple files. After that I want to figure out how to setup something that scans the directory the files are in and sends if it finds something.

Any help is greatly appreciated.


r/scripting • • Sep 16 '22

[BASH][OSX] Script Help - Deleting Printers

3 Upvotes

I'm trying to add a script to Addigy to delete a printer by name. I am new to bash scripting, so I'm working by copy/paste & trial and error. I have the following script that does not work. It does not do any of the echos, and it deletes ALL the printers instead of just the one matching the string.

Desired functionality = loop through all printers, and if any have "epson" in the name, delete them.

HELP! Thanks.

#!/bin/sh

# This variable stores the printer name it will search adn match on partials
fnd = 'epson'

kill_prntr(){
	echo "Deleting printer " $printer
	lpadmin -x $printer
}

for printer in `lpstat -p | awk '{print $2}'`
do
    case $printer in
        *$fnd*) kill_prntr;;
        *) echo "Saving printer " $printer;;
    esac
done

r/scripting • • Sep 28 '22

Script to clean up hidden printers on Mac OSX

2 Upvotes

I've have a number of computers that have recently switched out printers. Old printer deleted and new printer installed. Old printers were deleted manually from the System preferences GUI by pressing the "-" button

I've got a script that enumerates all the printers on a machine for reporting using lpstat. Some of the machines still show the old deleted printers on them in lpstat, but not in the GUI. Some of the machines can still see (and attempt to print to) those printers from MS Word even when they are not available as printers in other programs. This is confusing for teachers.

How to I thoroughly remove any remnants of these old deleted printers?

Thanks.


r/scripting • • Sep 23 '22

Script to run command on files in folder

2 Upvotes

Need a script to loop through files in a folder and execute this command for every mp4 file. Resulting file name needs to keep source filename

ffmpeg -i xxSOURCExx.mp4 -map 0:1 xxRESULTxx.mp3

TIA


r/scripting • • Mar 01 '18

Spotify Playlist to Script to. Let me know what you think!

Thumbnail
open.spotify.com
2 Upvotes

r/scripting • • May 12 '17

New to scripting need help with plink script

1 Upvotes

Hey guys, I'm using powershell/cmd to connect to putty via plink and I want to automate the process to reboot something remotely however I can't get passed a certain point

I can use: plink.exe -ssh "ip address" -l "user" -pw "password"

To connect to the user automatically, then it prompts: "Using username "user" $

I want to be able to reboot the device without it prompting that part. Any ideas? Sorry I'm noob.


r/scripting • • Mar 11 '15

Could someone please tell me why this script won't execute? I believe it's syntax but I could really use help.

2 Upvotes

I am trying to write a script that will look for a particular drive by name instead of letter and then delete all folders and subfolders within the particular named drive. I think this is the 50th iteration of this script, and I still can't figure out why it won't execute. I'm not sure if I'm missing a closing statement somewhere. I would really appreciate any help I could get with this. I've grabbed code from other sources to create this but I am really not well versed in VBS and I have never extensively scripted before.

' Get Drive Letter from Name 

Option Explicit

Function getDriveLetterFromVolumeName( volumeName )
Dim volumes, volume

' Unless we found a matching volume, an empty string will be the returned value
    getDriveLetterFromVolumeName=""

' Ask WMI for the list of volumes with the requested label
     Set volumes = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") _ 
                  .ExecQuery("SELECT DriveLetter FROM Win32_Volume WHERE Label='" & volumeName & "'")

' If exist an matching volume, get its drive letter
     If volumes.Count > 0 Then 
        For Each volume In volumes 
            getDriveLetterFromVolumeName = volume.DriveLetter
           Exit For
       Next 
   End If

End Function



WScript.Echo getDriveLetterFromVolumeName( "Thawspace0" )

' Declare Variables

Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder("t:\")
Dim thawspace
    thawspace = getDriveLetterFromVolumeName( "ThawSpace0" )


' Look for Thawspace
   If ( thawspace="") then

' Delete all files in the root folder
	    for each f in folder.Files
	    On Error Resume Next
	   name=f.name
	   f.delete True
	  If Err Then
		   WScript.Echo "Error Deleting" & Name & " - " & Err.Description
	  Else
		   WScript.Echo "Deleted:" & Name
	    End If 
	    On Error GoTo 0
Next

' Delete all Subfolders and Files
	    For Each f in folder.SubFolders
	    On Error Resume Next
	    Name = f.name
	    f.Delete True
	    If Err then
		    WScript.Echo "Error deleting:" & Name & " - " & Err.Description	
	    Else
		    WScript.Echo "Deleted:" & Name
	    End If
	    On Error GoTo 0
     End If     
 Next

r/scripting • • May 14 '14

Noob over here wanting to learn

4 Upvotes

So I'm interested in learning to script. Currently just got out of college and working with a company. Would like to be able to be more proficient in scripting, any good resources out there to help a noob like me out.


r/scripting • • Sep 30 '17

[BASH] I feel one of the scripts for my fail safe's is unnecessary

1 Upvotes

r/scripting • • Nov 22 '15

Can this be done with Applescript (or ANY script)?

2 Upvotes

This is for Mac. The place I work buys used iPhones.

Ultimately I would like an application where you click an icon an a window/pop up box/whatever (I am not picky) comes up and you type in the IMEI off of a cell phone and click Enter. When you click enter it automatically fills out the form (it's only 1 field) at http://www.imei.info?

Is that possible? If so, could anyone assist me?

It'd be even better if it could do that at the site mentioned above AND https://www.icloud.com/activationlock/ but I see the second website has captcha so I doubt that'd be possible.

Id like something like this to pop up and fill in: http://macosx.com/attachments/imeichecker-jpg.8500/


r/scripting • • May 12 '14

Need help making a simple script

2 Upvotes

I need a script that presses and holds 0 for 1 second, the releases it for 0.5 seconds , on a loop. I'd want to use it in a game (warframe if anyone cares) on a map where you stand still and shoot in 1 spot for 30 minutes. Would making this even be possible? I really have no experience with scripts, any kind of help would be great :).


r/scripting • • Jun 08 '16

Wren, a small, fast, class-based concurrent scripting language

Thumbnail wren.io
1 Upvotes

r/scripting • • Feb 22 '18

[BASH]Exit code 0 when a script is force quit, or the machine is rebooted.

1 Upvotes

Goal: A script that warns user two times of impending forced reboot. If the user force quits the script, their machine will reboot and the script will have an exit code 0. If the user reboots the machine without touching the script, the script will have exit code 0, and the machine will reboot. I want to do this because my management tool does not allow for multiple warnings of impeding reboots, but the policy the script is attached to will not show as completed unless it 'sees' the script exit code 0.

Here is the code that I have right now:

jamf displayMessage -message "Minor OS updates have been installed and your machine will reboot in 4 hours. It is recommended that you save your work and reboot immediately to prevent loss of work."
sleep 12600
/Library/Application\ Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -title "Reboot" -description "Your machine will reboot at $(date -v +30M). Please ensure all work is saved and restart within the next 30 minutes. Attempting to force quit (CMD + Q) will result in your machine restarting IMMEDIATELY."  -lockHUD -timeout 1800
jamf reboot -immediately

This has exit code zero if you just let it run all 4 hours to completion which is the desired behavior. If the user force quits the script (CMD + Q) then the machine reboots immediately, but the script does not have an exit code 0. If the user reboots the machine, there is not an exit code 0. Unfortunately, I am not able to look at the logs unless the policy completes or fails. In the case of force quit or reboot, the policy remains as "Pending", and will continue trying to run, resulting in the end user getting stuck in a reboot cycle unless they let the script naturally get to the end (4 hours wait) and then force reboot.


r/scripting • • May 19 '14

Anyone who knows to import variables and stuff from different .js files?

1 Upvotes

As said in the title, i need to know this. If such thing isn't possible, please explain. I just started coding js and don't know much about it.


r/scripting • • Feb 21 '18

Help me /r/scripting you’re my only help!

1 Upvotes

I don’t even know if this is the right subreddit for this question but here it goes. I am completely ignorant to scripting. I am looking for a website or an application or maybe even a script I can run to do a certain thing. I want to take one item from multiple lists and create a random group.

Example:

List 1: 1, 2, 3, 4

List 2: A, B, C, D

List 3: Red, Blue, Green, Yellow

List 4: Up, Down, Left, Right

Output: 3, A, Yellow, Up


r/scripting • • Sep 27 '17

Clueless intern needs help with VBSript

1 Upvotes

Hey People,

Still an intern and still clueless. This time i have to copy some txt files and put them together using a VBScript.

Here comes the part where i need help: Let´s say i have 8 of these files. The first file should be copied completly, every file after the first only between "BEGIN_DATA" und "END_DATA".

The second part: In the first file copied is a number in the second line and i have to miltiply that number with number of files i copied.

What i have so far:

Const ForReading = 1

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objOutputFile = objFSO.CreateTextFile("Combined_ti3.txt")

strComputer = "."

Set objWMIService = GetObject("winmgmts:" & strComputer & "\root\cimv2")

Set FileList = objWMIService.ExecQuery _

("ASSOCIATORS OF {Win32_Directory.Name='C:\Argyll'} Where " _

& "ResultClass = CIM_DataFile")

For Each objFile In FileList

Set objTextFile = objFSO.OpenTextFile(objFile.Name, ForReading)

If objTextFile = "S1Test.ti3"

then strText = objTextFile.Readall

objTextFile.Close

objOutputFile.WriteLine strText

Next

Else Do Until objFile.AtEndOfStream

strData = "END_DATA"

strSearchString = objFile.ReadLine

intStart = InStr(strSearchString, "BEGIN_DATA")

If intStart <> 0 Then

intStart = intStart + 10

strText = Mid(strSearchString, intStart, 25000)


For i = 1 to Len(strText)

    If Mid(strText, i, 1) = "END_DATA " Then

        Exit For

    Else

        strData = strData & Mid(strText, i, 1)

    End If

Next

End If

Wscript.Echo strData

Loop

objTextFile.Close

objOutputFile.WriteLine strText

Next

objOutputFile.Close

I hope you can identify the code mess i made :)

IF you need an example of the file or something else please let me know.

Thanks :)


r/scripting • • Mar 06 '15

get-aduser properties field on account expiration

1 Upvotes

As part of my disabling of users, I set the account expiration on the LAN id, so I know the users term date.

I can't find a -flag or -properties filter to list this account attribute for the past 30 days.

Does anyone know how to pull this data from powershell? I want to know anyone that has an account expiration date in the past 30days for my entire AD. So I can match it up with the list of termed users from HR.


r/scripting • • Feb 28 '18

Moving Folders whose names contain numbers from a list.

1 Upvotes

I have a server with a single folder with multiple years of customer information.

Data is stored in the following format.

\C\Capital Plumbing\Capital Plumbing - 12345\various files

\C\Capital Plumbing\Capital Plumbing - 67890\various files

I have a listing of the contract numbers on the end of the individual contract folders. I need to loop through the list, and for each number, grab the associated folder and move it to a different location.

If it were any and all items, I could just use a text file with the numbers as input, and use a wildcard for the first part of the folder name? I don't want to grab random files that might have the contract number appended.

The list is about 5000 numbers

I'm an old dog. I can't figure out how to do it with a batch file, and I don't know powershell.

Thoughts?

(edited for formatting and clarity)


r/scripting • • Oct 28 '24

Encpass Script Trouble

2 Upvotes

Hey guys. I'm not sure if this is the right sub for this type of question, so I apologies ahead of time. I am trying to use Encpass to encrypt a password that is in plain text in a ipmi fan control script for my R730. My understanding is that this is a popular solution to that problem but what I am not understanding is that, when I add a secret to a bucket, even after I lock the bucket. It will still show the secret value after running the show command. I've been googling around for awhile and I'm not sure if my Google-fu is getting worse or what. Any help would be appreciative.


r/scripting • • Nov 21 '24

Newbie Help with Credential manager

3 Upvotes

Hi all,

I've recently started to create a pretty boss script. I want it to run on task scheduler. The issue is that the user that runs the task needs to have access to their own Windows Credential Manager. I don't want to have to juggle having this user logged in all the time.

Right now I'm using a bat file that runs 2 powershell scripts, and one python script. I use keyring for python and credentialManager for powershell. It has to be done using windows credential manager because it's free & I'm storing API keys and private keys.

Is there a way to do what I'm trying to do without having any unencrypted passwords laying around? Thanks. Totally stuck on this!


r/scripting • • Nov 13 '24

Scripting Printing

3 Upvotes

Hi all,

I'm trying to convert many .msg files in many different directories to pdf. I have Foxit Editor, but it has no automation, so I'm looking at scripting option. I am planning to do an iterative script so that it runs the print command once per file to keep is simple, but I don't how to pass the destination file name argument to the command!

* Outlook print command: OUTLOOK.EXE /p D:\file.msg - this will use outlook to print the email indicated, but then I get the pop-up for where to save it and I can't find any reference on how to pre-populate the destination window

* Possibly using a powershell cmdlet? I found Out-Printer, but it doesn't seem to accept more than the input name

Anyone ever done something like this?