@@ -15,6 +15,7 @@ using namespace v8;
15
15
| |\/| |/ _ \| | | / __|/ _ \
16
16
| | | | (_) | |_| \__ \ __/
17
17
|_| |_|\___/ \__,_|___/\___|
18
+
18
19
*/
19
20
20
21
Handle <Value> moveMouse (const Arguments& args)
@@ -107,7 +108,15 @@ Handle<Value> typeString(const Arguments& args)
107
108
return scope.Close (String::New (" 1" ));
108
109
}
109
110
110
- // Screen
111
+ /*
112
+ _____
113
+ / ____|
114
+ | (___ ___ _ __ ___ ___ _ __
115
+ \___ \ / __| '__/ _ \/ _ \ '_ \
116
+ ____) | (__| | | __/ __/ | | |
117
+ |_____/ \___|_| \___|\___|_| |_|
118
+
119
+ */
111
120
112
121
Handle <Value> captureScreen (const Arguments& args)
113
122
{
@@ -126,43 +135,6 @@ Handle<Value> captureScreen(const Arguments& args)
126
135
// return scope.Close(String::New("1"));
127
136
}
128
137
129
- Handle <Value> getWindows (const Arguments& args)
130
- {
131
- HandleScope scope;
132
-
133
- CFArrayRef windowList = CGWindowListCopyWindowInfo (kCGWindowListOptionOnScreenOnly , kCGNullWindowID );
134
- CFIndex windowNum = CFArrayGetCount (windowList);
135
-
136
- std::vector<Object> windows;
137
- Local<Object> obj = Object::New ();
138
-
139
-
140
- for (int i = 0 ; i < (int )windowNum; i++)
141
- {
142
- CFDictionaryRef info = (CFDictionaryRef )CFArrayGetValueAtIndex (windowList, i);
143
- CFNumberRef currentPID = (CFNumberRef )CFDictionaryGetValue (info, kCGWindowOwnerPID );
144
- CFNumberRef currentWindowNumber = (CFNumberRef )CFDictionaryGetValue (info, kCGWindowNumber );
145
- CFStringRef currentTitle = (CFStringRef )CFDictionaryGetValue (info, kCGWindowName );
146
- CFIndex length = CFStringGetLength (currentTitle);
147
- CFIndex maxSize = CFStringGetMaximumSizeForEncoding (length, kCFStringEncodingUTF8 );
148
- char *buffer = (char *)malloc (maxSize);
149
- CFStringGetCString (currentTitle, buffer, maxSize, kCFStringEncodingUTF8 );
150
- obj->Set (String::NewSymbol (" title" ), String::New (buffer));
151
- obj->Set (String::NewSymbol (" id" ), Number::New (*(int *)currentWindowNumber));
152
- printf (buffer);
153
- printf (" \n " );
154
- // windows.push_back(obj);
155
-
156
- }
157
-
158
-
159
-
160
- // return scope.Close(String::New("1"));
161
-
162
- return scope.Close (String::New (" 1" ));
163
- }
164
-
165
-
166
138
void init (Handle <Object> target)
167
139
{
168
140
target->Set (String::NewSymbol (" moveMouse" ),
@@ -182,9 +154,6 @@ void init(Handle<Object> target)
182
154
183
155
target->Set (String::NewSymbol (" captureScreen" ),
184
156
FunctionTemplate::New (captureScreen)->GetFunction ());
185
-
186
- target->Set (String::NewSymbol (" getWindows" ),
187
- FunctionTemplate::New (getWindows)->GetFunction ());
188
157
}
189
158
190
159
NODE_MODULE (robotjs, init)
0 commit comments