my_wins 1.1.4 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +11 -10
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -9,22 +9,17 @@ const defaultSettings = {
9
9
  width: 500,
10
10
  screenWidth:1920,
11
11
  screenHeight:1080,
12
+ wx_total : 3,
13
+ wy_total : 12,
12
14
  };
13
15
 
14
16
  function makeWinsArray(settings, ) {
15
17
  let winsArray = settings.winsArray || [];
16
- let {x,y,width, height, screenWidth, screenHeight} = settings;
18
+ let {x,y,width, height, screenWidth, screenHeight, wy_total, wx_total} = settings;
17
19
  const scr_sz = keysender.getScreenSize();
18
20
  if(!screenWidth) screenWidth = scr_sz.width;
19
21
  if(!screenHeight) screenHeight = scr_sz.height;
20
22
 
21
-
22
- // for(let i=0;i<1000;i++) {
23
- // y += settings.height;
24
- // winsArray.push({x,y, width, height});
25
- // }
26
- const wy_total = 10;
27
- const wx_total = 4;
28
23
  const wy_step = Math.round( screenHeight*1.0/wy_total);
29
24
  const wx_step = Math.round(screenWidth*1.0/wx_total);
30
25
  for(let wy = 0; wy<wy_total;wy++ ) {
@@ -71,6 +66,7 @@ module.exports.run = async ()=>{
71
66
  baz:{no_run:true, cmd:"my command line 2"},
72
67
  webstorm: {app:true, cmd:"C:\\Program Files\\JetBrains\\WebStorm 2019.2\\bin\\webstorm64.exe"},
73
68
  }
69
+ delay:0,
74
70
  }
75
71
 
76
72
  optionally create my_wins_personal.json to override any settings
@@ -136,7 +132,7 @@ module.exports.run = async ()=>{
136
132
  let winIndex = 0;
137
133
  for(let k in settings.wins) {
138
134
  const w = settings.wins[k];
139
- const {name, title, app, cmd, no_run} = w;
135
+ const {name, title, app, cmd, no_run, delay} = w;
140
136
 
141
137
  let win_info_candidates = wins.filter(c => c.title.includes(title));
142
138
  const win_info = win_info_candidates[0];
@@ -150,8 +146,13 @@ module.exports.run = async ()=>{
150
146
  win.workwindow.setForeground();
151
147
 
152
148
  win.keyboard.printText(cmd);
153
- if(!no_run)
149
+ await awaitDelay(200);
150
+ if(!no_run) {
151
+ if(delay) {
152
+ await awaitDelay(delay);
153
+ }
154
154
  win.keyboard.sendKey(13);
155
+ }
155
156
  await awaitDelay(300);
156
157
  }
157
158
  winIndex++;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "my_wins",
3
- "version": "1.1.4",
3
+ "version": "1.2.0",
4
4
  "description": "Automates starting and laying out your console windows for tsc, babel, tests, verdaccio, etc...",
5
5
  "keywords": ["automation","cmd","keysender","windows","autostart","autorun"],
6
6
  "main": "./index.js",