-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathOpenConsole.py
59 lines (49 loc) · 1.73 KB
/
OpenConsole.py
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
#######################################################################################################################
# Licensed Materials –Property of HCL Technologies Ltd.
# © Copyright HCL Technologies Ltd. 2022.
# All rights reserved. See product license for details. US Government Users Restricted Rights. Use, duplication,
# or disclosure restricted by GSA ADP Schedule Contract with HCL Technologies Ltd. Java and all Java-based trademarks
# and logos are trademarks or registered trademarks of Oracle and/or its affiliates. HCL, the HCL logo,
# and Tivoli are registered trademarks of HCL Technologies in the United States, other countries, or both.
#######################################################################################################################
import sys
# make IDLE run in the same process:
sys.argv.append('-n')
# set IDLE window title:
sys.argv.append('-t')
sys.argv.append('Pyscan')
# PyShell user might do things which change sys.argv.
# make a copy of sys.argv, so we can restore it later
origArgv = [x for x in sys.argv]
# set working dir:
try:
import os
wd = os.environ['UserProfile']
os.chdir(wd)
os.chdir("My Documents")
os.chdir("AppScan")
except:
pass
# set appScan variable:
import clr
from clr import System
from clr import AppScan
from clr import DBAdapter
from clr import Utilities
appScan = clr.AppScan.AppScanFactory.CreateInstance()
# main loop: open IDLE window:
from idlelib import pyshell
from time import sleep
from clr import PyScan
done = 0
while done == 0:
#restore orig sys.argv:
sys.argv = [x for x in origArgv]
pyshell.main()
clr.PyScan.PyScanAction.Set(0)
# wait for env var to change:
while 1:
sleep(1.5)
val = clr.PyScan.PyScanAction.Get()
if val == 1:
break