my_wins 1.2.0 → 1.2.1

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 +36 -9
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -129,7 +129,8 @@ module.exports.run = async ()=>{
129
129
  wins = keysender.getAllWindows();
130
130
  let winsArray = makeWinsArray(settings);
131
131
 
132
- let winIndex = 0;
132
+ const myWins = {};
133
+
133
134
  for(let k in settings.wins) {
134
135
  const w = settings.wins[k];
135
136
  const {name, title, app, cmd, no_run, delay} = w;
@@ -142,21 +143,47 @@ module.exports.run = async ()=>{
142
143
  console.warn(`CODE00000000 There are ${win_info_candidates.length} windows with title '${title}'. Only one window expected!`);
143
144
  else {
144
145
  const win = new keysender.Hardware(win_info.handle);
145
- win.workwindow.setView(winsArray[winIndex]);
146
- win.workwindow.setForeground();
146
+ w.win = win;
147
+ w.activate = ()=>{
148
+ win.workwindow.setView(winsArray[winIndex]);
149
+ win.workwindow.setForeground();
150
+ }
151
+ w.print = async (cmd) => {
152
+ await awaitDelay(200);
153
+ w.activate();
154
+ win.keyboard.printText(cmd);
155
+ await awaitDelay(200);
156
+ }
157
+
158
+ w.pressEnter = async () => {
159
+ w.activate();
160
+ win.keyboard.sendKey(13);
161
+ await awaitDelay(200);
162
+ }
163
+
164
+ await w.print(cmd);
165
+ // await awaitDelay(200);
166
+ // if(!no_run) {
167
+ // if(delay) {
168
+ // await awaitDelay(delay);
169
+ // }
170
+ // w.pressEnter();
171
+ // }
172
+ // await awaitDelay(300);
173
+ }
174
+ winIndex++;
175
+ }
147
176
 
148
- win.keyboard.printText(cmd);
149
- await awaitDelay(200);
177
+ for(let k in settings.wins) {
178
+ const w = settings.wins[k];
150
179
  if(!no_run) {
151
180
  if(delay) {
152
181
  await awaitDelay(delay);
153
182
  }
154
- win.keyboard.sendKey(13);
183
+ await w.pressEnter();
155
184
  }
156
- await awaitDelay(300);
157
185
  }
158
- winIndex++;
159
- }
186
+
160
187
 
161
188
  await awaitDelay(700);
162
189
  console.log(`my_wins finished successfully!`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "my_wins",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
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",