Added Revision and some other minor cleanup
This commit is contained in:
parent
1e1eea4f5d
commit
bc3c410aa3
@ -4,14 +4,15 @@ We hit a few dialogs and save XML dump and
|
|||||||
screenshot from each dialog.
|
screenshot from each dialog.
|
||||||
|
|
||||||
Specify a language at the command line:
|
Specify a language at the command line:
|
||||||
0 Czech
|
0 Czech
|
||||||
1 German
|
1 German
|
||||||
2 French
|
2 French
|
||||||
|
|
||||||
More then likely you will need to modify the apppath
|
More then likely you will need to modify the apppath
|
||||||
entry in the 't' dictionary to where you have
|
entry in the 't' dictionary to where you have
|
||||||
extracted the WinRAR executables.
|
extracted the WinRAR executables.
|
||||||
"""
|
"""
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -22,110 +23,110 @@ folders = ['wrar351cz', 'wrar351d', 'wrar351fr']
|
|||||||
|
|
||||||
# translations for each language
|
# translations for each language
|
||||||
t = {
|
t = {
|
||||||
'apppath' : (
|
'apppath' : (
|
||||||
'c:\.temp\wrar351fr\winrar.exe',
|
'c:\.temp\wrar351fr\winrar.exe',
|
||||||
'c:\.temp\wrar351d\winrar.exe',
|
'c:\.temp\wrar351d\winrar.exe',
|
||||||
'c:\.temp\wrar351cz\winrar.exe'
|
'c:\.temp\wrar351cz\winrar.exe'
|
||||||
),
|
),
|
||||||
|
|
||||||
# Buy Licence Dialog
|
# Buy Licence Dialog
|
||||||
'Buy Licence' : (
|
'Buy Licence' : (
|
||||||
"Acheter une licence pur winRAR",
|
"Acheter une licence pur winRAR",
|
||||||
"Bittekaufensieeine",
|
"Bittekaufensieeine",
|
||||||
"Zakuptesiprosm"),
|
"Zakuptesiprosm"),
|
||||||
'Close' : (
|
'Close' : (
|
||||||
"Fermer",
|
"Fermer",
|
||||||
"Schleissen",
|
"Schleissen",
|
||||||
"Zavrit"),
|
"Zavrit"),
|
||||||
|
|
||||||
# Options->Configure menu items
|
# Options->Configure menu items
|
||||||
"Options->Configure" : (
|
"Options->Configure" : (
|
||||||
"Options->Configuration",
|
"Options->Configuration",
|
||||||
"Optionen->Einstellungen",
|
"Optionen->Einstellungen",
|
||||||
"Moznosti->Nastaveni"),
|
"Moznosti->Nastaveni"),
|
||||||
|
|
||||||
# Configure/Options dialog box
|
# Configure/Options dialog box
|
||||||
'Configure' : (
|
'Configure' : (
|
||||||
"Configuration",
|
"Configuration",
|
||||||
"Einstellungen",
|
"Einstellungen",
|
||||||
"Nastaveni"),
|
"Nastaveni"),
|
||||||
|
|
||||||
# personalise toolbar buttons button
|
# personalise toolbar buttons button
|
||||||
'Buttons' : (
|
'Buttons' : (
|
||||||
"Boutons",
|
"Boutons",
|
||||||
"Schaltflachen",
|
"Schaltflachen",
|
||||||
"Vybrattlacitka"),
|
"Vybrattlacitka"),
|
||||||
|
|
||||||
# Personalize toolbars dialog
|
# Personalize toolbars dialog
|
||||||
'PeronnaliseToolbars' : (
|
'PeronnaliseToolbars' : (
|
||||||
"Peronnalisation de la barre doutils",
|
"Peronnalisation de la barre doutils",
|
||||||
"Werkzeugleisteanpassen",
|
"Werkzeugleisteanpassen",
|
||||||
"Vybertlaciteknastrojovelisty"),
|
"Vybertlaciteknastrojovelisty"),
|
||||||
|
|
||||||
# create profile button
|
# create profile button
|
||||||
'CreateDefaultProfile' : (
|
'CreateDefaultProfile' : (
|
||||||
u"Creerleprofilpardéfault",
|
u"Creerleprofilpardéfault",
|
||||||
"Standardfestlegen",
|
"Standardfestlegen",
|
||||||
"Vytvoritimplicitni"),
|
"Vytvoritimplicitni"),
|
||||||
|
|
||||||
# create profile dialog box title
|
# create profile dialog box title
|
||||||
'ConfigureDefaultOptions' : (
|
'ConfigureDefaultOptions' : (
|
||||||
"Configurer les options de compre...",
|
"Configurer les options de compre...",
|
||||||
"Standardkomprimierungs",
|
"Standardkomprimierungs",
|
||||||
"Zmenaimplicitnichnast..."),
|
"Zmenaimplicitnichnast..."),
|
||||||
|
|
||||||
# context menu's button
|
# context menu's button
|
||||||
"ContextMenus" : (
|
"ContextMenus" : (
|
||||||
"Menus contextuels",
|
"Menus contextuels",
|
||||||
"Optionenimkontextmenu",
|
"Optionenimkontextmenu",
|
||||||
"Polozkykontextovehamenu"),
|
"Polozkykontextovehamenu"),
|
||||||
|
|
||||||
# context menu's dialog
|
# context menu's dialog
|
||||||
"contextMenuDlg" : (
|
"contextMenuDlg" : (
|
||||||
"Rubriques des menus contextuels",
|
"Rubriques des menus contextuels",
|
||||||
"OptionenindenKontextmenus",
|
"OptionenindenKontextmenus",
|
||||||
"Polozkykontextovehamenu"),
|
"Polozkykontextovehamenu"),
|
||||||
|
|
||||||
# file->exit menu option
|
# file->exit menu option
|
||||||
"File->Exit" : (
|
"File->Exit" : (
|
||||||
"Fichier->Quitter",
|
"Fichier->Quitter",
|
||||||
"Datei->Beenden",
|
"Datei->Beenden",
|
||||||
"Soubor->Konec"),
|
"Soubor->Konec"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_winrar_dlgs(rar_dlg, x):
|
def get_winrar_dlgs(rar_dlg, x):
|
||||||
rar_dlg.MenuSelect(t["Options->Configure"][x])
|
rar_dlg.MenuSelect(t["Options->Configure"][x])
|
||||||
|
|
||||||
optionsdlg = rar_dlg.app[t['Configure'][x]]
|
optionsdlg = rar_dlg.app[t['Configure'][x]]
|
||||||
optionsdlg._write("Options_%d.xml"%x)
|
optionsdlg._write("Options_%d.xml"%x)
|
||||||
optionsdlg.CaptureAsImage().save("Options_%d.png"%x)
|
optionsdlg.CaptureAsImage().save("Options_%d.png"%x)
|
||||||
optionsdlg[t['Buttons'][x]].Click()
|
optionsdlg[t['Buttons'][x]].Click()
|
||||||
|
|
||||||
contextMenuDlg = rar_dlg.app[t['PeronnaliseToolbars'][x]]
|
contextMenuDlg = rar_dlg.app[t['PeronnaliseToolbars'][x]]
|
||||||
contextMenuDlg._write("PersonaliseToolbars_%d.xml"%x)
|
contextMenuDlg._write("PersonaliseToolbars_%d.xml"%x)
|
||||||
contextMenuDlg.CaptureAsImage().save("PersonaliseToolbars_%d.png"%x)
|
contextMenuDlg.CaptureAsImage().save("PersonaliseToolbars_%d.png"%x)
|
||||||
contextMenuDlg.OK.Click()
|
contextMenuDlg.OK.Click()
|
||||||
|
|
||||||
optionsdlg.TabCtrl.Select(1)
|
optionsdlg.TabCtrl.Select(1)
|
||||||
optionsdlg[t['CreateDefaultProfile'][x]].Click()
|
optionsdlg[t['CreateDefaultProfile'][x]].Click()
|
||||||
|
|
||||||
defaultOptionsDlg = rar_dlg.app[t['ConfigureDefaultOptions'][x]]
|
defaultOptionsDlg = rar_dlg.app[t['ConfigureDefaultOptions'][x]]
|
||||||
defaultOptionsDlg._write("DefaultOptions_%d.xml"%x)
|
defaultOptionsDlg._write("DefaultOptions_%d.xml"%x)
|
||||||
defaultOptionsDlg.CaptureAsImage().save("DefaultOptions_%d.png"%x)
|
defaultOptionsDlg.CaptureAsImage().save("DefaultOptions_%d.png"%x)
|
||||||
defaultOptionsDlg.OK.Click()
|
defaultOptionsDlg.OK.Click()
|
||||||
|
|
||||||
optionsdlg.TabCtrl.Select(6)
|
optionsdlg.TabCtrl.Select(6)
|
||||||
optionsdlg[t['ContextMenus'][x]].Click()
|
optionsdlg[t['ContextMenus'][x]].Click()
|
||||||
|
|
||||||
anotherMenuDlg = rar_dlg.app[t['contextMenuDlg'][x]]
|
anotherMenuDlg = rar_dlg.app[t['contextMenuDlg'][x]]
|
||||||
anotherMenuDlg._write("2ndMenuDlg_%d.xml"%x)
|
anotherMenuDlg._write("2ndMenuDlg_%d.xml"%x)
|
||||||
anotherMenuDlg.CaptureAsImage().save("2ndMenuDlg_%d.png"%x)
|
anotherMenuDlg.CaptureAsImage().save("2ndMenuDlg_%d.png"%x)
|
||||||
|
|
||||||
anotherMenuDlg.OK.Click()
|
anotherMenuDlg.OK.Click()
|
||||||
|
|
||||||
optionsdlg.OK.Click()
|
optionsdlg.OK.Click()
|
||||||
|
|
||||||
|
|
||||||
# get the languages as an integer
|
# get the languages as an integer
|
||||||
@ -148,4 +149,5 @@ rar_dlg = app._window(title_re = ".* - WinRAR.*")
|
|||||||
get_winrar_dlgs(rar_dlg, x)
|
get_winrar_dlgs(rar_dlg, x)
|
||||||
|
|
||||||
# exit WinRar
|
# exit WinRar
|
||||||
|
time.sleep(.5)
|
||||||
rar_dlg.MenuSelect(t['File->Exit'][x])
|
rar_dlg.MenuSelect(t['File->Exit'][x])
|
||||||
|
@ -18,53 +18,62 @@
|
|||||||
# Suite 330,
|
# Suite 330,
|
||||||
# Boston, MA 02111-1307 USA
|
# Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
"Some automation of Windows Media player"
|
||||||
|
|
||||||
|
__revision__ = "$Revision$"
|
||||||
|
|
||||||
|
|
||||||
#import os
|
#import os
|
||||||
import time
|
import time
|
||||||
|
import sys
|
||||||
|
|
||||||
from pywinauto import application
|
from pywinauto import application
|
||||||
|
|
||||||
from pywinauto import tests
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def WindowsMedia():
|
def WindowsMedia():
|
||||||
|
|
||||||
app = application.Application()
|
app = application.Application()
|
||||||
|
|
||||||
app._connect(path = ur"C:\Program Files\Windows Media Player\wmplayer.exe")
|
try:
|
||||||
|
app._connect(
|
||||||
|
path = ur"C:\Program Files\Windows Media Player\wmplayer.exe")
|
||||||
|
except application.ProcessNotFoundError:
|
||||||
|
print "You must first start Windows Media "\
|
||||||
|
"Player before running this script"
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
app.WindowsMediaPlayer.MenuSelect("View->GoTo->Library")
|
app.WindowsMediaPlayer.MenuSelect("View->GoTo->Library")
|
||||||
app.WindowsMediaPlayer.MenuSelect("View->Choose Columns")
|
app.WindowsMediaPlayer.MenuSelect("View->Choose Columns")
|
||||||
|
|
||||||
for ctrl in app.ChooseColumns.Children:
|
for ctrl in app.ChooseColumns.Children:
|
||||||
print ctrl.Class
|
print ctrl.Class
|
||||||
|
|
||||||
|
|
||||||
print "Is it checked already:", app.ChooseColumsn.ListView.IsChecked(1)
|
print "Is it checked already:", app.ChooseColumsn.ListView.IsChecked(1)
|
||||||
|
|
||||||
# Check an Item in the listview
|
# Check an Item in the listview
|
||||||
app.ChooseColumns.ListView.Check(1)
|
app.ChooseColumns.ListView.Check(1)
|
||||||
time.sleep(.5)
|
time.sleep(.5)
|
||||||
print "Shold be checked now:", app.ChooseColumsn.ListView.IsChecked(1)
|
print "Shold be checked now:", app.ChooseColumsn.ListView.IsChecked(1)
|
||||||
|
|
||||||
# Uncheck it
|
# Uncheck it
|
||||||
app.ChooseColumns.ListView.UnCheck(1)
|
app.ChooseColumns.ListView.UnCheck(1)
|
||||||
time.sleep(.5)
|
time.sleep(.5)
|
||||||
print "Should not be checked now:", app.ChooseColumsn.ListView.IsChecked(1)
|
print "Should not be checked now:", app.ChooseColumsn.ListView.IsChecked(1)
|
||||||
|
|
||||||
# Check it again
|
# Check it again
|
||||||
app.ChooseColumns.ListView.Check(1)
|
app.ChooseColumns.ListView.Check(1)
|
||||||
time.sleep(.5)
|
time.sleep(.5)
|
||||||
|
|
||||||
app.ChooseColumsn.Cancel.Click()
|
app.ChooseColumsn.Cancel.Click()
|
||||||
|
|
||||||
|
|
||||||
def Main():
|
def Main():
|
||||||
start = time.time()
|
start = time.time()
|
||||||
|
|
||||||
WindowsMedia()
|
WindowsMedia()
|
||||||
|
|
||||||
print "Total time taken:", time.time() - start
|
print "Total time taken:", time.time() - start
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
Main()
|
Main()
|
Loading…
Reference in New Issue
Block a user