سؤال

I've got a few monitoring sites set up for my mobile apps (e.g. crittercism) and I have an extra monitor set up for monitoring everything. I have a few Chrome windows sized down to just the values I'm interested in and spaced so that everything fits on the screen.

I'd like to write a macro that launches all (at this point 8 sites) these Chrome/browser windows and spaces them accordingly.

Rebooting and resizing right now is a pain.

هل كانت مفيدة؟

المحلول

You can use JavaScript. Save the following code as a .html file:

<html>
<script>
function openWindows() {
  window1=window.open('http://google.com/','','width=400,height=300');
  window1.moveTo(0, 0);
  window2=window.open('http://yahoo.com/','','width=400,height=200');
  window2.moveTo(0, 300);
  window3=window.open('about:blank','','width=200,height=500');
  window3.moveTo(400, 0);
};
</script>
<button onclick="openWindows();">Open Windows</button>
</html>

Open it in your browser and click the button. You should see something like this:

Multiple popups

NB: You'll probably have to relax your popup blocker settings. Here's how to change the popup settings on Chrome:
Chrome popup settings
This won't change popup blocker settings for other websites.

On Mac, an extra monitor extends the screen size. For example, if your secondary monitor is arranged to the left of the primary monitor, window4.moveTo(-300, 0); should do the trick.

نصائح أخرى

Probably you're interested in open. So you could open /Applications/Google\ Chrome.app or you could similarly open http://www.google.com. You can also use AppleScript to position windows automatically, including directly from the command line via osascript — see e.g. this answer on the Linux & Unix StackExchange.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top