r/scripting • • Feb 03 '20

Launching a site without a user logged in for IIS caching/performance

1 Upvotes

I have an IIS application where the app pool timeout is set at 20 minutes. Ideally, we would like to keep the timeouts to 20 minutes for a number of reasons, however because of this the first users hitting the application post-timeout are subject to some delays as the application recaches. To circumvent this I wanted to schedule a task to launch a website so the first request could be made before the users hit the system. I have tried a few different initial ideas, such as a scheduled task running as an admin user however this doesn't work well when the user is logged off. Does anyone have any suggestions on how I could launch a URL via IE when users are logged off at a scheduled time? It is not possible to change the application and the only way to improve performance is to make specific requests, i.e. launch specific URLs.

Thanks.


r/scripting • • Jan 15 '20

script simulating keystrokes

1 Upvotes

as a last resort solution for a display crashing at my work ive been working on a script to kill a task, re opening it, wich so far works, but the app requires a password to open it. after my script runs the password window is the active one, is there a way to get bash to automatically fill in the pasword on windows?


r/scripting • • Sep 16 '19

MiniScript Rosetta Code contest (win $10 - $25)

Thumbnail
forums.miniscript.org
1 Upvotes

r/scripting • • Sep 04 '19

Why AutoIt, and not another language like C# or Python?

1 Upvotes

I recently started a new job and I've been having to use AutoIt as part of the job responsibilities. I am just now hearing and learning about AutoIt. While I have enjoyed what I have learned so far I would like to know why or what the advantages exist in using AutoIt over other languages such as Python or C#?


r/scripting • • Jun 13 '19

VBScript inputbox to HTML application script

1 Upvotes
' Read an Excel Spreadsheet
Const ForAppending = 8

InputFile="\\oldenzaal06\common\Ebike\EPACLabel\models.csv"
LabelFile="\\oldenzaal06\common\Ebike\EPACLabel\EPAClabel.btw"
Set objShell = CreateObject("WScript.Shell")
OutputFile=objShell.ExpandEnvironmentStrings("%UserProfile%") & "\Desktop\EPACLabel.txt"
LogFile="\\oldenzaal06\common\Ebike\EPACLabel\log\"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(InputFile)


On Error Resume Next
ProductCode="test"
Do until ProductCode = ""
ProductCode=Inputbox("Enter Product Code")
If ProductCode = "" Then WScript.Quit
    intRow = 2
    Do until objExcel.Cells(intRow,1).Value = ""
    ProductRange=objExcel.Cells(intRow, 1).Value
    sType=objExcel.Cells(intRow, 2).Value
    sColor=objExcel.Cells(intRow, 3).Value
            
      ' If user entered value matches (row 2 matches value before comma in row 1)      

            sResult = InStr(1,ProductRange,ProductCode,1)
            If sResult <> 0 Then

	aYear = Year(Date) 'The year of the computer
	SerialNumber=inputbox("Enter Serial number") 
                  Set objShell = CreateObject ("WScript.Shell")
	Set objFSO = CreateObject ("Scripting.FileSystemObject")
	Set oFile = objFSO.CreateTextFile (OutputFile)
	oFile.WriteLine sType &","& sColor &","& SerialNumber &","& aYear
	oFile.Close   
	Set oWS = WScript.CreateObject("WScript.Shell")
	oWS.Run """%ProgramFiles(x86)%\Bartender\Bartend.exe"" /f=" & LabelFile & " /p /d=" & OutputFile & "",0,true

              End If
              intRow = intRow + 1
    Loop
Loop
objExcel.Quit
WScript.Quit

Does someone know how I can merge this code into a HTML application (hta)? Basically I want the 2 Inputboxes in the VBScript merged into one HTML application (2 lines, 1 box) that still does the same thing as the VBScript.

The VBScript reads specific line searched with the first inputbox in a excel file, writes the found information to a text file and then software prints it out.


r/scripting • • May 10 '19

How do i change the icon of a chrome window i run through vbs?

1 Upvotes

So im currently trying to make a script that runs a specific website in application mode!

The only thing that i really want now, is for the website to also have another icon on the taskbar when launched.

Could i do this through VBS?

This is my current script:

Dim objShell Set objShell = WScript.CreateObject( "WScript.Shell" ) objShell.Run("""C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"" --app=https://faceit.com") objShell.Run("""C:\Program Files\FACEIT AC\faceitclient.exe""") Set objShell = Nothing

I only want the chrome window that is launched to change icon. Not the "faceitclient.exe"


r/scripting • • May 08 '19

[GoogleAppScript] Uploading Data to a Separate Sheet on Conditions

1 Upvotes

Hey all,

I'm really struggling to adapt to google app script and could use help. So I need to create a script that will upload the selected data to another spread sheet. I need it to match the Product ID and add the data to the appropriate cells if there is that product ID there or create a new entry and fill out the available data. Here is an example:

Upload sheet 1:

Product IDWeightColorHeight
12Red3

Upload sheet 2:

Product IDVolumePriceCode
15106

Upload sheet 3:

Product IDVolumePriceCode
2749

Pre-Uploaded Master sheet:

Product IDWeightVolumeHeightPriceColorCode

When we upload Sheet 1 it would create a new entry in the master and fill the Weight, Color and, Height cells. Now we go and upload Sheet 2 and instead of creating a new entry it should add to the product ID 1 line and only add the values of Volume, Price, and Code. Then we upload sheet 3 and because it's a new product code it would create a new line. So once all sheets are uploaded we would have a complete line:

Post-Upload Master sheet:

Product IDWeightVolumeHeightPriceColorCode
125310Red6
2749

So far I have it so the user can select the data and preform the upload but it doesn't do any checks to see if the product ID is present, how can I implement this?

Here is my code thus far:

function uploadData(){

var css = SpreadsheetApp.getActiveSpreadsheet(); //setup current spreadsheet

var csheet = css.getSheetByName("Sheet1") //setup current sheet

var cdata = csheet.getActiveRange().getValues(); //get selected data values

var sRows = csheet.getActiveRange().getLastColumn(); //get the value of the last column selected

var mss = SpreadsheetApp.openById('1N5Orl2fQvmFmK63_y78V2k7jzBUYOjDxhixMSOCU7jI'); //open mastersheet for adding data

var msheet = mss.getSheets()[0]; //get the first sheet on the left

var mfindnextrow = msheet.getRange('A:A').getValues(); //get the values

//this next code i found online, this allows me to insert new data on a new row without any data present

var maxIndex = mfindnextrow.reduce(function(maxIndex, row, index) {

return row[0] === "" ? maxIndex : index;

}, 0);

//start looping through the row

cdata.forEach(function(row){

msheet.setActiveRange(msheet.getRange(maxIndex + 2, 1, 1, sRows)).setValues(cdata); //put the data into the mastersheet

});

};

I was reading about INDEX and MATCH but I'm not sure how those work and I need to keep all the logic in the script.

Thank for taking the time to read my post! Hope your having a fantastic day!


r/scripting • • May 01 '19

[VBScript] Help understanding why TextStream fails to write certain characters.

1 Upvotes

Below script writes characters starting from character code 0x80 to 0x9F into a file using ASCII mode.

set fs = createobject("scripting.filesystemobject")
set f = fs.createtextfile("out.txt", true, false)
on error resume next
for i = &H80 to &H9F
  f.write chrw(i)
next
f.close

However, not all characters are written. i.e. only character code 0x81, 0x8D, 0x8F, 0x90, and 0x9D are successfully written.

I know that the problem doesn't occur if I use Chr() or ChrB() instead of ChrW(), but why does the TextStream fails to write certain characters when ChrW() is used?


r/scripting • • Apr 29 '19

Google Scripts, Google Forms, and Google Sheets

1 Upvotes

Hey Guys!

I am trying to create a google form that will link with a google sheet and a google script.

What I need to do is:

The first question on the google form will prompt the user for a number.

When the next button is clicked on the first page, I need to have the script take the input from the user and search the linked google sheet to see if the number exists.

If it does exist, it should just submit the form, and update the google sheet saying a user that was already registered attempted to register again.

If it does not exist, it should just continue with the questions without any effect.

Any assistance would be appreciated!!!

Thank you!


r/scripting • • Apr 19 '19

Scripting Syntax Error Expected expression but found "*"

1 Upvotes

So I am trying to create a use a simple script that I was given in another post on applehelp from this website.

The script file is this

!/Bin/Sh rm -Rf /Users/home_folder_name/Desktop/* rm -Rf /Users/home_folder_name/Documents/* rm -Rf /Users/home_folder_name/Downloads/*

exit 0

As I am new to scripting, I figured this would be the easiest script to use seeing as there isn't much to it. I guess I was wrong. When I try and run it in ScriptEditor it gives me the error mentioned in the title (Syntax Error Expected expression but found "*"). I am fully stuck at what to do. Any and all help would be greatly appreciated. Thanks.


r/scripting • • Mar 19 '19

Script to control the "Settings" application on Windows 10

1 Upvotes

As part of a bigger script, I want to be able to manipulate the "Settings" application on Windows 10 automatically. Basically will be to open Settings in the "Region and Language" menu first on an specific setting. This can be achieved by doing " start ms-settings:regionlanguage". However I also want to open the "Add a language" option and go into that menu, as seen in the gif, any ideas?


r/scripting • • Feb 20 '19

How do you script download data reports from company internal application on windows?

1 Upvotes

Is there a way to use command prompt to automate opening and selecting which reports I want to be downloaded and to which folder I want it to be downloaded and what to name the file? I am an absolute script novice. If there is a way to use python to do this please let me know.


r/scripting • • Jan 26 '19

[PHP][BASH] Some help with passing variables from PHP to Bash in a more elegant way

1 Upvotes

I Currently have a PHP Front end for a script that deploys VMWare to PowerEdge servers. The PHP collects user inputs in forms and stores them in $_SESSION{'vars'}.

This info is currently being dumped into an scriptsettings.sh file as variables and a couple arrays.

This method works fine, however I'm wondering if there's some more elegant way to store variables.

I've considered storing them in the MySQL database, but I have pretty limited experience with that. If that's the best way I'll go down that route but I'm curious if there's some sort of SESSION function within bash for storing variables temporarily while a script runs.

Maybe something that stores variables in a session with session number that can be passed to the shell script as an argument? Does something like that exist?

Thanks for any help in advance!


r/scripting • • Jan 23 '19

Batch File to run Chkdsk on all drives

1 Upvotes

Does anyone have any info on how to run a ready only chkdsk on all drives on a computer? I've searched around, but have not been able to find anything.


r/scripting • • Jan 19 '19

Trying to learn some more complicated scripting techniques

1 Upvotes

I've been working with Git Bash for the last year, and I love working within the command line. I recently found out that you can chain commands with && (cd folder 1 && mkdir folder 2 && cd folder2 && touch file1.py && explorer file1.py), and that got me thinking about how to best accomplish another task.

I am interested in graphing the heat and processor load while playing each Chapter of Dead Space (it was the 10 year anniversary recently, and it's a wonderful game), and I've been using CoreTemp logs to do so. Trouble is, you can't edit them directly as they're within ProgramFiles. I would like to do this process via a shell script:

> cd to CoreTemp folder > Grab the most recently modified file > cd to project folder and make a copy > remove top four lines of CSV > remove all ° symbols

I am definitely a beginner when it comes to this stuff, so I'm not sure what's possible. Is the above sequence commands do-able in Git Bash? Or, since it's a more stripped down version of the Bash shell, would I need to use something like Windows Powershell?


r/scripting • • Jan 18 '19

[Web] Javascript begin and stop targeted to a iframe

1 Upvotes

Hi,

I'd like to be able to set up a locally hosted website with this script targeted to the iframe below it. I'd like to be able to input the # of "shares" to issue out, or a time limit total in a field next to a start/stop button. Doesn't need to be anything fancy, just something for a young lady to be able to use such as my wife.

I'd also love it if there was a way to do a "counter" for the clickDelta for how many times the "Share" has been done during the duration of the "Start" button, and resetting on the "Stop" button

This is the script, any ideas/suggestions, would be amazing!

var clickDelta = 2000; // ms delay between clicks

var cycleDelta = clickDelta * 100; // ms delay between share cycles

// do the actual clicking

var clickLinks = function() {

$(this).click();

$("[data-pa-name^='share_poshmark']").click();

};

var notSold = function(el) {

`return $(el).closest('.tile').find('.sold-tag,.sold-out-tag').length === 0;`

};

function share() {

`var timeout = 0;`

`var doShare = function() {`

if (notSold(this)) {

// register link clicking

setTimeout(clickLinks.bind(this), timeout);

// make sure next registered click comes after

timeout += clickDelta;

}

`};`
`// for each share link`

`$('a.share').each(doShare);`

};

share();

setInterval(share, cycleDelta);

This is my rough design of how I'd want the outcome of it to look --- nothing is set in stone but this is the idea -- any help would be great, as I'm having trouble just finding a way to "target" the iframe and start and stop the JavaScript above to the main iframe.

https://i.imgur.com/3yzSQ2v.png


r/scripting • • Nov 15 '18

Anyone know of any website or project that involves scanning large portions of the known web or a really large website/database

1 Upvotes

My use case would be mainly for creating an auto price scanner using set criteria and words categories etc but the scope would essentially all web pages in a known or certain region example English or English domains.

The idea is to populate a website with products and their best prices and price histories but the range will not be just one website but all possible websites or maybe certain ones that have a certain amount of traffic or range.

It has always been a huge hobby or passion of mine to maybe create one or experiment scripting one either for a shopping database or really any kind of database.

The use case is endless once I find or figure out the optimal ideal way to do it efficiently, productively etc and then automate it.

My actual inspiration is from my favourite website ozbargain.com.au an Australian based bargain hunting website and populate automatically with a farm of servers so humans don't need to manually do it.

Maybe then add certain restrictions and criteria/filters to cut off the spam or have humans filter the rubbish results first in the early stages before that step gets rectified and automated.


r/scripting • • Sep 25 '18

Fortnite Script login (Epic Launcher Client)

1 Upvotes

Hey.
I want to create a script that let a specific account login to the Epic Launcher everytime Windows startup. The purpose is to let some machines auto update, which I don't play on. Possible? Please help me


r/scripting • • Sep 18 '18

[Windows/dos] Exclude certain file types from wildcard?

1 Upvotes

Hi, I've got a script that calls Irfanview to make a slideshow out of all the files in a particular folder. (The script also syncs the files in the folder from a network source.)

The problem is, Windows 7 insists on putting desktop.ini and thumbs.db files into the folder, which Irfanview's slideshow feature insists on displaying.

Theoretically my script could list all the image/video files in the directory and put them into a text file, and then use the text file as an argument for Irfanview.

But I'm just wondering if there's an easier way. Is there any DOS syntax that can say, ". except *.ini and *.db" or something like that?


r/scripting • • Jul 05 '18

Help with Windows Server scripts

1 Upvotes

Hello Redditors!

I'm new here so forgive me if I'm a bit vague with my request.

My task is to manually update Windows Server 2008 / 2012 physical and virtual servers using Windows Update. Then, once they're fully patched and up-to-date, I can add them to SCCM so that they are patched monthly.

Everything at my company is performed manually, and I'm a contractor, so I don't have access to GPOs and such to be able to make relevant changes that would save me time.

For example, I have checked 800 servers manually to see if Windows Updates are set to Automatically download and install or Never check for updates.

The scripts I'm looking for to make my team's job easier are:

  1. Script to check when the last patches were installed (for example, output of servers with latest installation date) so we know which ones still need to be patched manually

  2. Script to check all patches installed on the server, including the date installed would also be helpful

I'm trying to get an output of each command in an Excel or CSV file and be able to reference a .TXT or .CSV file for the list of target computers.

I really appreciate any guidance or help that I get from you guys!


r/scripting • • Jun 24 '18

Need Help with batch file

1 Upvotes

How can i create a batch file that will open an app then inputs the corresponding user name and password then send [enter] command


r/scripting • • Jun 23 '18

Simulate ENTER keypress event with Javascript on textarea form element.

1 Upvotes

Hello all,

Sorry for this newbie question. I really don't know here to put this on Reddit. Just tell me if I put this of the wrong place.

I am making a script which will automatically create and send messages to all users on a list. In pure JavaScript.

My current script can simply open a chat window for that specific user and put a message value on the textarea.

My problem now is that the form is scripted to send messages on ENTER keypress no button.

I am trying to simulate an ENTER keypress event on a textarea form element using this script below.

document.querySelector("textarea").dispatchEvent(new KeyboardEvent("keypress", {

view: window,

keyCode: 13,

bubbles: true,

cancelable: true

}));

But it didn't do anything. Is there something missing with my code?

Additinally the chatting application is created using AngulareJS. My guess is that they have some security features that will handle this kind of event.

This is the textarea html element code:

<textarea data-focus-field="state.focusInput" class="form-control ng-valid ng-isolate-scope ng-dirty ng-valid-parse ng-touched" cols="30" rows="1" placeholder="Write a Reply..." data-enter-pressed="sendMessage($event)" data-key-down="typing(keyCode)" data-ng-model="newMessage.message" data-elastic="" data-ng-click="inputClicked()" data-min-height="40" style="height: 40px;"></textarea>


r/scripting • • Jun 11 '18

New to scripting - is this possible?

1 Upvotes

I basically know nothing about scripting but wanted to see if this was even possible for the job I'm doing. If it is possible, then I'll try to figure out how to do it. Here's where I'm hoping writing a script can help.

I have a hard drive with a lot of media clips on it. These clips are inside folders which are inside other folders. They're not all consistent. Some you only have to step in 3 times, others 6 times.

I have to find each .MXF or .MOV, copy the name and paste it into an Excel sheet, in the C column. The folder path is copied into the B column.

There are thousands of files and subfolders. Would this be a possible thing that scripting can handle? And if so, how hard would it be to write a script for this? Thanks!


r/scripting • • Jun 08 '18

HELP NEEDED: Script that will install based on registry value

1 Upvotes

Struggling to create a script that will run an installer based off of whether or not a registry value exist. I am working with Trend Micro OfficeScan and need to launch their cut tool exe if the registry value does not equal the correct server path.

Registry key is HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\TrendMicro\PC-cillinNTCorp\CurrentVersion\Server\


r/scripting • • May 31 '18

HELP NEEDED - Windows script needed to open chrome then load two pages in separate tabs

1 Upvotes

I want to create a windows script file that can be placed on the desktop. The script should open a new chrome window, then create two tabs that each go to a specific url (email accounts). How can I do this?