FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cpython/Mac/PythonLauncher/doscript.m at 3.9 · python/cpython · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
python
/
cpython
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
35.3k
Star
74.9k
Code
Issues
5k+
Pull requests
2.6k
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cpython
/
Mac
/
PythonLauncher
/
doscript.m
Copy path
More file actions
More file actions
Latest commit
History
History
History
59 lines (53 loc) · 1.68 KB
Breadcrumbs
cpython
/
Mac
/
PythonLauncher
/
doscript.m
Copy path
File metadata and controls
59 lines (53 loc) · 1.68 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* doscript.c
* PythonLauncher
*
* Created by Jack Jansen on Wed Jul 31 2002.
* Copyright (c) 2002 __MyCompanyName__. All rights reserved.
*
*/
#
import
<
Cocoa/Cocoa.h
>
#
import
<
ApplicationServices/ApplicationServices.h
>
#
import
"
doscript.h
"
extern
int
doscript
(
const
char
*command)
{
char
*bundleID =
"
com.apple.Terminal
"
;
AppleEvent evt, res;
AEDesc desc;
OSStatus err;
[[
NSWorkspace
sharedWorkspace
]
launchApplication:
@"
Terminal.app
"
];
//
Build event
err =
AEBuildAppleEvent
(
kAECoreSuite
,
kAEDoScript
,
typeApplicationBundleID,
bundleID,
strlen
(bundleID),
kAutoGenerateReturnID
,
kAnyTransactionID
,
&evt,
NULL
,
"
'----':utf8(@)
"
,
strlen
(command),
command);
if
(err) {
NSLog
(
@"
AEBuildAppleEvent failed:
%ld
\n
"
, (
long
)err);
return
err;
}
//
Send event and check for any Apple Event Manager errors
err =
AESendMessage
(&evt, &res,
kAEWaitReply
,
kAEDefaultTimeout
);
AEDisposeDesc
(&evt);
if
(err) {
NSLog
(
@"
AESendMessage failed:
%ld
\n
"
, (
long
)err);
return
err;
}
//
Check for any application errors
err =
AEGetParamDesc
(&res, keyErrorNumber, typeSInt32, &desc);
AEDisposeDesc
(&res);
if
(!err) {
AEGetDescData
(&desc, &err,
sizeof
(err));
NSLog
(
@"
Terminal returned an error:
%ld
"
, (
long
)err);
AEDisposeDesc
(&desc);
}
else
if
(err == errAEDescNotFound) {
err = noErr;
}
else
{
NSLog
(
@"
AEGetPArmDesc returned an error:
%ld
"
, (
long
)err);
}
return
err;
}
Back
|
FazBrowse Home
|
New Git URL