/r/AskScriptSwap
/r/AskScriptSwap - A place to get help and find beta testers for your scripts!
WELCOME TO ASK SCRIPT SWAP!
This subreddit is for getting help with scripts you've written. Write a neat scripts that should work but doesn't and can't figure out why? Need a few people to beta test your script? Post it here!
RULES:
If you just want to share your script, and do not need help or beta testers, please submit it in /r/ScriptSwap.
NO GAME SCRIPTS PLEASE - There are already enough subreddits for this.
Write what the script does in the title and give a description of what each function of the script does. (if you commented out the script, that's cool too). Please include the source code in your post, unless it's very large. Feel free to link to it (on github, gist, etc) as well. Don't forget to state what license you are releasing your script under (ie: GPL). If you don't specify a license, /r/ScriptSwap will assume ownership and release it under a GPL license for everyone. This is to prevent IP violations, and other related issues.
Let's try to keep the headings clean too. ie: * [Language] My script bla bla bla * [Testing/Language] My script bla bla bla * [Problem/Language] My script bla bla bla
NO MALICIOUS CODE! Security/auditing/hacking scripts are OK.
Let's keep it friendly around here. This is for sharing your scripts with others. Keep the negativity to a minimum. Feel free to post optimizations but please do not do so in a condescending manner. We're all here to learn.
If you find a neat script, but didn't write it, feel free to post, but you MUST CREDIT THE AUTHOR. This must also not violate the author's license/terms of use. You will have your post deleted if you do not credit the author, or violate the author's terms.
SCRUB YOUR SCRIPTS. Sometimes people work insecurely and have plaintext passwords, proprietary information, etc in their scripts.
Please take a moment to learn how reddit's formatting works when you make your post. This will make your post a LOT more readable. NOTE: Lines starting with four spaces are treated like code.
Enjoy /r/AskScriptSwap!
Related Subreddits:
/r/AskScriptSwap
Is it even possible anymore
I want to scape user files from my old Time machine drives. I did an ls in terminal and got the subdir names (will be input file). Here’s my mental pseudocode:
Read in one subdir from input file Do some mkdirs, cd, cp, Grab files from desktop, docs, pictures, etc Loop to top and do it again with next
I’m an OLD programmer from like compiler daze. Can’t believe I can’t do a simple loop. Doesn’t even matter what I do it in - windows would work. I just need the output to be a list of repeating commands for each dated time machine backup. I am not going to drill down manually over and over to copy my own files!
I can do the terminal commands individually. And I can drag fill in excel, clean up in txt edit, then copy paste into Terminal — but there’s a better way! I’ve got to do lots of these from multiple old drives to rebuild a lifetime.
Register with us and get a coveted spot in the new technology wave!!!
Apply link: https://www.introtuce.co/earlyadopters
ISSUE: The enterprise network I work on has a baseline Image that is put on all machines before going out to there respective workplaces. The image only requires 1 processor to run thus it only activates 1 ; even though most machines will have 2 or more.
GET TO THE POINT : I would like to create a script that will unlock the Max # of processors on a list of computers.
Any help to get this started?
Does anyone have a tool or script they currently use that can help visualise a website's taxonomy? I know of tools like Writemaps, Trello and SmartArt where you can visualise taxonomy by manually inputting it.
Is there a tool people know of that can automate this?
i.e. have the ability to import a CSV to automatically fill out a pyramid structure? Or is there a script that people know of that can pull the website taxonomy/site crawl through into SmartArt?
Any help or feedback would be greatly appreciated!
Hello all!
I have a program that I'd like to be able to copy a config file into a directory. The problem I have is that the directory path contains 2 sub-directories that are randomly generated folder names. But, they are also the only folders in the sub-directory. So I don't have to differentiate anything, just collect the folder name.
For example: %LocalAppData%\Apps\2.0\Data\XMO8ETK0.O9K\JWZ6JYYD.KQN\mpi...tion_0000000000000000_0001.0001_8d609383cf728c7c\Data\1.1.5.2
Where "XMO8ETK0.O9K" and "JWZ6JYYD.KQN" are the random folder names, in that format every time (8 Characters DOT 3 Charaters). They are different across every machine. The remaining folders are constant.
My Google Fu has failed me, as I've tried searching for this solution. I know I'm just not coming up with the right question.
How can I find these folder names and script copying my config file?
Thanks in advance!
EDIT: I'm not limited to a batch script. I would be OK with Powershell as well.
EDIT2: I found this and I've tried to manipulate it to find both folders, with no luck. Source: https://stackoverflow.com/questions/45622500/batch-file-copying-files-to-an-unknown-folder-name
@ECHO OFF SETLOCAL SET "sourcedir=%LocalAppData%\Apps\2.0\Data"
FOR /d %%a IN ("%sourcedir%????????.*") DO ( FOR /f "delims=." %%b IN ("%%~nxa") DO ( SET /a num=1%%b 2>nul IF NOT ERRORLEVEL 1 ECHO %%b %%a ) )
GOTO :EOF
I'm out of my skill set with this one.
Is there a script that keeps watching adds on twitch to get bits?
Hey I am searching for a script or program that can swamp the X and Y axis of the mouse. So instead of left movement moving the mouse cursor to the left I want the cursor to move up. I am using Windows OS.
illustration of what I mean:
A tablet that I would like to use in portrait orientation:
How it works now, movement to the left moves the cursor to the left.
How I want to orientate the tablet but as you can see it will be difficult to navigate this way unless...
X and Y axis swapped so that the tablet can easily be navigated in portrait orientation.
My recursive algorithm is not working, can anyone help me out?
Here's my question: http://unix.stackexchange.com/questions/320215/how-to-properly-create-a-recursive-algorithm-that-produces-a-tree
Hi all -- I have a PS script I created that allows you to DL albums from BandCamp. I use it myself, and have no problem sharing with friends. But I don't know what the subreddit rules say about that. Bandcamp has a statement here: https://bandcamp.com/help/audio_basics#steal saying, "One of my fans showed me a totally easy way that someone could STEAL my music off of Bandcamp using RealPlayer 14.1 beta 3, or RipTheWeb.com, or by going into Temporary Internet Files and renaming blah blah blah. What are you doing about this grave problem?
Nothing. Since streams on Bandcamp are full-length, it’s true that someone could use one of the above methods to access the underlying MP3-128. And sure, we could throw some technical hurdles in their way, but if they hit one of those hurdles, it’s not like they’d slap their forehead and open their wallet. Instead, they’d just move on to some other site where those restrictions aren’t in place, and you’ll have squandered the chance to make your own site the premier destination for those seemingly cheap, but enthusiastic, word-spreading, and potentially later money-spending fans."
So I wasn't sure if I should share it or not. Thanks!
I am writing a script for FIFA Ultimate Team in which I search players that cost 300 coins and then sell them for 350-400 coins. I am using Mini Mouse Recorder to click on a player, and check to see if he is 300 coins. If he is 300 coins then place a bid, else go to the next player. The only problem is I am not able to use a conditional to check if he is 300 coins. For example I can highlight the number 300 and that's about it. There is no way to check to see if highlighted number == 300. I was also thinking something along the lines of highlight the number 300, copy and paste, if clipboard value == 300 then bid. I am not sure how to do this using Mini Mouse Recorder. Is there any other easy software to do this or am I going about this process completely wrong?
I have a script that was created by an employee that no longer works for the company and has been edited many times before landing in my lap to handle. I do not script for a living and the parts I have done have been helped form multiple tech boards. Because of the nature of this script I have to strip a lot of the identifiable data out so my company and it's customers can stay anonymous.
The issue is the script seems to run fine, but the files UserAutoLogon and NTP (which is on another .bat that is ran first for computer naming and basic program installation) doesn't seem to ever run. The VBS script doesn't seem to pull the users out of it as well, but if I name the files %authority%-UserLogOn and so on they run fine. Is there a limit on how deep in a folder structure a file can be?
ECHO Please set Authority(Authority1, Authority2, Authority3, etc):
set /p authority= Authority name:
ECHO Turning off Firewall
netsh firewall set opmode disable
ECHO Joining Domain
cscript.exe "C:\Documents and Settings\Administrator\Desktop\MainBlade\%authority%\joindomain.vbs"
ECHO Giving some extra time for domain join to complete! Going to ping the default gateway for a 10 second break.
@For /f "tokens=3" %%* in (
'route.exe print ^|findstr "\<0.0.0.0\>"'
) Do @Set "DefaultGateway=%%*"
ping %DefaultGateway% -n 10
regedit.exe /s "C:\Documents and Settings\Administrator\Desktop\MainBlade\%authority%\MainUserAutoLogon.reg"
del /q "C:\Documents and Settings\Administrator\Desktop\*.bat"
del /q "C:\Documents and Settings\Administrator\Desktop\*.reg"
copy "C:\Documents and Settings\Administrator\Desktop\MainBlade\Cleanup.bat" "C:\Documents and Settings\All Users\Desktop\Cleanup.bat"
copy "C:\Documents and Settings\Administrator\Desktop\Main Tools" "C:\Documents and Settings\All Users\Desktop\Main Tools"
rmdir /s /q "C:\Documents and Settings\All Users\Desktop\MainBlade"
Echo Script complete.... Press any key to reboot... Verify Domain Connectivity, You are now ready to push settings from Server.
shutdown -r -t 00
Hi all, I need help converting a script I already have. I have little to no experience with vbscripting (I'm more of a batch/powershell guy) and I was wondering if you could help me out.
Currently the script looks at the username, sees what groups the user is a member of, and then installs printers from there. What I'd like the script to do is look at the computer name and the group that it's a member of.
Line 24 references objADSystemInfo.UserName which is an Active Directory attribute. So I went digging through my computer group and couldn't find an attribute that was appropriate for using on this line. Maybe I'm going about this wrong.
I did use the CN attribute, but that returned several errors.
Can you help me out?
Hi, I currently have a script that resets the profile folder permissions to the username specified in the foldername (for windows). Works great however it falls over when i have a folder "eg.g testuser.intdomain". Is is possible to not pass the .domain in %%A?
@echo off
SET D= H:\Students\Documents\2014
FOR /F %%A IN ('DIR %D% /AD /B') DO icacls %D%%%A /grant DOMAIN%%A:(OI)(CI)m /c
OKAY SO, at work I'm doing mail server moves (from MODUS to PLESK) AS IT STANDS, I'm doing the OH SO FUN AND (omg I want to kill myself) way of IMAPing the accounts and copying the mail over.
Certain accounts have up to 50 emails per domain, this is always fun right?
I want to find a way, to learn and write a script.... one that helps me do this without the pain of imaping over and over.
Can anyone point me in the right direction? I'm a sponge and I am willing to go the distance to help myself and (the people I like) in my tier.
If anyone can offer any thoughts it's appreciated.
I am looking to learn a language but I don't know which one would be the best fit and investment of my time to lean in depth . It will need to work on mac and windows without impacting performance on the user and being lightweight and sucre is ideal. I would like to have the ability to:
I have use many different language for one time runs scripts that where push with AD GPO over local LAN but I don't have that option here. So it will need to run on it's own and can tie in with the OS. All the client system are remote so I will be starting on writing the remote control script and push and config. and Yes I have a test lab to work in first. TLDR:What would be the best Language for command and control mac and windows in a secure way on it's own?
Ok, so the story is I have to bring a client from their Lotus Notes installs from 2009 & 2010 to the latest version en masse. I have the install itself scripted but have to backup files. Some computers have the config files in "%programfiles%\IBM\Lotus\Notes\Data" (OR if it's x64 it's the (x86) program files and some have it in "%appdata%\Lotus\Notes\Data".
I have the copying taken care of, but want help checking which directory it's in, especially because after I have to copy the files back.
Not sure if BAT files are even versatile enough for checking if those directories exist and, if so, setting the rest of the script to use them.
So Far.. Any help much appreciated.
Hi, I'm new to bash scripting and am trying to do the following:
Create 25 files with template content
Modify part of the content in the file to change a common value
Modify each file to change one value in each file with another value from a list
I've been able to get #1 and #2 done. #3 is failing.
I've tried scouring the internet, but am unable to find out how to do #3. My script is pasted below:
#!/bin/bash
set change='cat change.list'
#Creating 5 files with template content
for I in {1..5}
do
touch $I
cat randomContent > $I
done
#Some of the common content in the template is changed
grep -rl '120456' ./ | xargs sed -i 's;120456;test;g'
#Some of the content in the template is file specific
#Here $change is a list of file specific content
#Trying to find replace the common content with file specfic content
echo $change
for x in $change
do
echo $x
grep -rl 'testing' ./ | xargs sed -i 's;testing;$x;g'
done
Could someone help me with this? Thanks!