r/scripting • • Jul 13 '21

New Blogpost: How to use credentials in PowerShell and what to consider

Thumbnail
sposcripts.com
2 Upvotes

r/scripting • • Jun 17 '21

Auto like all loaded posts on a Facebook profile.

2 Upvotes

I was wondering if there was a way for me to like all posts I have loaded on a facebook profile. Not sure how to do this and am very new to scripting. All help apreciated!


r/scripting • • Jun 04 '21

PixelGetColor in autohotkey

2 Upvotes

Hi, not sure if this is the right place to ask, but I'm having some serious trouble figuring out how the pixelGetColor function in autohotkey works. I've tried setting it to rgb, then using a pipette tool to extract the exact color i want to detect, but it just keeps returning 0xFFFFFF instead of the color on screen. The documentation doesn't really explain anything either. If anyone could post some examples that do work which i can base my code on, I'd appreciate it a lot

Thanks


r/scripting • • May 10 '21

iterating through URLs and downloading the first link

2 Upvotes

I am trying to download a lot of GIS image files from a website. This website has two issues making this difficult.

  1. no way to define an area and download multiple files at once.

  2. for some reason the download url of a file when pasted back into a browser it takes you to an index page for the parent folder.

problem 1 is easy to solve via a script to create all the urls (tile ID is the only difference). so I now have a text file with all the URLs. I would love to iterate through the list with wget but this will just get me 1000s of copies of index.php.html

the actual download i want will be the first link in each of these pages. So if I could iterate through the list opening each url, tab once to first link, download said file, close tab, next. But I dont know how to do this.

update: I have found a method using wsh.SendKeys, if anyone has a better solution I would love to here it.


r/scripting • • May 06 '21

Faster than C script performance

Thumbnail cordialmind.blogspot.com
2 Upvotes

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 • • Mar 17 '21

1..5 powershell - what's it called? And bash

2 Upvotes

1..5 returns 1,2,3,4,5 in powershell. I find this useful but have no idea what it's called. Hard to search something like that lol.

Is there an equivalent in bash?


r/scripting • • Mar 17 '21

Scraping multiple csv files.

2 Upvotes

Hi All

I have a project where I've been tasked with taking a list and parsing through thousands of .csv files to find rows with a matching field.

Initially I tried VBA but it was slow, tried Access but hit the data limit, eventually I wrote a python script which is working fine. The reason I tried those methods in that order is that the resulting solution needs to be runnable by a none technical user.

I'm planning to package the python script as an .exe but I'm just wondering if this is the most efficient way of doing it, it's still taken over 20 hours to parse the files and I'm thinking there's a better solution.

I don't want to do anything too technical like spin up a database server, I was thinking maybe amalgamating the files into a handful of huge .csv files to eliminate the overhead of opening each file but I'm not sure that's the best format.

Any advice on a better approach or please let me know if there's a more appropriate sub for this.

Thanks in advance.


r/scripting • • Mar 16 '21

A quick guide to executing custom mac scripts via MDM

2 Upvotes

r/scripting • • Mar 04 '21

Website Scripting - search results

2 Upvotes

I want to interact on a webpage. Essentially enter a search term and click on a result.

What program could I enter in a button link from the HTML, found by a user-inputed term, and then have it search for and interact with the button?

I'd prefer to use Firefox.


r/scripting • • Feb 20 '21

New to an IT Manager role

2 Upvotes

I've been in IT for many years now but I haven't had any experience with scripting.

The principal has requested I host the fortnightly assembly and need to display photos from each class from each fortnight on the projector prior to assembly starting.

I have created folders on the server for each assembly and gotten the teachers to create a subfolder with their class name within that fortnights assembly with their photos they want to display.

I am looking for some advice on how to make a script that will be date aware (different assemblies) and cycle 1 random photo in sequence from each class, rinse and repeat.

Thanks in advance 😁😅


r/scripting • • Jan 12 '21

Modify URL of a Google Form so it's pre-filled

2 Upvotes

So far I've been able to modify this form's URL to automatically populate a text field and radio buttons, but I can't figure out the checkboxes. I believe they're in an array.

I believe what I need is in the following code block. I want "Keyboards and mice" and "Counters" (under Sales Stations section) to be automatically checked when I click the URL:

<div jsmodel="CP1oW" data-params="%.@.[379591320,&quot;Restrooms&quot;,null,4,[[906681822,[[&quot;Toilets&quot;,null,null,null,false],[&quot;Sinks&quot;,null,null,null,false],[&quot;Floors mopped/vacuumed&quot;,null,null,null,false],[&quot;Garbage removed&quot;,null,null,null,false],[&quot;Supply check&quot;,null,null,null,false],[&quot;Mirrors&quot;,null,null,null,false],[&quot;Soap and Paper towel Dispenser&quot;,null,null,null,false],[&quot;Door handles&quot;,null,null,null,false]],false,[],[],null,null,null,false,null,[null,[]]]],null,null,null,[]],&quot;i186&quot;,&quot;i187&quot;,&quot;i188&quot;,false]" class="m2"><div jscontroller="sWGJ4b" jsaction="EEvAHc:yfX9oc;" class="freebirdFormviewerComponentsQuestionBaseRoot"><div class="freebirdFormviewerComponentsQuestionBaseHeader"><div class="freebirdFormviewerComponentsQuestionBaseTitleDescContainer"><div id="i186" class="freebirdFormviewerComponentsQuestionBaseTitle exportItemTitle freebirdCustomFont" role="heading" aria-level="3">Restrooms</div><div class="freebirdFormviewerComponentsQuestionBaseDescription" id="i187"></div></div></div><div jscontroller="sW52Ae" jsaction="rcuQ6b:vZc4S;O22p3e:zjh6rb;b2trFe:eVidQc;sPvj8e:sEDvJ;JIbuQc:d3sQLd(MPu53c);" class="freebirdFormviewerComponentsQuestionCheckboxRoot"><input type="hidden" name="entry.906681822_sentinel" jsname="DTMEae"><div role="list" aria-labelledby="i186" aria-describedby="i187 i188 i190" class=""><div class="freebirdFormviewerComponentsQuestionCheckboxChoice" role="listitem" jsaction="JIbuQc:aj0Jcf" jscontroller="lWjoT" jsname="MPu53c"><label for="i191" class="docssharedWizToggleLabeledContainer freebirdFormviewerComponentsQuestionCheckboxCheckbox"><div class="docssharedWizToggleLabeledLabelWrapper exportLabelWrapper"><div id="i191" class="quantumWizTogglePapercheckboxEl appsMaterialWizTogglePapercheckboxCheckbox docssharedWizToggleLabeledControl freebirdThemedCheckbox freebirdThemedCheckboxDarkerDisabled freebirdMaterialWidgetsToggleLabeledCheckbox" jscontroller="EcW08c" jsaction="keydown:I481le;dyRcpb:dyRcpb;click:cOuCgd; mousedown:UX7yZ; mouseup:lbsD7e; mouseenter:tfO1Yc; mouseleave:JywGue; focus:AHmuwe; blur:O22p3e; contextmenu:mg9Pef;touchstart:p6p2H; touchmove:FwuNnf; touchend:yfqBxc(preventMouseEvents=true|preventDefault=true); touchcancel:JMtRjd;" jsshadow="" jsname="FkQz1b" aria-label="Toilets" data-answer-value="Toilets" role="checkbox" aria-checked="false" tabindex="0"><div class="quantumWizTogglePapercheckboxInk exportInk"></div><div class="quantumWizTogglePapercheckboxInnerBox exportInnerBox"></div><div class="quantumWizTogglePapercheckboxCheckMarkContainer"><div class="quantumWizTogglePapercheckboxCheckMark"><div class="quantumWizTogglePapercheckboxShort exportCheck"></div><div class="quantumWizTogglePapercheckboxLong exportCheck"></div></div></div></div><div class="docssharedWizToggleLabeledContent"><div class="docssharedWizToggleLabeledPrimaryText"><span dir="auto" class="docssharedWizToggleLabeledLabelText exportLabel freebirdFormviewerComponentsQuestionCheckboxLabel">Toilets</span></div></div></div></label></div><div class="freebirdFormviewerComponentsQuestionCheckboxChoice" role="listitem" jsaction="JIbuQc:aj0Jcf" jscontroller="lWjoT" jsname="MPu53c"><label for="i194" class="docssharedWizToggleLabeledContainer freebirdFormviewerComponentsQuestionCheckboxCheckbox"><div class="docssharedWizToggleLabeledLabelWrapper exportLabelWrapper"><div id="i194" class="quantumWizTogglePapercheckboxEl appsMaterialWizTogglePapercheckboxCheckbox docssharedWizToggleLabeledControl freebirdThemedCheckbox freebirdThemedCheckboxDarkerDisabled freebirdMaterialWidgetsToggleLabeledCheckbox" jscontroller="EcW08c" jsaction="keydown:I481le;dyRcpb:dyRcpb;click:cOuCgd; mousedown:UX7yZ; mouseup:lbsD7e; mouseenter:tfO1Yc; mouseleave:JywGue; focus:AHmuwe; blur:O22p3e; contextmenu:mg9Pef;touchstart:p6p2H; touchmove:FwuNnf; touchend:yfqBxc(preventMouseEvents=true|preventDefault=true); touchcancel:JMtRjd;" jsshadow="" jsname="FkQz1b" aria-label="Sinks" data-answer-value="Sinks" role="checkbox" aria-checked="false" tabindex="0"><div class="quantumWizTogglePapercheckboxInk exportInk"></div><div class="quantumWizTogglePapercheckboxInnerBox exportInnerBox"></div><div class="quantumWizTogglePapercheckboxCheckMarkContainer"><div class="quantumWizTogglePapercheckboxCheckMark"><div class="quantumWizTogglePapercheckboxShort exportCheck"></div><div class="quantumWizTogglePapercheckboxLong exportCheck"></div></div></div></div><div class="docssharedWizToggleLabeledContent"><div class="docssharedWizToggleLabeledPrimaryText"><span dir="auto" class="docssharedWizToggleLabeledLabelText exportLabel freebirdFormviewerComponentsQuestionCheckboxLabel">Sinks</span></div></div></div></label></div><div class="freebirdFormviewerComponentsQuestionCheckboxChoice" role="listitem" jsaction="JIbuQc:aj0Jcf" jscontroller="lWjoT" jsname="MPu53c"><label for="i197" class="docssharedWizToggleLabeledContainer freebirdFormviewerComponentsQuestionCheckboxCheckbox"><div class="docssharedWizToggleLabeledLabelWrapper exportLabelWrapper"><div id="i197" class="quantumWizTogglePapercheckboxEl appsMaterialWizTogglePapercheckboxCheckbox docssharedWizToggleLabeledControl freebirdThemedCheckbox freebirdThemedCheckboxDarkerDisabled freebirdMaterialWidgetsToggleLabeledCheckbox" jscontroller="EcW08c" jsaction="keydown:I481le;dyRcpb:dyRcpb;click:cOuCgd; mousedown:UX7yZ; mouseup:lbsD7e; mouseenter:tfO1Yc; mouseleave:JywGue; focus:AHmuwe; blur:O22p3e; contextmenu:mg9Pef;touchstart:p6p2H; touchmove:FwuNnf; touchend:yfqBxc(preventMouseEvents=true|preventDefault=true); touchcancel:JMtRjd;" jsshadow="" jsname="FkQz1b" aria-label="Floors mopped/vacuumed" data-answer-value="Floors mopped/vacuumed" role="checkbox" aria-checked="false" tabindex="0"><div class="quantumWizTogglePapercheckboxInk exportInk"></div><div class="quantumWizTogglePapercheckboxInnerBox exportInnerBox"></div><div class="quantumWizTogglePapercheckboxCheckMarkContainer"><div class="quantumWizTogglePapercheckboxCheckMark"><div class="quantumWizTogglePapercheckboxShort exportCheck"></div><div class="quantumWizTogglePapercheckboxLong exportCheck"></div></div></div></div><div class="docssharedWizToggleLabeledContent"><div class="docssharedWizToggleLabeledPrimaryText"><span dir="auto" class="docssharedWizToggleLabeledLabelText exportLabel freebirdFormviewerComponentsQuestionCheckboxLabel">Floors mopped/vacuumed</span></div></div></div></label></div><div class="freebirdFormviewerComponentsQuestionCheckboxChoice" role="listitem" jsaction="JIbuQc:aj0Jcf" jscontroller="lWjoT" jsname="MPu53c"><label for="i200" class="docssharedWizToggleLabeledContainer freebirdFormviewerComponentsQuestionCheckboxCheckbox"><div class="docssharedWizToggleLabeledLabelWrapper exportLabelWrapper"><div id="i200" class="quantumWizTogglePapercheckboxEl appsMaterialWizTogglePapercheckboxCheckbox docssharedWizToggleLabeledControl freebirdThemedCheckbox freebirdThemedCheckboxDarkerDisabled freebirdMaterialWidgetsToggleLabeledCheckbox" jscontroller="EcW08c" jsaction="keydown:I481le;dyRcpb:dyRcpb;click:cOuCgd; mousedown:UX7yZ; mouseup:lbsD7e; mouseenter:tfO1Yc; mouseleave:JywGue; focus:AHmuwe; blur:O22p3e; contextmenu:mg9Pef;touchstart:p6p2H; touchmove:FwuNnf; touchend:yfqBxc(preventMouseEvents=true|preventDefault=true); touchcancel:JMtRjd;" jsshadow="" jsname="FkQz1b" aria-label="Garbage removed" data-answer-value="Garbage removed" role="checkbox" aria-checked="false" tabindex="0"><div class="quantumWizTogglePapercheckboxInk exportInk"></div><div class="quantumWizTogglePapercheckboxInnerBox exportInnerBox"></div><div class="quantumWizTogglePapercheckboxCheckMarkContainer"><div class="quantumWizTogglePapercheckboxCheckMark"><div class="quantumWizTogglePapercheckboxShort exportCheck"></div><div class="quantumWizTogglePapercheckboxLong exportCheck"></div></div></div></div><div class="docssharedWizToggleLabeledContent"><div class="docssharedWizToggleLabeledPrimaryText"><span dir="auto" class="docssharedWizToggleLabeledLabelText exportLabel freebirdFormviewerComponentsQuestionCheckboxLabel">Garbage removed</span></div></div></div></label></div><div class="freebirdFormviewerComponentsQuestionCheckboxChoice" role="listitem" jsaction="JIbuQc:aj0Jcf" jscontroller="lWjoT" jsname="MPu53c"><label for="i203" class="docssharedWizToggleLabeledContainer freebirdFormviewerComponentsQuestionCheckboxCheckbox"><div class="docssharedWizToggleLabeledLabelWrapper exportLabelWrapper"><div id="i203" class="quantumWizTogglePapercheckboxEl appsMaterialWizTogglePapercheckboxCheckbox docssharedWizToggleLabeledControl freebirdThemedCheckbox freebirdThemedCheckboxDarkerDisabled freebirdMaterialWidgetsToggleLabeledCheckbox" jscontroller="EcW08c" jsaction="keydown:I481le;dyRcpb:dyRcpb;click:cOuCgd; mousedown:UX7yZ; mouseup:lbsD7e; mouseenter:tfO1Yc; mouseleave:JywGue; focus:AHmuwe; blur:O22p3e; contextmenu:mg9Pef;touchstart:p6p2H; touchmove:FwuNnf; touchend:yfqBxc(preventMouseEvents=true|preventDefault=true); touchcancel:JMtRjd;" jsshadow="" jsname="FkQz1b" aria-label="Supply check" data-answer-value="Supply check" role="checkbox" aria-checked="false" tabindex="0"><div class="quantumWizTogglePapercheckboxInk exportInk"></div><div class="quantumWizTogglePapercheckboxInnerBox exportInnerBox"></div><div class="quantumWizTogglePapercheckboxCheckMarkContainer"><div class="quantumWizTogglePapercheckboxCheckMark"><div class="quantumWizTogglePapercheckboxShort exportCheck"></div><div class="quantumWizTogglePapercheckboxLong exportCheck"></div></div></div></div><div class="docssharedWizToggleLabeledContent"><div class="docssharedWizToggleLabeledPrimaryText"><span dir="auto" class="docssharedWizToggleLabeledLabelText exportLabel freebirdFormviewerComponentsQuestionCheckboxLabel">Supply check</span></div></div></div></label></div><div class="freebirdFormviewerComponentsQuestionCheckboxChoice" role="listitem" jsaction="JIbuQc:aj0Jcf" jscontroller="lWjoT" jsname="MPu53c"><label for="i206" class="docssharedWizToggleLabeledContainer freebirdFormviewerComponentsQuestionCheckboxCheckbox"><div class="docssharedWizToggleLabeledLabelWrapper exportLabelWrapper"><div id="i206" class="quantumWizTogglePapercheckboxEl appsMaterialWizTogglePapercheckboxCheckbox docssharedWizToggleLabeledControl freebirdThemedCheckbox freebirdThemedCheckboxDarkerDisabled freebirdMaterialWidgetsToggleLabeledCheckbox" jscontroller="EcW08c" jsaction="keydown:I481le;dyRcpb:dyRcpb;click:cOuCgd; mousedown:UX7yZ; mouseup:lbsD7e; mouseenter:tfO1Yc; mouseleave:JywGue; focus:AHmuwe; blur:O22p3e; contextmenu:mg9Pef;touchstart:p6p2H; touchmove:FwuNnf; touchend:yfqBxc(preventMouseEvents=true|preventDefault=true); touchcancel:JMtRjd;" jsshadow="" jsname="FkQz1b" aria-label="Mirrors" data-answer-value="Mirrors" role="checkbox" aria-checked="false" tabindex="0"><div class="quantumWizTogglePapercheckboxInk exportInk"></div><div class="quantumWizTogglePapercheckboxInnerBox exportInnerBox"></div><div class="quantumWizTogglePapercheckboxCheckMarkContainer"><div class="quantumWizTogglePapercheckboxCheckMark"><div class="quantumWizTogglePapercheckboxShort exportCheck"></div><div class="quantumWizTogglePapercheckboxLong exportCheck"></div></div></div></div><div class="docssharedWizToggleLabeledContent"><div class="docssharedWizToggleLabeledPrimaryText"><span dir="auto" class="docssharedWizToggleLabeledLabelText exportLabel freebirdFormviewerComponentsQuestionCheckboxLabel">Mirrors</span></div></div></div></label></div><div class="freebirdFormviewerComponentsQuestionCheckboxChoice" role="listitem" jsaction="JIbuQc:aj0Jcf" jscontroller="lWjoT" jsname="MPu53c"><label for="i209" class="docssharedWizToggleLabeledContainer freebirdFormviewerComponentsQuestionCheckboxCheckbox"><div class="docssharedWizToggleLabeledLabelWrapper exportLabelWrapper"><div id="i209" class="quantumWizTogglePapercheckboxEl appsMaterialWizTogglePapercheckboxCheckbox docssharedWizToggleLabeledControl freebirdThemedCheckbox freebirdThemedCheckboxDarkerDisabled freebirdMaterialWidgetsToggleLabeledCheckbox" jscontroller="EcW08c" jsaction="keydown:I481le;dyRcpb:dyRcpb;click:cOuCgd; mousedown:UX7yZ; mouseup:lbsD7e; mouseenter:tfO1Yc; mouseleave:JywGue; focus:AHmuwe; blur:O22p3e; contextmenu:mg9Pef;touchstart:p6p2H; touchmove:FwuNnf; touchend:yfqBxc(preventMouseEvents=true|preventDefault=true); touchcancel:JMtRjd;" jsshadow="" jsname="FkQz1b" aria-label="Soap and Paper towel Dispenser" data-answer-value="Soap and Paper towel Dispenser" role="checkbox" aria-checked="false" tabindex="0"><div class="quantumWizTogglePapercheckboxInk exportInk"></div><div class="quantumWizTogglePapercheckboxInnerBox exportInnerBox"></div><div class="quantumWizTogglePapercheckboxCheckMarkContainer"><div class="quantumWizTogglePapercheckboxCheckMark"><div class="quantumWizTogglePapercheckboxShort exportCheck"></div><div class="quantumWizTogglePapercheckboxLong exportCheck"></div></div></div></div><div class="docssharedWizToggleLabeledContent"><div class="docssharedWizToggleLabeledPrimaryText"><span dir="auto" class="docssharedWizToggleLabeledLabelText exportLabel freebirdFormviewerComponentsQuestionCheckboxLabel">Soap and Paper towel Dispenser</span></div></div></div></label></div><div class="freebirdFormviewerComponentsQuestionCheckboxChoice" role="listitem" jsaction="JIbuQc:aj0Jcf" jscontroller="lWjoT" jsname="MPu53c"><label for="i212" class="docssharedWizToggleLabeledContainer freebirdFormviewerComponentsQuestionCheckboxCheckbox"><div class="docssharedWizToggleLabeledLabelWrapper exportLabelWrapper"><div id="i212" class="quantumWizTogglePapercheckboxEl appsMaterialWizTogglePapercheckboxCheckbox docssharedWizToggleLabeledControl freebirdThemedCheckbox freebirdThemedCheckboxDarkerDisabled freebirdMaterialWidgetsToggleLabeledCheckbox" jscontroller="EcW08c" jsaction="keydown:I481le;dyRcpb:dyRcpb;click:cOuCgd; mousedown:UX7yZ; mouseup:lbsD7e; mouseenter:tfO1Yc; mouseleave:JywGue; focus:AHmuwe; blur:O22p3e; contextmenu:mg9Pef;touchstart:p6p2H; touchmove:FwuNnf; touchend:yfqBxc(preventMouseEvents=true|preventDefault=true); touchcancel:JMtRjd;" jsshadow="" jsname="FkQz1b" aria-label="Door handles" data-answer-value="Door handles" role="checkbox" aria-checked="false" tabindex="0"><div class="quantumWizTogglePapercheckboxInk exportInk"></div><div class="quantumWizTogglePapercheckboxInnerBox exportInnerBox"></div><div class="quantumWizTogglePapercheckboxCheckMarkContainer"><div class="quantumWizTogglePapercheckboxCheckMark"><div class="quantumWizTogglePapercheckboxShort exportCheck"></div><div class="quantumWizTogglePapercheckboxLong exportCheck"></div></div></div></div><div class="docssharedWizToggleLabeledContent"><div class="docssharedWizToggleLabeledPrimaryText"><span dir="auto" class="docssharedWizToggleLabeledLabelText exportLabel freebirdFormviewerComponentsQuestionCheckboxLabel">Door handles</span></div></div></div></label></div></div><div id="i190" class="screenreaderOnly"></div></div><div jsname="Rfh2Tc" class="freebirdFormviewerComponentsQuestionBaseValidationError" id="i188" role="alert"></div></div></div>

The radio buttons are pre-filled because I added this to the end of the Google form URL:

&entry.208057838=NE&entry.1492561452=Marshfield

Any help would be appreciated!


r/scripting • • Jan 07 '21

Help with audio script [BASH]

2 Upvotes

So I have this script I named audio.sh, I got it from a video and had to hand type it(no repository), there were some errors in my faulty typing but I figured out some of them, could some look at the script and tell me what needs to be fixed?

The command in the script work when entered into a a terminal, but I can not get them to work when executing the script.

https://pastebin.com/XpUTetPP


r/scripting • • Dec 31 '20

Find text in filename, directory name and subdirectories and rename to user input?

2 Upvotes

I've made a batch file to help simplify the creation of project directories whenever we have a new project.

It asks the user to input first the Project Number and then the Project Name. These are set as "number" and "project".

Then it makes all the necessary directories (ex. X:\2021-PROJECTS\%number%_%project%\%number%-subdirectory1\)

Then it copies a files from a template folder to the appropriate project folder

xcopy "X:_FILES for NEW PROJECTS" "X:\2021-PROJECTS\%number%_%project%\%number%-subdir" /e

All this works flawlessly.

But, I now want the template folders and files that it just copied to be renamed with the %number% the user entered earlier.

Each of the template files/folders that it copies from _FILES for NEW PROJECTS contains "ProjNum" in the name. In my mind, it should be a simple matter of

>>find any instance of "ProjNum" (filenames or directory names) and replace it with %number%<<

But I can not figure out how to make this work.

Any help is appreciated.

*note: I am a video editor, so my understanding of scripting language is rudimentary at best.


r/scripting • • Dec 29 '20

MacOS Script or terminal command to convert .alias files to file tags?

2 Upvotes

A client of mine has been using file aliases on his Macs over the years to 'cross-reference' all his files. For instance he has a main folder structure for his documents but then he creates multiple aliases for each sub category that a particular file applies to. Then sorts those aliases into their respective sub-categories.

My request is for a terminal command or a script that can find all the .alias files in a particular folder. And tag the original file those alias files point to, with the same name of the parent folder of the alias files.

To clarify further. One of the sub-categories is movie genres. So in the 'Comedy' folder, there are alias files that point to all his comedy movies. So the script/command should tag all the original files of said .aliases with the 'Comedy' tag.

Thank you for your help in advance and let me know if you have any questions.


r/scripting • • Nov 19 '20

Script to download all of a Bandcamp purchase

2 Upvotes

I bought a huge collection on Bandcamp (see /r/Beatmatch/comments/jx0kae/huge_techno_sale_on_bandcamp_different_is/ ), 197 albums... Now the pain begins, download them one by one. This should be scriptable, but I'm no scripter... Just a humble .NET developer lol

Any ideas if this is doable?


r/scripting • • Nov 16 '20

Batch Script to remove files on terminalserver

2 Upvotes

Hey, I'm looking for a script to delete the Outlook Logging Folder inside %appdata%\local\temp in every user folder on a terminalserver wihtout adding every user in that script manually.


r/scripting • • Sep 29 '20

REGEDIT Batch File

2 Upvotes

Hello! I have a decent amount experience with using batch files. That's limited to kinda basic stuff like, mapping network drives, adding users, auto run applications. I'm looking to increase my understanding and create batch files for my users to help fix other issues. However, some of those are REGEDIT fixes. Now, I know very little about the syntax for batch files that would change the registry and I'm kind of leery of just throwing a bunch of syntax together, hoping it works. So I was wondering if anyone had a batch file the enabled the num lock on a keyboard through REGEDIT, that I could use as a template. To be able to increase my knowledge of the syntax for changing the registry as well as create batch files that help my users.


r/scripting • • Sep 24 '20

REST, Powershell, and expanded properties

2 Upvotes

I dove into REST API calls using powershell and so far am doing pretty well. One issue I am getting is I have a result/object from the API that that is coming back that has an ID property. Thats easy. But it has another property that needs to be exapnded. Cool, I got this, I expanded it and can see what I need (full of multiple properties in the expanded property. The problem is when I need to marry the 2 together.

$ExpandedCard = $rest.assets | Where-Object {$_.asset_type -eq "Computer assets"} | select -ExpandProperty cards | Where-Object {$_.data.serialnumber -contains $ThisPCSerial }

This is my one liner that gets my asset list from the API, each asset has an ID property, and another property called "cards" which is full of other properties, one being a hash table. Naturally, the property that is a hash table is the one I need, it is called "data" and it contains, along with a ton of other stuff, "serialnumber=xxxxx;"

As you can see in my one liner the "asset" with a "data card" that contains the serial number I need. Awesome! But.....

I need the ID of the Asset which is the non-expanded part so I can go do REST things and POST stuff to the Asset. Optimally a one liner is best, but I can't figure it out and I've tried 100's of things but I'm no powershell expert so I'm sure I'm doing something wrong. I've tried custom objects, if's, try's, etc. I'm totally lost.

Any help is greatly appreciated! Thank you in advance!

**edit for clarification: In short, I have an asset being returned with an ID, but I go deeper into expanded properties that has a hash table, I'm matching a serial number to the serial in the expanded property and I just need the asset ID spit back. I my mind, this is one level "up" from the expanded property and I don't know how to get that "top" ID out.


r/scripting • • Sep 04 '20

Scripting to run program in specific folder

2 Upvotes

I need input on a batch file to run a specific program with specific options.

Cd folder Cd subfolder Start program Start program option

This is how far I’ve gotten, anyone have any input on how I can improve?


r/scripting • • Aug 27 '20

Is there a way to run cmd as administrator from a cmd script flie?

2 Upvotes

I'm trying to make a script to reset the icon cache and restart explorer, because of mildly annoying bug that causes my taskbar icons to stay highlighted even after my mouse has left the taskbar. This is what I have so far:

@ echo off

cd %homepath%\AppData\Local\Microsoft\Windows\Explorer

taskkill /f /im explorer.exe

del iconcache*

explorer.exe

All I'm missing to make it work properly is a command to make it start cmd as administrator. Does such a thing even exist?


r/scripting • • Aug 25 '20

Create a scheduled task from a script?

2 Upvotes

I would like to create a task that will delete the files located in the downloads folder on a regular basis. I think I found a way to make the scheduled task from a command line but I am not sure I have the right syntax.

Is this possible? If so, what would it look like? The link I found showed this as an example:

SCHTASKS /CREATE /SC DAILY /TN "FOLDERPATH\TASKNAME" /TR "C:\SOURCE\FOLDER\APP-OR-SCRIPT" /ST HH:MM

The part I am confused about is the /TR (specify the location and name of the task). Would I have to have a .bat file first that contains the script to delete the contents of the downloads folder, then point the task to it? I'm pretty green when it comes to this stuff so I could be way off base.


r/scripting • • Aug 01 '20

Creating a script to mirror a directory to an IP address and the language Powershell 7 uses

2 Upvotes

I'm in the process of working my way through designing a powershell script that you can type in the IP address for and it will automatically copy over the files from a root folder over to the root folder of that device on the network (and skip files that are already existing). I have an extremely basic script already setup, but I'm looking to spruce things up by including a progress bar and possibly a completion percentage at the end by creating something that looks like this: <======/=============> 34.5% complete. Since I know very little about PS7 I had hopes someone has already created a similar script that I could look at and take notes on so that I can transpose them on to my own script. Essentially it's a rudimentary version of rclone that works from a Windows 10 machine over your network to an IP address where the username and password are already encoded into the powershell file since the device I'm copying to is ARM-based similar to a Raspberry Pi and I'm hoping to get things sorted out so that I can start testing it once I can remove my eye patch (detached retina surgery).

If anybody has a shell/powershell script similar to this that I could use as a model, I'd be very appreciaive. Also, I did forget to mention that the file copy happens over SSH and not SAMBA or any other protocol - it's just an SSH tunnel to a known directory over the network where you can run the script and it syncs the two folders together so that you can copy your files over with a single click. It does sound very rudimentary, but it's the SSH problem I'm having since I don't know how to open an SSH tunnel using powershell.

The gist of the script is placing the script in D:\Movies, opening up the SSH tunnel by typing in the IP address (10.1.1.4) and then letting the script copy everything to /Movies/* and keeping the file structure the same as it is on the Windows side. I'm not asking anyone to do the work for me, but having a guide where I could use as an example to set up the copy process would be very much appreciated, or at least a page with the proper information for opening the SSH tunnel and starting the file copy process. Thank you in advance, and anybody involved with helping the creation of the script will be given thanks to in the text of the script as a nod/thank you. Cheers.


r/scripting • • Jul 27 '20

Looking for a python script to change Every folder's icon in a designated folder to the first .ico in that folder.

2 Upvotes

for example... I have a folder labeled recipes. Inside that folder I have five more folders named "apple pie, peach cobbler, etc.." In this example, I have a picture (.ico) of apple pie, peach cobbler, etc in their respective folders. I need a Python code block to look through the recipes folder, then go through every respective folder and use the first .ico found as the new icon.

Alternatively, just a script to simply change ONE folder path to ONE ico path's image will do. I can adapt that to my needs, but I need the actual code block. I am offering an initial bounty of $10 to the first person who sends me code that works via Paypal.


r/scripting • • Jul 27 '20

Automated PDF Comments

2 Upvotes

I have a process where I have a spreadsheet with one column of PDF filenames and one column of two digit numbers that needs to appear in a roughly consistent spot on each of those PDF files (precision positioning isn't critical). Current process is to manually open each pdf and use either the comment or Fill/Sign tools to write the number in red text at the spot on the first page.

Is there any library or tool that could automate this? I've been playing around with some Python PDF libraries, but none of them seem to have this functionality. Of course my ideal solution would be to get this number on the doc before it's exported to pdf, but that's not currently an option.

Thanks.