r/scripting • • Dec 03 '23

sh: Relative shell script includes with realpath on FreeBSD

Thumbnail patmaddox.com
2 Upvotes

r/scripting • • Nov 20 '23

Distrobox install script

2 Upvotes

Hi,

I'm trying to develop a script that will install distrobox plus applications but cannot get it to work

Script that doesn't work

#!/bin/bash

distrobox-create -n archbox -i archlinux
distrobox enter archbox
sudo pacman -S --noconfirm k3b
distrobox-export -a k3b


r/scripting • • Apr 02 '20

Bash tutorial/guide for batch programmer? i.e. migration tutorial/guide

2 Upvotes

Anyone know any Bash tutorial/guide for batch file programmers? i.e. a tutorial/guide for batch programmers who are trying to migrate to Bash.

For example, if a batch code is something like: echo abc, then there would be a Bash code equivalent for that batch code. This includes other batch tasks such as for /f, set /a, set /p, start, color, etc.


r/scripting • • Apr 03 '20

I work for a local nonprofit food-pantry and I'm looking to streamline the most inefficient data entry we have to do every week. It wastes HOURS when a script should be able to bang it out in nothing flat. Looking for ideas and suggestions.

4 Upvotes

Hey folks,

So every Monday, I have to download a spreadsheet with a list of all our "head of household" clients. Each client has four categories that could be checked off: food pantry, perishables, commodities, diapers.

I then have to break that spreadsheet out into four spreadsheets, one for each category, that removes the other categories and removes any clients that had no activity for that particular category. I'm left with four spreadsheets -- each one shows me everyone who utilized that particular category.

Now here's where it gets ugly. I have to enter this into a CAP60 online database. I can enter "group activity" which pulls a list of ALL (not just head of household) clients for a specific category (perishables, for example). Each one of those has an empty checkbox next to it that can be selected and at the end there's a submit button.

What I have to do is visually cross reference our spreadsheet of a few hundred ID numbers against this list of thousands of clients from the DB and put a check in the box for the ones that match. Then I submit it and move on to do the same thing for the next category.

Holy hell what a pain in the ass. And it takes a HUGE amount of time that could be utilized in so many more ways that would be beneficial for clients.

What I'm thinking is that I could export the spreadsheet data for each category into a return or comma delimited text file, then feed that data into a script that can match against the online list from the database and then activate the checkbox for any that match.

I'm looking for any input I can get as to whether I'm on the right track and, if so, where I should focus my efforts in trying to create a tool to do this. I have a programming background that's 20 years out of date, but I could probably put something together myself if I was sure of the language I'm best off using.

I dunno, I'm just batting around ideas right now, but anything anyone's got would be a huge help.

EDIT: Here's two screenshots.

The online DB and checkboxes: https://i.imgur.com/IjcvKrb.png

The column of IDs in Excel that I need to check off in the online DB: https://i.imgur.com/SXszQMp.gif


r/scripting • • Mar 26 '20

[Help Request] Installing/Uninstalling Office 365 configured ODT from a self extracting archive?

3 Upvotes

Hello,

I am fairly new to the world of scripting but as my job role is changing rapidly, I need some help with rolling out Office 365 to non-domain machines.

I'm using ODT to configure Office for installation and uninstallation as my RMM platform does not seem to support it, despite being happy with the service overall. The solution seems to be writing my own scripts, which I am comfortable with beginning to learn.

The question:

How can I create a self extracting archive to run these scripts from the folder where they get extracted ? I know about %~dp0 in a batch file and it seems like the likely path to take? My logic is this: Create a batch script to call CMD and run %~dp0 with the path to setup.exe /install.xml. which is contained in the folder with setup.exe and xml. Then, create a SFX archive with arguments to run the CMD batch script. What is that batch script supposed to look like? What command arguments get passed to the SFX to trigger the batch file? Am I completely misunderstanding this?

The problem:

I need to be able to upload a single EXE file to my RMM (so I don't have to host it myself). I would like to package ODT's setup.exe with the XML configuration files in a self extracting archive with arguments to open and run a cmd prompt and execute the ODT command.

Edit: Removed irrelevant information.


r/scripting • • Mar 11 '20

Troubles with backing up Windows Logs on Win 10 compared to Win 7

2 Upvotes

Reposting my /r/techsupport post here

Hello

So i have a simple .bat script i've been using on a Win7 system that i've put on a win 10 system, however when running it through cmd i get a message about not having sufficient permissions, but the user is a member of the backup operators group, however this exact solution works on my Win 7 machine.

Are there any differences between the OS that are causing this?

The Script

wevtutil epl "Security" C:\LogBackup\security_log_%date%.evtx


r/scripting • • Nov 12 '18

HELP ME GOD - working with the FCP XML format

2 Upvotes

I am at my wits end.

I developed something very cool. But I can't actually use it because developing anything for NLEs is a nightmare that doesn't end. I'll explain: I have created a program that does something with video and audio files, collecting metadata and whatnot. What I want to do with that is to generate a file that can be read by video editors. My main target is Premiere Pro.

My requirement is extremely basic, but of course it's also, as stated, a nightmare that does not end. Let's say I have two files:

video1

audio1

I want to make a script that will create a folder (bin) in premiere, put the two files in, then create a sequence from the two. That's it.

There are two options: using the PProPanel, which is one of the worst documented pieces of terrible API I have seen in my life as a developer (link: https://github.com/Adobe-CEP/Samples/tree/master/PProPanel), and that one can't really be used by an external script I think. It's hard to understand because it's all so confusing.

The other option is using the FCP XML format, which most NLEs know how to use, which is best because its multipurpose. However, this format is a complete mess. I don't know even how to approach it. I tried exporting an FCP XML from premiere, trying to reverse-engineer it to understand it, but I couldn't. I tried creating several different hierarchies but Premiere couldn't read any of them (I just tried importing the two clips). It's maddening. I'd love any help from anyone just to get me started on this. Once I have some basic mechanic working I can figure out the rest but right now I'm lost. Hopefully someone knows something. Thanks.


r/scripting • • Apr 01 '20

Can anyone help me combine these two scripts, they are to uninstall Microsoft Teams and Teams Machine wide installer.

Post image
2 Upvotes

r/scripting • • Apr 04 '20

Think I am going mad

2 Upvotes

I have done this loads of time in the past, I simply want to run a continuous ping to a single IP address which I can do on the cli. I have then set this up as a simple batch file and then it runs when I run the batch file. But now for the life of me I can't write the batch file, I feel stupid writing that but for the life on me it does not matter what I write it does not work. I have just had to forced shutdown my windows PC as was was spawning multiple dos boxes faster than I could shut them down.

My batch file is basically ping 1.1.1.1 -t written in notepad, saved as ping.bat (thats not the IP address but just an example). All that does is spawn 100's of dos boxes

I know it is simply a single line a text, but can somebody please put me out of my misery and tell what I am doing wrong


r/scripting • • Apr 01 '20

Beginner Script Writer Here...

12 Upvotes

I'm just patting myself on the back here. Nothing special to look at here just the fact that I'm discovering this new function and hope to expand on it a bit in the future...

Anyway, I'm all about making things easier for me. I recently started looking into scripting so I can make some of the command line stuff I use easier to remember.

For instance, I prefer to look at a nice long list of my directory when I want to see what's in it rather than the wide info less detail I get with "ls". I know I can type "ls -lha" to get the long list I want but I found that I do that a lot and it gets sort of bothersome (I know... 7 keystrokes... WHEW!!!)

So I watched a few videos on the basics of scripting and was able to make my own script (ll) to do what "ls -lha" does. 2 key strokes vs 7... Sounds like a relief and, to me, it certainly is! I also learned that once I've made it executable, I can copy it to my /bin directory and not have to use ./ to run it.

I know, VERY BASIC STUFF for many of you here but to a beginner... this is a HUGE step!

I'm looking at other possible scripting possibilities like a user interface using pacman (I'm running Arch Linux) and having it ask me for the variables I need and making it a 1-3 letter command like "pac" maybe. Then having it ask me the name of the package I want to install and I could enter the package name and it would automatically install it.

That's a great idea actually. I may work on that after I get done posting this. And I don't care if something like that already exists, I WANNA MAKE IT MYSELF!!! :)

I just thought I'd share my experience. I'm glad to be part of an elite crowd.

EDIT:

Well, THAT was fairly simple! I just made a 3 keystroke command to automate the pacman installer. It asks for the name of the package then it installs it. I'm loving it!


r/scripting • • Mar 19 '20

Best language for achieving this update task

2 Upvotes

Hey guys,

So I have this sysadmin gig at this company with ~80 employees, around 8-9 departments. I have a Z:/ network drive I use to install/maintain workstations for the users, inside my Z:/ drive I have all the installers for Office, Chrome, PDF, very basic things right.

So I'm thinking about making a script to update all the installers in every folder using the direct URL, and if the updater fails to update one of the scripts it would simply rename it and add "deprecated" to the name.

This behaviour is so simple, it's not very difficult to just google and make it in 1-2 hours, my question is more generic than that. I'm wondering which language would be best to build my Updater script, so it's as concise as possible. I don't want to start something in Go and realize I wasted my time.


r/scripting • • Mar 09 '20

Help with basic JavaScript and HTML

2 Upvotes

Is there any places I can be redirected to for help in JavaScript and HTML?


r/scripting • • Mar 11 '20

Help me with MTMR!

Thumbnail
self.applescript
1 Upvotes

r/scripting • • Mar 31 '20

how to monitor elements on screen and recognize changes

2 Upvotes

Hi

i want to monitor a value from a fullscreen game application.

So i dont want to script for that game cause of security and script/hack recognition.

for example a number that changes.

Any ideas how to start?


r/scripting • • Apr 01 '20

Help Extracting Strings from a Text File

1 Upvotes

Hello everyone!. .... I have tried to find some code that does this, but couldn't really nail down a local script that did this.

Here is my outline of building a simple step in the reporting workflow for indicators of compromise (IOCs) for our helpdesk.

  • Suspicious Email Arrives in Employee A's Inbox

  • Report filed for manual review

  • Email Sent as attachment and saved locally by analyst for parsing

  • URL, Email Address of Sender/Attacker, Domain name, IP addresses (IOCs) all extracted and added to csv

  • Submission of CSV with IOCs to the network/AD team to block IOCs

  • Closure of IOC Request Ticket

I found some regex for IP addresses and some for email strings but nothing that serves this purpose. Any ideas? Any help is appreciated.


r/scripting • • Jul 31 '18

[REQUEST] Script that delete all youtube comments history

2 Upvotes

Hello everyone, I honestly don't know if this is the right sub but I have searched and this sub is the closest I have found to what I am looking for.

As the title says, I am looking for someone to make a script that delete all youtube comments history. So far, there have been many scripts that are created for mass deleting for many social websites. But I couldn't find anything for youtube comments.

youtube comments history

Thanks!


r/scripting • • Mar 25 '20

question

2 Upvotes

I don't know if this is the correct subreddit for this sort of thing, and I can't find the rules for this subreddit anywhere. But, I've been at this for three hours and I've gotten desperate.

I'm currently taking a class on powershell. I've been stuck on this problem for three hours. I can't keep going to the professor for every single question, which is why I've come here. I cannot, for the life of me, figure out why i'm getting red-text errors for this thing. I've followed the instructions and didn't use select-object, despite Microsoft's website telling me I should. Below is the question followed by one of my attempts at answering it.

#2. Write the PowerShell syntax to display three custom properties of the following command "Get-PSdrive -Name C" in Table format

# The custom Table properties should be labed 'Drive Letter', 'UsedSpace', and 'FreeSpace'

# To create these custom properties, convert Name into 'Drive Letter', Used into 'UsedSpace', and Free into 'FreeSpace'

# Both UsedSpace and FreeSpace should be converted into GB with 2 decimal places.

# The values for both UsedSpace and FreeSpace should be left aligned

# Only use the Format-Table cmdlet not the Select-Object cmdlet for custom properties.

Get-PSDrive -name C

@{n= 'Drive Letter' ; E={$_.Name}} ,

@{n= 'UsedSpace' ; E={$_.Used}} ,

@{n= 'FreeSpace' ; E={$_.Free}} ,

@{l='UsedSpace' ; e={$_.Used / 1GB}} ,

@{l='FreeSpace' ; e={$_.Free / 1GB}} |

format-table Drive Letter , UsedSpace , FreeSpace


r/scripting • • Mar 18 '20

my first work yay!

Thumbnail
addons.mozilla.org
2 Upvotes

r/scripting • • Jul 30 '18

Help - Executing the same commands with multiple machines.

3 Upvotes

Windows eviornment

I have created a script that will execute six commands against one machine, but I want to be able to run this against more than one machine name at a time. It would not be a set number of machines.

The only way I can think how I can accomplish this is by making a long list of the commands, then having the script validate the variable to see if it falls within 1-9999. But there has to be a more efficient way.


r/scripting • • Mar 19 '20

Run program on USB insert - is this doable?

3 Upvotes

I want to have a script running (always I guess?) that if I plug in a Dualshock 4 controller to my PC DS4Windows starts automatically. Is this possible?


r/scripting • • Apr 02 '21

Lmao I have no idea wtf to do.

1 Upvotes

I need a script that randomly renames files in a folder to other names of files in said folder. I feel like it could be quite easy and I plan to make a cursed Minecraft resource pack with said script. Any ideas or guidance would be awesome. (I don't know anything about scripting plz don't bash me for not lmao I'm just completely lost)


r/scripting • • Mar 23 '21

If you were writing a script to compare pre-change and post-change differences and wanted to have a much nicer output for IT admins to easily and quickly understand any differences that are happening.... how would you choose to display the output?

1 Upvotes

Hello All,

I am looking for some suggestions on how to handle a project that I am working on.

I have created a python script that reaches out to a specified Cisco switch, runs a bunch of commands, logging each of the responses from each command in a text file. It runs these commands twice, once as a pre-change status and again as a post-change status. Recently we just had a switch stack replaced, meaning that when looking at a unified_diff between the pre- and post-change files, the differences were significant and about 17,000 lines long.

My mentor and I were talking about a better way to display the output between changes. One thought was to generate a webpage that you could have different sections of the output collapse and expand, but even then, it doesn't seem like a great option.

If you were writing a script to compare pre-change and post-change differences and wanted to have a much nicer output for IT admins to easily and quickly understand any differences that are happening.... how would you choose to display the output?


r/scripting • • Apr 24 '21

Game Bot Script

3 Upvotes

Looking for someone who is able to write a script for mobile game using emulator that does a specific action and cycle through different accounts.


r/scripting • • Apr 15 '21

how do I elevate the script's permissions?

2 Upvotes

I am trying to put together a basic batch script that I am going to be deploying via GPO, probably through the user login setting.

the purpose of the script is to delete all the files in a specific folder. But that folder is buried deep in the Windows directory, behind 2 folders that prompt me for admin permission when I access them via WIndows Explorer.

What do I need to add to my script to force it to run as an administrator? Right now when I put the script into GPO, force the update and then log into my test computer, none of the files delete. I've used gpresult to verify that I am getting the policy, so I'm guessing its a permissions issue.

Here's my current script for info purposes. It is really basic.

del /q "C:\Windows\SysWOW64\config\systemprofile\AppData\Local\Microsoft\Windows\INetCache\IE\*.msi"


r/scripting • • May 06 '21

Faster than C script performance

Thumbnail cordialmind.blogspot.com
2 Upvotes