Need to change URL in batch file after a timeout - google-chrome

Very new to batch files/scripts etc, and I need a little help with a basic script I am working on. I've made a script that opens Chrome and goes to a website, and after 15 seconds, it opens a new tab and goes to a different page on that site. I would like it to re-use the same tab, but change the URL after the 15 seconds. Then, after the sequence I'd like Chrome to close.
I've tried searching for 'changing url in batch files', and experimented with things such as leaving out 'start chrome.exe' etc, but I've been getting nowhere for the last 3 hours, so thought I would reach out for help. Ideally, I'd like to keep it all within the batch file, rather than trying to use sendkeys/hotkeys etc.
Thanks in advance (code should be below)
P.S. If I am approaching this from the complete wrong angle, please let me know and point me in the right direction :)
#echo off
start chrome.exe --new-window www.domainname.com/
timeout /t 15
start chrome.exe www.domainname.com/about-us/
timeout /t 15
start chrome.exe www.domainname.com/gallery/
timeout /t 15
start chrome.exe www.domainname.com/contact-us/
timeout /t 15
close chrome.exe
exit

Related

"pause" is not pausing the execution of script in Octave 5.1.0 in Windows 10

pause should stop the execution until something happens. But in my case where i have OCTAVE 5.1.0 on OS WINDOWS 10 is not doing its work properly. It does ignore all pause statements in script and execute the whole file.
I am running this program in my installed octave application in command window with GUI.
What may be the problem?
I have tried pause with function brackets
pause();and without function brackets pause; but still problem remains same.
%do something
plotData(X, y);
fprintf('Press enter to continue.');
pause;
%do something
plotData(X, y);
I except that script will first plot data and will stop execution till key is pressed to enable me to analyze data then after key press it would plot another plot with processed data.
But it just plot both plots in fast manner that i could not see it.
There are few bugs related to pause that have been introduced since version 5.1 and seem that recently have been fixed. It will be available in the next version. You can try alternative functions like kbhit or switch to a previous version.

How do I make a script to launch a program from the folder of a usb?

My task is to plug my usb into one of our computers, run a script, and then it run a program through google chrome. I have done this successfully, the only issue is that almost every computer I plug my usb into reads the usb in a different directory i.e. F: D: E: C: G: and so on.
I need a way to streamline this instead of having 7 different scripts to choose from... Here is my script as it stands now=
#echo off
cd "F:\skywardaccess.htm"
start chrome F:\skywardaccess.htm
exit
Thank you for your help and advice :)
It seems your problem is only that you're overthinking it. Anytime a batch is ran, its working directory is automatically set to where it's being run from. So, if your script is in the same folder as what ever you want to run, all you need to do is
#echo off
skywardaccess.htm
exit
The only difference being that, unless the .htm extension has already had a default browser set, it will ask you what browser you want to open it with.
Side note; since it's only opening a file, #echo off and exit are both unnecessary. You could have your batch just say filename.extension and it will run.
EDIT
As previously explained, no change of directory is needed. You can try;
start chrome.exe test.htm
but this only works if their chrome is on an indexed location, such as C:/ but this cannot be guaranteed.

cannot stop Chrome from updating from 43 to 44

I am using Selenium and Chrome to write a web test, yesterday my Chrome updated to 44 and now my test does not work, I know that it is an issue with Chrome 44 and we need to wait till the new version is given out.
So I am trying to go bake to chrome 43, i do:
1) Uninstall chrome 44
2) Install chrome 43
but as soon as the installation is done it automatically opens the chrome and it is 44 again !! I went to Run->Service.msc and disabled my chrome to update automatically, but it does not work. I remove the Update folder in User->Myname->AppData->Local->Google->Update but it does not work,
and there is nothing related to updating at chrome://plugins.
I AM STUCK
PLEASE HELP :(
I did all sulosion posted on line but non of them worked,
Have spent a loooong time trying to disable updates (literally hours, reading forums and testing various (some exotic) solutions), and this was driving me crazy. But there what seems an infallible solution (see further down).
Even using the official Google page with the templates did NOTHING : https://support.google.com/installer/answer/146164?hl=en
I followed scrupulously the instructions of that page, the keys in the registry are all correct, but still going to the "About Google Chrome" when the program is opened, I can see the wheel going around and a few seconds later the update is forced and done.
I have tried using the standalone installer of Google, on a Windows 8.1 machine 64Bits - and yes all the keys are set to :
Dword: AutoUpdateCheckPeriodMinutes Value: 0
Dword: DisableAutoUpdateChecksCheckboxValue Value: 1
Dword: UpdateDefault Value: 0
Dword: Update{8A69D345-D564-463C-AFF1-A69D9E530F96} Value: 0
... both in HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Update AND HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Policies\Google\Update since it is a 64-bit machine.
So the radical solution to prevent the auto-update, if that helps anyone, is to just purely sort the program responsible for the updates itself! (Just deleting it, OR saving a copy, OR renaming it OR even better just in case I one day need to do an update: Zip the content for future potential re-use).
Easy solution :
1- Go to "C:\Program Files (x86)\Google\ and find the folder "update".
2- There are a couple of options to choose from:
A) first method: Rename the folder:
- Right click > Rename > from Update.bak to Update2.bak for example.
- Now launch Chrome: NO MORE UPDATES!! since it can not find the update program !! Finished.
B) second method: Zip the folder:
- Zip the entire folder by making an archive. (Right click the "Update" folder > Send to Compressed (zip) folder)
- A window might ask you to backup/zip and place it on the desktop, click yes. (message: Windows cannot create the compressed folders here. Do you want to be placed on the desktop instead?)
- Move the newly created zip file to the original location. A new window security might pop up > click continue. (message: You need administrator permission to copy this file). [This will be what to unzip if one day you decide to update Chrome - Just remember that when unzipped it will have the following structure : Update > Update > then all the content of the folder. Remember to move everything from inside the second update folder (copy paste) one level up so that is becomes : Update > then all the content of the folder].
- Now that you have a copy just delete the "Update" folder.
- Now launch Chrome: NO MORE UPDATES!! since it can not find the update program !! Finished.
Good luck and Enjoy.
As per Chromium
Turning off Auto-Updates on Windows
To turn off auto-updates of Google Chrome on Windows, you need to instruct Google Update to not update it. To do this, you can either:
Use the Google Update ADM templates provided on this page or as described in this article.
Set the value of
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Update\AutoUpdateCheckPeriodMinutes
to the REG_DWORD value of "0".
You can check for Mac and Linux in the first Link
To get rid of Chrome 44 and go back to 43 I downloaded a stand-alone version of chrome 43 which is an .exe file and I just double clicked on it and it was installed on my computer WITHOUT updating to Chrome 44, to find the link to Chrome 43 have a look to RobW comments to my question above and if the link is stale you can just Google for Chrome Stand-alone, or go to the bottom of this page Google Chrome 64-bit Offline Installer| 45.7 MB.
Have Fun :)

Close a single tab in Chrome using Batch command

I'm relatively new to batch commands and have been learning steadily. My problem is like this:
I've understood how to kill processes using batch commands using many different methods. However, I've been unable to figure out how to close a single tab in, preferably, chrome.
Any thoughts would be greatly appreciated!
Thanks!
So, I suppose I should state my exact problem.
I'm using notepad++ as my LaTeX compiler and sending the final pdf to chrome. The reason: I usually have ~20 tabs open related to the project I'm working on and it just makes my work much easier to split my screen between notepad++ and chrome.
My current batch file compiles the LaTeX code and sends the compiled document to chrome as a new tab. For obvious reasons, i don't want to close a tab each time I compile, so I thought that closing the current tab at the same time during compiling would solve my problem. But, I just can't find a way to get my batch file to only close the tab with my compiled pdf.
Thanks in advance!
check all running chrome instances/tabs with :
wmic process where "caption='chrome.exe'" get
and see processes properties.Probably the best indicator that you can rely on in this case is CreationDate (other properties are basically the same for all chrome instances) - it always comes in format YYYYMMDDHHmmss.ms and is easy for string comparison.But you'll have to know the time when it was started.

How to start Sublime Text with selected project using a local .sublime-project file?

I may be missing the obvious, but can't seem to solve this fairly simple & typical case (with v3 build 3022 on Debian or XP, in case it matters):
Start Sublime Text opening a project "myprj", specified on its command-line,
using default.sublime-project located under that project's dir (say "/repo/myprj"),
automatically re-opening the last open files of that project (i.e. its workspace),
using default.sublime-workspace for that (also from the same project dir)
but (obviously) not auto-opening any other files remembered from non-project sessions,
and automatically saving all open files (to the above default.sublime-workspace) on exit.
Ideally:
$ sublime_text --project /repo/myprj/default.sublime-project
should just work. But it doesn't (see below).
Another approximation that seemed reasonable:
setting "hot_exit" and "remember_open_files" to false, and then invoking ST with:
$ sublime_text --data /repo/myprj --project default.sublime-project
But ST3 either doesn't find the project file (via --data), unless I chdir there first (--data seems to be no longer supported?), and it either doesn't auto-open any workspace files from last time (despite a previous "Project / Save Workspace As..."), or, if I set "remember_open_files" back to true, it just re-opens the last open files regardless of the project given on the command line.
I guess the issue is the workspace file not being handled automatically for some reason, and I'm just missing some trivial step somewhere. (The official docs (and also the unofficial) seem to discuss command-line switches for OS X only, and asking for --help didn't actually help with this one.)
(Please note: I wouldn't like to launch ST first, and then switch to some project from inside manually, and I also don't want to store the sublime-project/-workspace files outside of the prj. dir.) Thanks a lot!
I seached for a solution for a similar problem these days and didn't find a proper way. So i created an automator app with a small apple script. Maybe this helps you too.
Open Automator and Choose news Application.
Create an action to start Sublime Text 2
Insert an action to perfom the following apple script:
delay 0.2
tell application "System Events"
tell process "Sublime Text 2"
tell menu bar 1
tell menu bar item "Project"
tell menu "Project"
tell menu item "Recent Projects"
tell menu "Recent Projects"
click menu item "~/yourproject.sublime-project"
keystroke "p" using {command down, shift down}
end tell
end tell
end tell
end tell
end tell
end tell
end tell
For anyone still looking to do this, you can launch the built-in command line tool and launch it with a project like so (Mac OSX):
"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" --project "absolute-path-to-your.sublime-project"