Пример #1
0
    def testGetattr(self):
        "Test that __getattr__() works correctly"
        app = Application()
        app.start(_notepad_exe())

        #prev_timeout = application.window_find_timeout
        #application.window_find_timeout = .1
        self.assertRaises(
            findbestmatch.MatchError,
            app.blahblah.__getattr__, 'handle')

        self.assertEqual(
            app.UntitledNotepad.handle,
            app.window_(title = "Untitled - Notepad").handle)

        app.UntitledNotepad.MenuSelect("Help->About Notepad")

        # I think it's OK that this no longer raises a matcherror
        # just because the window is not enabled - doesn't mean you
        # should not be able to access it at all!
        #self.assertRaises(findbestmatch.MatchError,
        #    app.Notepad.__getattr__, 'handle')

        self.assertEqual(
            app.AboutNotepad.handle,
            app.window_(title = "About Notepad").handle)

        app.AboutNotepad.Ok.Click()
        app.UntitledNotepad.MenuSelect("File->Exit")
Пример #2
0
    def testGetitem(self):
        "Test that __getitem__() works correctly"
        app = Application()
        app.start(_notepad_exe())

        try:
            app['blahblah']
        except Exception:
            pass


        #prev_timeout = application.window_find_timeout
        #application.window_find_timeout = .1
        self.assertRaises(
            findbestmatch.MatchError,
            app['blahblah']['not here'].__getitem__, 'handle')

        self.assertEqual(
            app[u'Unt\xeftledNotepad'].handle,
            app.window_(title = "Untitled - Notepad").handle)

        app.UntitledNotepad.MenuSelect("Help->About Notepad")

        self.assertEqual(
            app['AboutNotepad'].handle,
            app.window_(title = "About Notepad").handle)

        app.AboutNotepad.Ok.Click()
        app.UntitledNotepad.MenuSelect("File->Exit")
Пример #3
0
    def test_getattribute(self):
        """Test that __getattribute__() works correctly"""
        app = Application()
        app.start(_notepad_exe())

        self.assertRaises(
            findbestmatch.MatchError,
            app.blahblah.__getattribute__, 'handle')

        self.assertEqual(
            app.UntitledNotepad.handle,
            app.window_(title = "Untitled - Notepad").handle)

        app.UntitledNotepad.MenuSelect("Help->About Notepad")

        # I think it's OK that this no longer raises a matcherror
        # just because the window is not enabled - doesn't mean you
        # should not be able to access it at all!
        #self.assertRaises(findbestmatch.MatchError,
        #    app.Notepad.__getattribute__, 'handle')

        self.assertEqual(
            app.AboutNotepad.handle,
            app.window_(title = "About Notepad").handle)

        app.AboutNotepad.Ok.Click()
        app.UntitledNotepad.MenuSelect("File->Exit")
Пример #4
0
 def run(self):
     print("Auto Login Start")
     time.sleep(3)
     #C:\Users\Administrator\git\haedong\Haedong\Haedong\module\
     PROCNAME = "kfopcomms.exe"
     haedongPid = 0
     
     for proc in psutil.process_iter():
         if proc.name() == PROCNAME:
             print(proc.pid)
             haedongPid = proc.pid 
     
     
     app = Application().connect(process = haedongPid)
     
     title = "영웅문W Login"
     dlg = timings.WaitUntilPasses(20, 0.5, lambda: app.window_(title=title))
     
     pass_ctrl = dlg.Edit2
     pass_ctrl.SetFocus()
     pass_ctrl.TypeKeys('khj1342')
     
     pass_ctrl = dlg.Edit3
     pass_ctrl.SetFocus()
     pass_ctrl.TypeKeys('godqhr134@')
     
     btn_ctrl = dlg.Button0
     btn_ctrl.Click()
     
     self._stop()
Пример #5
0
def end_game_macro(save_a_qued_replay: bool):
    app = Application()
    app.connect(title_re='Rocket League.*')
    win = app.window_(title_re='Rocket League.*')
    for cmd in ["{ESC}", "{VK_UP}", "{ENTER}", "{VK_LEFT}", "{ENTER}"]:
        win.type_keys(cmd)
        time.sleep(0.1)
    if save_a_qued_replay:
        win.type_keys("{ENTER}")
Пример #6
0
def OnMouseEvent(event):
    global last_event_time
    # if this is the first action - remember the start time of the script
    if not last_event_time:
        last_event_time = event.Time
    app = Application()

    # wrap the window that is coming from the event
    if event.Window:
        wrapped = app.window_(handle = event.Window)
    else:
        wrapped = None

    # if there was no previous message
    global last_message
    if last_message is None:
        last_message = event.MessageName
        return True


    # get the button pressed
    button = ""
    if "right" in event.MessageName and "right" in last_message:
        button = "Right"
    elif "left" in event.MessageName and "left" in last_message:
        button = "Left"

    toplevel = ""
    if wrapped and not wrapped.IsDialog():
        toplevel = '.Window_(title = "%s", class_name = "%s")' %(
            wrapped.TopLevelParent().window_text(), wrapped.TopLevelParent().class_name())

    if "up" in event.MessageName and "down" in last_message:
        print "time.sleep(%d)"% (event.Time - last_event_time)
        print 'app%s.Window_(title = "%s", class_name = "%s").%sClickInput()'%(
            toplevel,
            wrapped.WindowText(),
            wrapped.Class(),
            button)

    last_event_time = event.Time
    last_message = event.MessageName


  # called when mouse events are received
  #print 'MessageName:',event.MessageName
#  print 'Message:',event.Message
#  print 'Time:',event.Time
  #print 'Window:',event.Window
#  print 'WindowName:',event.WindowName
#  print 'Position:',event.Position
#  print 'Wheel:',event.Wheel
#  print 'Injected:',event.Injected
#  print '---'

  # return True to pass the event to other handlers
    return True
Пример #7
0
 def firefox(self):
     try:
         app = Application()
         app.connect_(title_re='.*Mozilla Firefox')
         firefox = app.window_(title_re='.*Mozilla Firefox')
         firefox.TypeKeys('{F5}')
         if self.is64bit:
             self.TypeKeys64()
     except WindowNotFoundError:
         pass
Пример #8
0
 def iron(self):
     try:
         app = Application()
         app.connect_(title_re='.*- Iron')
         iron = app.window_(title_re='.*- Iron')
         iron.TypeKeys('{F5}')
         if self.is64bit:
             self.TypeKeys64()
     except WindowNotFoundError:
         pass
Пример #9
0
 def chrome(self):
     try:
         app = Application()
         app.connect_(title_re='.*- Google Chrome')
         chrome = app.window_(title_re='.*- Google Chrome')
         chrome.TypeKeys('{F5}')
         if self.is64bit:
             self.TypeKeys64()
     except WindowNotFoundError:
         pass
Пример #10
0
 def opera(self):
     try:
         app = Application()
         app.connect_(title_re='.*Opera')
         ie = app.window_(title_re='.*Opera')
         ie.TypeKeys('{F5}')
         if self.is64bit:
             self.TypeKeys64()
     except WindowNotFoundError:
         pass
Пример #11
0
 def iron(self):
     try:
         app = Application()
         app.connect_(title_re='.*- Iron')
         iron = app.window_(title_re='.*- Iron')
         iron.TypeKeys('{F5}')
         if self.is64bit:
             self.TypeKeys64()
     except WindowNotFoundError:
         pass
Пример #12
0
 def ie(self):
     try:
         app = Application()
         app.connect_(title_re='.*Internet Explorer')
         ie = app.window_(title_re='.*Internet Explorer')
         ie.TypeKeys('{F5}')
         if self.is64bit:
             self.TypeKeys64()
     except WindowNotFoundError:
         pass
Пример #13
0
 def ie(self):
     try:
         app = Application()
         app.connect_(title_re='.*Internet Explorer')
         ie = app.window_(title_re='.*Internet Explorer')
         ie.TypeKeys('{F5}')
         if self.is64bit:
             self.TypeKeys64()
     except WindowNotFoundError:
         pass
Пример #14
0
 def chrome(self):
     try:
         app = Application()
         app.connect_(title_re='.*- Google Chrome')
         chrome = app.window_(title_re='.*- Google Chrome')
         chrome.TypeKeys('{F5}')
         if self.is64bit:
             self.TypeKeys64()
     except WindowNotFoundError:
         pass
Пример #15
0
 def opera(self):
     try:
         app = Application()
         app.connect_(title_re='.*Opera')
         ie = app.window_(title_re='.*Opera')
         ie.TypeKeys('{F5}')
         if self.is64bit:
             self.TypeKeys64()
     except WindowNotFoundError:
         pass
Пример #16
0
 def firefox(self):
     try:
         app = Application()
         app.connect_(title_re='.*Mozilla Firefox')
         firefox = app.window_(title_re='.*Mozilla Firefox')
         firefox.TypeKeys('{F5}')
         if self.is64bit:
             self.TypeKeys64()
     except WindowNotFoundError:
         pass
Пример #17
0
def OnMouseEvent(event):
    global last_event_time
    # if this is the first action - remember the start time of the script
    if not last_event_time:
        last_event_time = event.Time
    app = Application()

    # wrap the window that is coming from the event
    if event.Window:
        wrapped = app.window_(handle=event.Window)
    else:
        wrapped = None

    # if there was no previous message
    global last_message
    if last_message is None:
        last_message = event.MessageName
        return True

    # get the button pressed
    button = ""
    if "right" in event.MessageName and "right" in last_message:
        button = "Right"
    elif "left" in event.MessageName and "left" in last_message:
        button = "Left"

    toplevel = ""
    if wrapped and not wrapped.IsDialog():
        toplevel = '.Window_(title = "%s", class_name = "%s")' % (
            wrapped.TopLevelParent().WindowText(),
            wrapped.TopLevelParent().Class())

    if "up" in event.MessageName and "down" in last_message:
        print "time.sleep(%d)" % (event.Time - last_event_time)
        print 'app%s.Window_(title = "%s", class_name = "%s").%sClickInput()' % (
            toplevel, wrapped.WindowText(), wrapped.Class(), button)

    last_event_time = event.Time
    last_message = event.MessageName

    # called when mouse events are received
    #print 'MessageName:',event.MessageName
    #  print 'Message:',event.Message
    #  print 'Time:',event.Time
    #print 'Window:',event.Window
    #  print 'WindowName:',event.WindowName
    #  print 'Position:',event.Position
    #  print 'Wheel:',event.Wheel
    #  print 'Injected:',event.Injected
    #  print '---'

    # return True to pass the event to other handlers
    return True
Пример #18
0
    def test_window(self):
        """Test that window_() works correctly"""
        app = Application()

        self.assertRaises(AppNotConnected, app.window_,
                          **{'title': 'not connected'})

        app.start(_notepad_exe())

        self.assertRaises(ValueError, app.windows_, **{'backend': 'uia'})

        title = app.window_(title="Untitled - Notepad")
        title_re = app.window_(title_re="Untitled[ -]+Notepad")
        classname = app.window_(class_name="Notepad")
        classname_re = app.window_(class_name_re="Not..ad")
        handle = app.window_(handle=title.handle)
        bestmatch = app.window_(best_match="Untiotled Notepad")

        self.assertNotEqual(title.handle, None)
        self.assertNotEqual(title.handle, 0)

        self.assertEqual(title.handle, title_re.handle)
        self.assertEqual(title.handle, classname.handle)
        self.assertEqual(title.handle, classname_re.handle)
        self.assertEqual(title.handle, handle.handle)
        self.assertEqual(title.handle, bestmatch.handle)

        app.UntitledNotepad.MenuSelect("File->Exit")
Пример #19
0
    def test_window(self):
        """Test that window_() works correctly"""
        app = Application()

        self.assertRaises(AppNotConnected, app.window_, **{'title' : 'not connected'})

        app.start(_notepad_exe())

        self.assertRaises(ValueError, app.windows_, **{'backend' : 'uia'})

        title = app.window_(title = "Untitled - Notepad")
        title_re = app.window_(title_re = "Untitled[ -]+Notepad")
        classname = app.window_(class_name = "Notepad")
        classname_re = app.window_(class_name_re = "Not..ad")
        handle = app.window_(handle = title.handle)
        bestmatch = app.window_(best_match = "Untiotled Notepad")

        self.assertNotEqual(title.handle, None)
        self.assertNotEqual(title.handle, 0)

        self.assertEqual(title.handle, title_re.handle)
        self.assertEqual(title.handle, classname.handle)
        self.assertEqual(title.handle, classname_re.handle)
        self.assertEqual(title.handle, handle.handle)
        self.assertEqual(title.handle, bestmatch.handle)

        app.UntitledNotepad.MenuSelect("File->Exit")
Пример #20
0
def upload_file(file):			
	
	app = Application()
	time.sleep(2)
	w_handle = pywinauto.findwindows.find_windows(title='Выгрузка файла', class_name='#32770')[0]
	window = app.window_(handle=w_handle)
	window.Wait('ready')
	edit = window.Edit
	edit.Select().TypeKeys(file.replace(' ', '{SPACE}'))
	time.sleep(2)
	button = window.Button
	button.ClickInput()
	time.sleep(2)
Пример #21
0
def OnKeyboardEvent(event):
    global last_event_time

    # if this is the first action - remember the start time of the script
    if not last_event_time:
        last_event_time = event.Time

    #print dir(event)

    app = Application()

    if event.Window:
        wrapped = app.window_(handle = event.Window)
    else:
        pass

    global last_message
    if last_message is None:
        last_message = event.MessageName
        return True

    if "down" in event.MessageName:
        print "time.sleep(%d)"% (event.Time - last_event_time)
        print 'app.Window_(title = "%s", class_name = "%s").Typekeys("%s")'%(
            wrapped.window_text(),
            wrapped.class_name(),
            `event.Key`)

    last_event_time = event.Time
    print 'MessageName:',event.MessageName


#  print 'Message:',event.Message
#  print 'Time:',event.Time
#  print 'Window:',event.Window
#  print 'WindowName:',event.WindowName
    win = event.WindowName
#  print 'Ascii:', event.Ascii, chr(event.Ascii)
#  print 'Key:', event.Key
#  print 'KeyID:', event.KeyID
#  print 'ScanCode:', event.ScanCode
#  print 'Extended:', event.Extended
#  print 'Injected:', event.Injected
#  print 'Alt', event.Alt
#  print 'Transition', event.Transition
#  print '---'

  # return True to pass the event to other handlers
    return True
Пример #22
0
def OnKeyboardEvent(event):
    global last_event_time

    # if this is the first action - remember the start time of the script
    if not last_event_time:
        last_event_time = event.Time

    #print dir(event)

    app = Application()

    if event.Window:
        wrapped = app.window_(handle=event.Window)
    else:
        pass

    global last_message
    if last_message is None:
        last_message = event.MessageName
        return True

    if "down" in event.MessageName:
        print "time.sleep(%d)" % (event.Time - last_event_time)
        print 'app.Window_(title = "%s", class_name = "%s").Typekeys("%s")' % (
            wrapped.WindowText(), wrapped.Class(), ` event.Key `)

    last_event_time = event.Time
    print 'MessageName:', event.MessageName

    #  print 'Message:',event.Message
    #  print 'Time:',event.Time
    #  print 'Window:',event.Window
    #  print 'WindowName:',event.WindowName
    win = event.WindowName
    #  print 'Ascii:', event.Ascii, chr(event.Ascii)
    #  print 'Key:', event.Key
    #  print 'KeyID:', event.KeyID
    #  print 'ScanCode:', event.ScanCode
    #  print 'Extended:', event.Extended
    #  print 'Injected:', event.Injected
    #  print 'Alt', event.Alt
    #  print 'Transition', event.Transition
    #  print '---'

    # return True to pass the event to other handlers
    return True
 def select_profile(self, user_profile):
     autoit.win_wait('[REGEXPTITLE:rofil]')
     autoit.win_activate('[REGEXPTITLE:rofil]')
     select_profile_app = Application().Connect(path='PowerExpress.exe')
     select_profile_window = select_profile_app.window_(title_re=u'.*rofil')
     # select_profile_window = select_profile_app.top_window_()
     select_profile_window_list_box = select_profile_window.ListBox
     select_profile_window_list_box.Select(user_profile)
     select_profile_ok_button = select_profile_window.OK
     select_profile_ok_button.Click()
     BuiltIn().set_suite_variable('${user_profile}', user_profile)
     time.sleep(2)
     try:
         if autoit.control_command('Power Express', '[NAME:YesBtn]',
                                   'IsVisible'):
             autoit.control_click('Power Express', '[NAME:YesBtn]')
     except Exception:
         pass
Пример #24
0
    def testClickCustomizeButton(self):
        "Test click on the 'show hidden icons' button"

        # Minimize to tray
        self.dlg.Minimize()
        _wait_minimized(self.dlg)

        # Make sure that the hidden icons area is enabled
        orig_hid_state = _toggle_notification_area_icons(show_all=False,
                                                         debug_img="%s_01" %
                                                         (self.id()))

        # Run one more instance of the sample app
        # hopefully one of the icons moves into the hidden area
        app2 = Application()
        app2.start(os.path.join(mfc_samples_folder, u"TrayMenu.exe"))
        dlg2 = app2.top_window()
        dlg2.Wait('visible', timeout=self.tm)
        dlg2.Minimize()
        _wait_minimized(dlg2)

        # Test click on "Show Hidden Icons" button
        taskbar.ShowHiddenIconsButton.click_input()
        niow_dlg = taskbar.explorer_app.Window_(
            class_name='NotifyIconOverflowWindow')
        niow_dlg.OverflowNotificationAreaToolbar.Wait('ready', timeout=self.tm)
        niow_dlg.SysLink.click_input()

        tmp_app = Application().connect(path="explorer.exe")
        nai = tmp_app.window_(title="Notification Area Icons",
                              class_name="CabinetWClass")
        nai.draw_outline()
        origAlwaysShow = nai.CheckBox.GetCheckState()
        if not origAlwaysShow:
            nai.CheckBox.click_input()
        nai.OK.Click()

        # Restore Notification Area settings
        _toggle_notification_area_icons(show_all=orig_hid_state,
                                        debug_img="%s_02" % (self.id()))

        # close the second sample app
        dlg2.SendMessage(win32defines.WM_CLOSE)
Пример #25
0
class QXDM(AppBase):
    def __init__(self, qxdmPath, qxdmProcess=None, qxdmHandle=None):
        super(QXDM, self).__init__(qxdmPath, qxdmProcess, qxdmHandle)

    def _startApp(self):
        try:
            self._app = Application().Start(self._appPath)
            return True
        except Exception:
            logging.warning("Start QXDM Fail!")
            return False

    def _connectApp(self):
        try:
            self._app = Application().Connect(process=self._appProcess,
                                              handle=self._appHandle,
                                              path=self._appPath)
            return True
        except Exception:
            logging.warning("Connect QXDM Fail")
            return False

    def _findCommandWindow(self):
        return self._app.window_(title_re="QXDM").window_(class_name=u"Edit",
                                                          control_id=0x3E9)

    def sendCommand(self, command):
        try:
            commandWindow = self._findCommandWindow()
        except Exception:
            logging.info("QXDM Find Window Error:{0}".format(Exception))
            return False
        try:
            commandWindow.TypeKeys(command if re.search(r'.*~^', command) else
                                   (command + '~'))
        except Exception:
            logging.info("QXDM COMMAND ERROR:{0}".format(Exception))
            return False
Пример #26
0
    def testWindow(self):
        "Test that window_() works correctly"

        app = Application()
        app.start(_notepad_exe())

        title = app.window_(title = "Untitled - Notepad")
        title_re = app.window_(title_re = "Untitled[ -]+Notepad")
        classname = app.window_(class_name = "Notepad")
        classname_re = app.window_(class_name_re = "Not..ad")
        handle = app.window_(handle = title.handle)
        bestmatch = app.window_(best_match = "Untiotled Notepad")

        self.assertNotEqual(title.handle, None)
        self.assertNotEqual(title.handle, 0)

        self.assertEqual(title.handle, title_re.handle)
        self.assertEqual(title.handle, classname.handle)
        self.assertEqual(title.handle, classname_re.handle)
        self.assertEqual(title.handle, handle.handle)
        self.assertEqual(title.handle, bestmatch.handle)

        app.UntitledNotepad.MenuSelect("File->Exit")
Пример #27
0
# from __future__ import unicode_literals
# from __future__ import print_function

# from pywinauto import application
# from pywinauto.application import Application
# app = Application().start("calc.exe")

# app.Caculator.print_control_identifiers()
# app.Caculator.Button5.ClickInput();




from __future__ import unicode_literals
from __future__ import print_function

from pywinauto import application
from pywinauto.application import Application
app = Application().start(r"D:\data\software\control-panel-sw\control-panel-sw\bin\Xpanel64.exe")
win = app.window_(title_re = ".*XPanel")
win.print_control_identifiers();

win.MenuSelect("Help->About")
app.dialogs.print_control_identifiers();
# win.Dialog.About.OK.Click();

# app.Caculator.print_control_identifiers()
# app.Caculator.Button5.ClickInput();
Пример #28
0
from pywinauto.application import Application
from pywinauto import keyboard, mouse
import time


app = Application().start("C:/Users/Tarek/Desktop/BN cephalo/NNTViewer.exe")
time.sleep(1)
keyboard.SendKeys('{DOWN}')
time.sleep(0.3)
keyboard.SendKeys('{ENTER}')
time.sleep(1.5)
mouse.click(button='left', coords=(100, 400))
time.sleep(0.3)
app.window_(title_re = "iRYS*").MenuSelect("Dossier->Enregistrer l'image sous")
mouse.click(button='left', coords=(300, 400))
time.sleep(0.5)
keyboard.SendKeys('%t')
time.sleep(0.3)
keyboard.SendKeys('{DOWN}')
time.sleep(0.3)
keyboard.SendKeys('{DOWN}')
time.sleep(0.3)
keyboard.SendKeys('{ENTER}')
time.sleep(0.3)
keyboard.SendKeys('{ENTER}')
time.sleep(1.5)
keyboard.SendKeys('%{F4}')
Пример #29
0
print __doc__

import time
from pprint import pprint

from pywinauto.application import Application

# start the application and wait for the Agent Dialog to be ready
app = Application().start_(r"c:\program files\agent\agent.exe")

while not app.Windows_():
    time.sleep(.5)

# if the trial nag dialog pops up
if app.window_(title="Forte Agent Trial").Exists():
    #app.ForteAgentTrial.IdLikeToContinueUsingAgentfor7moredays.Click()
    app.ForteAgentTrial.IdliketouseFreeAgent
    app.ForteAgentTrial.OK.Click()

if app.window_(title="Free Agent Registration").Exists():
    app.FreeAgentRegistration.ImreallybusyRemindmein30.Click()
    app.FreeAgentRegistration.OK.CloseClick()

if app.window_(title="What's New Reminder").Exists():
    app.WhatsNewReminder.ImreallybusyRemindmein90.Click()
    app.WhatsNewReminder.OK.CloseClick()

# wait until the app is ready
app.FreeAgent.Wait("ready")
Пример #30
0
from pywinauto.application import Application
from pywinauto import timings

app = Application().start(
    "C:\\projects\\foo-rpc\\portable_test\\foobar2000.exe /config")
quick_config = timings.WaitUntilPasses(
    3, 0.5, lambda: app.window_(title='Quick Appearance Setup'))
quick_config.Close()

window = app.top_window_()['Tree2']
playback = window.GetItem('\\Playback')
playback.Expand()
output = playback.GetChild('Output')
output.Select()
output_page = app.top_window_()
output_page['ComboBox'].Select('Null Output')
output_page['OK'].Click()
Пример #31
0
    def RunTestTool(self, year, quarter, sleeptime):
      
        Timings.Defaults()
        app = Application()
        try:
            app.connect_(title_re = ".*a.*")
            sys.stderr.write ( 'connected to window '+'\n')
        except:
            import sys, string, os
            app.start_('C:\\MYP\\Python\\start.bat')
            time.sleep(5)
            app.connect_(title_re = ".*a.*")
            sys.stderr.write ( 'connected to window '+'\n')
        app.connect_(title_re = ".*a.*")
      
        app.top_window_().Restore()
        Timings.Fast()
        window = app.window_(process=18000)
        window.SetFocus()
        time.sleep(5)
        app.top_window_().Click()
        time.sleep(5)
        #window.TypeKeys("{TAB 2}")
        window.TypeKeys("{RIGHT 2}")
        window.TypeKeys("{TAB 4}")
        sys.stderr.write ( 'tabbing completed'+'\n')
        dict =  app.top_window_()._ctrl_identifiers()
        print dict
        for k,v  in dict.items():
            #print v
            for v1 in v:
                if (v1==u'a'):
                    print k.handle
                    #k.Click()



        app.top_window_().YearComboxBox.Select(year)


        #app.top_window_().ComboBox7.Select("a")
        app.top_window_()['a'].Click()

        sys.stderr.write ( 'Setting Options and Clicked'+'\n')
       
        print app.top_window_().PopulationComboBox1.ItemTexts()
        measures= []
        measures = app.top_window_().PopulationComboBox1.ItemTexts()
        print measures
        mmap= {

                'a':['b'],
             
            }

        #from collections import OrderedDict
        #mmap1={}
        #mmap1=OrderedDict((mmap[key], True) for key in mmap)
        measures=mmap.keys()
        measures.sort()
        s=''
        s1=''
        dictErrors ={}
        i=0
        previousError=''
        previousSkip=''
        for measure in measures:
            i=i+1
            #if(i==6):
                #break
            print 'using '
            print measure
            indicators=[]
            indicators=mmap[measure]

            if not measure == '': # Change the not operator if you want to run it for all cases in one go.
                app.top_window_().PopulationComboBox1.Select(measure)
                #indicators= app.top_window_().IndicatorComboBox3.ItemTexts()
                for indicator in indicators:
                    if indicator == '':
                        continue
                    app.top_window_().IndicatorComboBox3.Select(indicator)
                    app.top_window_()['Create and Run TestsButton'].Click()
                    #app.top_window_()['Create and Run TestsButton'].Click()
                    #time.sleep(12)

                    while(True):
                        time.sleep(1)
                        times_Run = app.top_window_()['Testing:Edit'].Texts()[0].strip(" ").split()[0]
                        if(times_Run=='00100'):
                            s1=app.top_window_()['Skip Logic ErrorsEdit2'].Texts()[0].strip(" ")
                            s = app.top_window_()['Measure Engine ErrorsEdit2'].Texts()[0].strip(" ")
                            print s
                            print s1
                            break



                #print dictErrors
        sleeptime = 30
        errors=''



        time.sleep(sleeptime)
        sys.stderr.write ( 'Slept for '+str(sleeptime)+'\n')
        #print s+s1

        #s1 = app.top_window_()['Skip Logic ErrorsEdit2'].Texts()[0]
        #s = app.top_window_()['Measure Engine ErrorsEdit2'].Texts()[0]
        print errors
        print dictErrors
        if(errors != '' ):
            raise AssertionError(errors)
            app.start_('C:\\MYP\\Python\\stop.bat')
        print 'reached3'

        #MayNotWork app.kill()
        app.start_('C:\\MYP\\Python\\stop.bat')
        sys.stderr.write ( 'All done')
Пример #32
0
def hide_rendering_macro():
    app = Application()
    app.connect(title_re='Rocket League.*')
    win = app.window_(title_re='Rocket League.*')
    win.type_keys("{PGDN down}" "{PGDN up}")
Пример #33
0
print __doc__

import time
from pprint import pprint

from pywinauto.application import Application

# start the application and wait for the Agent Dialog to be ready
app = Application().start_(r"c:\program files\agent\agent.exe")

while not app.Windows_():
    time.sleep(.5)

# if the trial nag dialog pops up
if app.window_(title = "Forte Agent Trial").Exists():
    #app.ForteAgentTrial.IdLikeToContinueUsingAgentfor7moredays.Click()
    app.ForteAgentTrial.IdliketouseFreeAgent
    app.ForteAgentTrial.OK.Click()

if app.window_(title = "Free Agent Registration").Exists():
    app.FreeAgentRegistration.ImreallybusyRemindmein30.Click()
    app.FreeAgentRegistration.OK.CloseClick()

if app.window_(title = "What's New Reminder").Exists():
    app.WhatsNewReminder.ImreallybusyRemindmein90.Click()
    app.WhatsNewReminder.OK.CloseClick()



# wait until the app is ready
Пример #34
0
    anotherMenuDlg.CaptureAsImage().save("2ndMenuDlg_%d.png"%lang)

    anotherMenuDlg.OK.Click()

    optionsdlg.OK.Click()


# get the languages as an integer
langs = [int(arg) for arg in sys.argv[1:]]

for lang in langs:
    # start the application
    app = Application().start_(t['apppath'][lang])

    # we have to wait for the Licence Dialog to open
    time.sleep(2)

    # close the Buy licence dialog box
    licence_dlg = app[t['Buy Licence'][lang]]
    licence_dlg[t['Close'][lang]].Click()

    # find the WinRar main dialog
    rar_dlg = app.window_(title_re = ".* - WinRAR.*")

    # dump and capture some dialogs
    get_winrar_dlgs(rar_dlg, app,  lang)

    # exit WinRar
    time.sleep(.5)
    rar_dlg.MenuSelect(t['File->Exit'][lang])
Пример #35
0
def show_percentages_macro():
    app = Application()
    app.connect(title_re='Rocket League.*')
    win = app.window_(title_re='Rocket League.*')
    win.type_keys("{HOME down}" "{HOME up}")
Пример #36
0
def hide_hud_macro():
    app = Application()
    app.connect(title_re='Rocket League.*')
    win = app.window_(title_re='Rocket League.*')
    win.type_keys("{h down}" "{h up}")
Пример #37
0
app = Application().connect(path=r"C:\同花顺软件\同花顺\hexin.exe")

f1 = open("D:/share/config.txt", "r")
lines = f1.readlines()
num = len(lines)
f1.close()

#ShowMenuAndControls(app);
#pywinauto.application.findwindows.enum_windows()

#app = Application().start("C:\同花顺软件\同花顺\hexin.exe")
#time.sleep(.5)
#dlg = app['同花顺(v8.70.35)']

dlg = app.window_(title_re=".*同花顺.*")

#点击功能键F6
dlg.ClickInput(button=u'left')
#time.sleep(.1)
k.tap_key(k.function_keys[6], 1)
#time.sleep(.1)

#点击“个股”按钮
dlg['Button7'].ClickInput(button=u'left')

dlgFrame = dlg.AfxFrameOrView42s

ths_rectangle = dlgFrame.Rectangle()

##############
Пример #38
0
txtf_pwd = 'ctl00$ContentPlaceHolder1$MFALoginControl1$ctl00$txtPasswordID'

ie = IEC.IEController()
ie.Navigate(
    'https://secureauthg.diebold.com/secureauth1/secureauth.aspx?Source=/')
ie.PollWhileBusy()
ie.SetInputValue(txtf_user, user)
ie.ClickButton(caption='Submit')
ie.PollWhileBusy()
time.sleep(10)

from pywinauto.application import Application
app = Application().connect(
    backend='uia',
    path=r"C:\Program Files (x86)\Java\jre1.8.0_111\bin\jp2launcher.exe")
dlg = app.window_(title='Security Warning')
dlg.Close()

import re
txt_launch = None
while txt_launch == None:
    time.sleep(2)
    text = ie.GetDocumentText()
    txt_launch = re.search("Launch", text)
print(txt_launch)
ie.ClickButton(caption='Launch')
ie.PollWhileBusy()
time.sleep(1)
ie.ClickButton(caption='Submit')

pin = notes.main()
Пример #39
0
# print irc.recv (4096)

irc.send("PASS %s\r\n" % PASS)
irc.send("NICK %s\r\n" % NICK)
irc.send("USER %s %s bla :%s\r\n" % (IDENT, HOST, REALNAME))
irc.send("JOIN %s\r\n" % CHANNEL)

readbuffer = ""

app = Application()
#windows = find_windows(title_re=u".*VisualBoy.*")
windows = find_windows(title_re=u".*GameBoy.*")
print windows

if windows:
    w = app.window_(handle=windows[0])
    title_name = w.WindowText()

    # 'Style', 'ClientRects', 'IsEnabled', 'Fonts', 'IsUnicode', 'ContextHelpID', 'IsVisible',
    # 'Rectangle', 'UserData', 'MenuItems', 'FriendlyClassName', 'ControlCount', 'Texts', 'ExStyle', 'ControlID', 'Class
    prop = pywinauto.controls.HwndWrapper.GetDialogPropsFromHandle(
        windows[0])[0]

while (1):
    data = irc.recv(1024)
    if data.find('PRIVMSG') != -1:
        key = ''
        nick = data.split('!')[0].replace(':', '')
        message = ':'.join(data.split(':')[2:]).replace('\r\n', '')

        print nick + ':', message
Пример #40
0
def do_director_spectating_macro():
    app = Application()
    app.connect(title_re='Rocket League.*')
    win = app.window_(title_re='Rocket League.*')
    win.type_keys("{9 down}" "{9 up}")

from pywinauto.application import Application
import time

app = Application().Start(cmd_line=u'"C:\\Program Files (x86)\\MELSOFT\\MRC2\\MR2.exe" ')
#找到主界面的窗口
time.sleep(3)
afx = app[u'MELSOFT MR Configurator2 \u65b0\u5de5\u7a0b']
start_dlg = app.window_(title_re = 'MELSOFT MR Configurator2', class_name = '#32770')
start_dlg.SetFocus()
start_dlg.TypeKeys('{TAB}')
start_dlg.TypeKeys('{ENTER}')
#通过ALt进入“程序运行(R)”界面
afx.TypeKeys('%E',pause=0.5)
afx.TypeKeys('{DOWN 4}')
afx.TypeKeys('{ENTER}')

#找到确认的界面
start_dlg = app.window_(title_re = 'MELSOFT MR Configurator2', class_name = '#32770')
start_dlg.TypeKeys('{ENTER}')

#进入“程序运行”的命令窗口
#comm_window = app.window_(title_re = u'程序运行',class_name = 'AfxFrameOrView100u')
dlg = afx[u'\u7a0b\u5e8f\u8fd0\u884c']
#dlg.Minimize()         窗口成功最小化
#button.Click()

#dlg1 = dlg['nihao']        The control does not have a __getitem__ method for item access (i.e. ctrl[key]) so maybe you have requested this in erro

#编辑程序
Пример #42
0
    anotherMenuDlg.CaptureAsImage().save("2ndMenuDlg_%d.png" % lang)

    anotherMenuDlg.OK.Click()

    optionsdlg.OK.Click()


# get the languages as an integer
langs = [int(arg) for arg in sys.argv[1:]]

for lang in langs:
    # start the application
    app = Application().start_(t['apppath'][lang])

    # we have to wait for the Licence Dialog to open
    time.sleep(2)

    # close the Buy licence dialog box
    licence_dlg = app[t['Buy Licence'][lang]]
    licence_dlg[t['Close'][lang]].Click()

    # find the WinRar main dialog
    rar_dlg = app.window_(title_re=".* - WinRAR.*")

    # dump and capture some dialogs
    get_winrar_dlgs(rar_dlg, app, lang)

    # exit WinRar
    time.sleep(.5)
    rar_dlg.MenuSelect(t['File->Exit'][lang])
Пример #43
0
# print irc.recv (4096)

irc.send("PASS %s\r\n" % PASS)
irc.send("NICK %s\r\n" % NICK)
irc.send("USER %s %s bla :%s\r\n" % (IDENT, HOST, REALNAME))
irc.send("JOIN %s\r\n" % CHANNEL)

readbuffer = ""

app = Application()
#windows = find_windows(title_re=u".*VisualBoy.*")
windows = find_windows(title_re=u".*GameBoy.*")
print windows

if windows:
    w = app.window_(handle = windows[0])
    title_name = w.WindowText()

    # 'Style', 'ClientRects', 'IsEnabled', 'Fonts', 'IsUnicode', 'ContextHelpID', 'IsVisible', 
    # 'Rectangle', 'UserData', 'MenuItems', 'FriendlyClassName', 'ControlCount', 'Texts', 'ExStyle', 'ControlID', 'Class
    prop = pywinauto.controls.HwndWrapper.GetDialogPropsFromHandle(windows[0])[0]



while (1):
    data = irc.recv(1024)
    if data.find ( 'PRIVMSG' ) != -1:
          key = ''
          nick = data.split ( '!' ) [ 0 ].replace ( ':', '' )
          message = ':'.join ( data.split ( ':' ) [ 2: ] ).replace('\r\n','')
Пример #44
0
for series_count in target_series_list:

    if product_type == 'ELS':
        filename = u"삼성증권 제%d회 주가연계증권(공모) 상품설명서_최종.html" % series_count
    elif product_type == 'DLS':
        filename = u"삼성증권 제%d회 기타파생결합증권(공모) 상품설명서_최종.html" % series_count
    elif product_type == 'ELB':
        file_name = u'삼성증권 제%d회 주가연계파생결합사채(공모) 상품설명서_최종.html' % series_count
    elif product_type == 'DLB':
        file_name = u'삼성증권 제%d회 기타파생결합사채(공모) 상품설명서_최종.html' % series_count

    print filename

    # app = Application().start("notepad.exe")
    app = Application().start(u"notepad.exe " + filename)
    app.window_().Wait('ready', timeout=30)

    app.window_().SetFocus()
    app.window_().Click()
    helper.pressHoldRelease('ctrl', 'a')
    helper.copy()

    # app_md = Application().start("C:\Users\Administrator\AppData\Local\Programs\MarkdonwPad 2\MarkdownPad2.exe")
    # app_md = Application().start("C:\Program Files (x86)\MarkdownPad 2\MarkdownPad2.exe")
    # app_md.window_().Wait('ready', timeout=30)

    window_editor.SetFocus()
    window_editor.Maximize()
    window_editor.Restore()
    window_editor.ClickInput(
        coords=(600, 100))  # avoid intersect with notepad.exe window