Пример #1
0
def mainframe_open_connection():
    dap_log_mainframe(LogLevel.DEBUG, "connecting to mainframe")

    global em
    #em = Emulator(visible=True)
    em = Emulator()
    em.connect(MainframeIP)
    mainframe_random_wait(
    )  # this is necessary because mainframe response time can vary, the delay is worth it

    dap_log_compliance(LogLevel.INFO, "mainframe connection established")

    dap_log_mainframe(LogLevel.DEBUG, "selecting mainframe application")
    em.fill_field(20, 21, 'B', 1)
    em.send_enter()
    mainframe_random_wait()
Пример #2
0
rn = int(rn)
now = datetime.now()
today = now.strftime("%m%d%Y")
currPwrd = 'dcfams03'
newPwrd = 'dcfams04'

while x <= y:
    em = Emulator(visible=False)
    em.connect('dcft.dcf.state.fl.us')
    usrId = 'A' + str(rn)
    usrId = ws1[usrId].value
    usrId = str(usrId)
    usrId = 'A' + usrId
    em.wait_for_field()
    em.send_string('flors2')
    em.send_enter()
    em.wait_for_field()
    em.fill_field(11, 36, usrId, 7)
    em.fill_field(12, 36, currPwrd, 8)
    em.fill_field(13, 61, newPwrd, 8)
    em.fill_field(14, 61, newPwrd, 8)
    em.send_enter()
    em.send_enter()
    em.send_enter()
    em.exec_command(b'PF(13)')
    em.send_enter()
    em.terminate()
    x += 1
    rn += 1
    print(rn)
Пример #3
0
y = input('Enter a number of records to process: ')
y = int(y)
rn = input('Enter row number to start from: ')
rn = int(rn)

now = datetime.now()
today = now.strftime("%m%d%Y")
usrId = 'fz0009'
pwrd = input('Enter the password for ' + usrId + ":")
em = Emulator(visible=False)
em.connect('dcft.dcf.state.fl.us')
em.wait_for_field()
em.send_string('flors2')
em.send_enter()
em.wait_for_field()
em.fill_field(11, 36, usrId, 7)
em.fill_field(12, 36, pwrd, 8)
em.send_enter()
em.send_enter()
em.wait_for_field()

#Build out Admin related variables here...
while x <= y:
    admin = 'C' + str(rn)
    admin = ws2[admin].value
    admin = str(admin)
    unit = admin
    dist = 'B' + str(rn)
    dist = ws2[dist].value
    dist = str(dist)
    newId = 'A' + str(rn)
def check_script():
    db = MySQLdb.connect(host=db_host, user=db_user, passwd=db_password, db=db_name)
    cur = db.cursor()  # placed here so that cur is initialized in case of KeyboardError
    em = Emulator()
    em.connect("bcvmcms.bc.edu")
    em.wait_for_field()
    em.fill_field(7, 46, uis_username, 9)
    em.fill_field(9, 46, uis_password, 15)
    em.send_enter()
    # em.fill_field(6, 44, '7', 4) #This is commented out for when BC changes the register page
    # em.send_enter()
    # em.fill_field(17, 34, '2', 1)
    # em.send_enter()
    em.fill_field(16, 22, "c", 1)
    em.send_enter()
    cur.execute("select * from checker_class")
    for row in cur.fetchall():
        try:
            # print(row[1][:8])
            # print(row[1][8:])
            em.fill_field(3, 24, "", 8)
            em.send_enter()
            em.fill_field(3, 24, row[1][:8], 8)
            em.send_enter()
            sleep(0.09)
            if not em.string_found(8, 19, "No Courses"):
                class_found = False
                i = 0
                page_turn = (int(row[1][8:]) - 1) / 16
                while page_turn != 0:
                    em.send_enter()
                    page_turn = page_turn - 1
                while class_found == False:
                    if em.string_found(8 + i, 15, row[1][8:]):
                        if em.string_found(8 + i, 68, "*CLOSED"):
                            print row[1], " is closed"
                            class_found = True
                            break
                        elif em.string_found(8 + i, 68, "*CANCEL"):
                            print row[1], " is cancelled"
                            class_found = True
                            break
                        else:
                            print row[1], " is open"
                            cur.execute(
                                "select * from cc.checker_class_students c, cc.checker_student s where class_id = "
                                + str(row[0])
                                + " and student_id = s.id"
                            )
                            notify_thread = threading.Thread(target=notify_students, args=(cur.fetchall(), row))
                            notify_thread.start()
                            cur.execute("delete from cc.checker_class_students where class_id = " + str(row[0]))
                            cur.execute("delete from cc.checker_class where id = " + str(row[0]))
                            class_found = True
                            break
                    i += 1
            else:
                print ("class not found")
        except Exception as e:
            print (e)
            continue
            # closing time
    cur.close()
    db.commit()
    em.fill_field(3, 24, "QUIT", 8)
    em.send_enter()
    em.fill_field(16, 22, "l", 1)
    em.send_enter()
    em.terminate()
    sleep(300)
Пример #5
0
 my3270.send_enter()
 my3270.wait_for_field()
 time.sleep(delayt)
 # Write down the clist
 my3270.exec_command(b"TAB")
 my3270.exec_command(b"TAB")
 my3270.exec_command(b"TAB")
 my3270.exec_command(b"TAB")
 my3270.send_string("PROC 0")
 my3270.exec_command(b"TAB")
 my3270.exec_command(b"TAB")
 my3270.send_string("WRITE HELLO WORLD!")
 my3270.exec_command(b"TAB")
 my3270.exec_command(b"TAB")
 my3270.send_string("Exit")
 my3270.fill_field(2, 15, 'SAVE', 8)
 my3270.send_enter()
 my3270.wait_for_field()
 time.sleep(delayt)
 #
 my3270.send_pf3()
 my3270.wait_for_field()
 time.sleep(delayt)
 #
 my3270.send_pf3()
 my3270.wait_for_field()
 time.sleep(delayt)
 # TSO command
 my3270.send_string("6")
 my3270.send_enter()
 my3270.wait_for_field()
Пример #6
0
rn = input('Enter row number to start from: ')
rn = int(rn)

now = datetime.now()
today = now.strftime("%m%d%Y")
#user details could be prompted for for, or included as kwargs if changed to a function.
usrId = 'fz0009'
pwrd = input('Enter the password for ' + usrId + ":")
#Emulator set to run in background, can change to True to debug if errors
em = Emulator(visible=False)
em.connect('dcft.dcf.state.fl.us')
em.wait_for_field()
em.send_string('flors2')
em.send_enter()
em.wait_for_field()
em.fill_field(11, 36, usrId, 7)
em.fill_field(12, 36, pwrd, 8)
em.send_enter()
em.send_enter()
em.wait_for_field()

#create Unit
while x <= y:
    #define variable set from Excel File
    em.fill_field(23, 13, 'CLSM', 4)
    admin = 'C' + str(rn)
    admin = ws2[admin].value
    admin = str(admin)
    unit = admin
    dist = 'B' + str(rn)
    dist = ws2[dist].value
Пример #7
0
y = input('Enter a number of records to process: ')
y = int(y)
rn = input('Enter row number to start from: ')
rn = int(rn)
now = datetime.now()
today = now.strftime("%m%d%Y")
usrId = 'fz0009'
pwrd = input('Enter the password for ' + usrId + ":")
ssnStart = 100000000
em = Emulator(visible=False)
em.connect('dcft.dcf.state.fl.us')
em.wait_for_field()
em.send_string('flors2')
em.send_enter()
em.wait_for_field()
em.fill_field(11, 36, usrId, 7)
em.fill_field(12, 36, pwrd, 8)
em.send_enter()
em.send_enter()
em.wait_for_field()

while x <= y:
    startNewId = 'A' + str(rn)
    startDist = 'B' + str(rn)
    startAdmin = 'C' + str(rn)
    startTypeInd = 'D' + str(rn)
    newId = ws1[startNewId].value
    newId = str(newId)
    dist = ws1[startDist].value
    dist = str(dist)
    admin = ws1[startAdmin].value
Пример #8
0
class Automation3270(object):
    '''Library for x3270 emulator automation. More information at http://x3270.bgp.nu/'''
    ROBOT_LIBRARY_SCOPE = 'GLOBAL'

    def Open_3270(self, hostname):
        '''Opens emulator. Provide the hostname as argument'''
        self.em = Emulator(visible=True)
        self.em.connect(str(hostname))

    def Open_New_3270(self):
        '''Closes all previous instances before starting'''
        self.process_name = 'wc3270.exe'
        self.get_pid = [
            self.item.split()[1]
            for self.item in os.popen('tasklist').read().splitlines()[4:]
            if self.process_name in self.item.split()
        ]
        if self.get_pid[0] == "":
            self.em = Emulator(visible=True)
            self.em.connect('prda.bcpcorp.net')
        else:
            print 'Program already open'

    def Close_3270(self):
        '''Closes emulator'''
        self.pid_proc = 'wc3270.exe'
        self.pid = [
            self.item.split()[1]
            for self.item in os.popen('tasklist').read().splitlines()[4:]
            if self.pid_proc in self.item.split()
        ]
        print "PID number is " + self.pid[0]
        os.kill(int(self.pid[0]), signal.SIGTERM)

    def Input_Text_on_Field(self, xpos, ypos, text):
        '''Writes text on field. Last parameters requires the lenght of the word'''
        self.em.fill_field(int(xpos), int(ypos), str(text), len(text) + 2)

    def Send_String(self, text, xpos, ypos):
        '''Verifies if a given string exists'''
        self.em.string_found(text, int(xpos), int(ypos))

    def Keyboard_State(self):
        '''If the keyboard is unlocked, the letter U. If the keyboard is locked waiting for a response from the host, or if not connected to a host, the letter L'''
        print self.em.status.keyboard.capitalize()

    def wait_For_Field(self):
        '''Waits for execution'''
        self.em.wait_for_field()

    def Execute_Command(self, command):
        '''Executes custom commands. See more a thttp://x3270.bgp.nu/x3270-script.html'''
        self.em.exec_command(self, command)

    def Connection_State(self):
        '''If connected to a host, the string C(hostname). Otherwise, the letter N'''
        print self.em.status.connection_state.capitalize()

    def Get_String(self, xpos, ypos, lenght):
        '''Get String based on coordinates and lenght'''
        get_text = self.em.string_get(int(xpos), int(ypos), int(lenght))
        return get_text

    def Press_Enter(self):
        '''Presses Enter key'''
        self.em.send_enter()

    def Move_cursor(self, xpos, ypos):
        '''Moves cursor to specified coordinates'''
        self.em.move_to(xpos, ypos)

    def Take_Screenshot(self):
        '''Takes printscreen'''
        self.em.save_screen()

    def Pause_Test(self):
        '''Pauses Test at a given moment'''
        self.em.app.readline()

    def Send_F3(self):
        '''Simulates F3 key'''
        self.em.send_pf3()

    def Send_F4(self):
        '''Simulates F4 key'''
        self.em.send_pf4()

    def Send_F5(self):
        '''Simulates F5 key'''
        self.em.send_pf5()

    def Send_F6(self):
        '''Simulates F6 key'''
        self.em.send_pf6()

    def Send_F7(self):
        '''Simulates F7 key'''
        self.em.send_pf7()

    def Send_F8(self):
        '''Simulates F8 key'''
        self.em.send_pf8()
Пример #9
0
y= int(y)
rn = input('Enter row number to start from: ')
rn = int(rn)


now = datetime.now()
today = now.strftime("%m%d%Y")
usrId = 'fz0009'
pwrd = input('Enter the password for ' + usrId +":")
em = Emulator(visible=False)
em.connect('dcft.dcf.state.fl.us')
em.wait_for_field()
em.send_string('flors2')
em.send_enter()
em.wait_for_field()
em.fill_field(11, 36, usrId, 7)
em.fill_field(12, 36, pwrd, 8)
em.send_enter()
em.send_enter()
em.wait_for_field()

#start building caseloads for the user
while x <= y:

    em.fill_field(23, 13, 'CLCM', 4)
    admin = 'C' + str(rn)
    admin = ws1[admin].value
    admin = str(admin)
    unit = admin
    dist = 'B' + str(rn)
    dist = ws1[dist].value