def editSettingsXML(root, prefix): log.printMessage("Editing Settings.xml file...") newTrackingAccount = getMetadataFromGoogleDocs(6, "Tracking account") newPrivacyPolicy = getMetadataFromGoogleDocs(7, "Privacy policy") #newAboutLocation = getMetadataFromGoogleDocs(9, "About location") newAboutLocation = "http://device.e-pages.dk/content/amedia/webview.php?view=info&customer="+prefix #newWebURL = getMetadataFromGoogleDocs(3, "External Web URL") newWebURL = "http://device.e-pages.dk/content/amedia/webview.php?view=home&customer="+prefix+"&platform=windows&device_type=phone" newComscoreCustom = getMetadataFromGoogleDocs(17, "Comscore customer C2") newComscoreDomain = getMetadataFromGoogleDocs(1, "Comscore domain/app name") newComscorePubSecret = getMetadataFromGoogleDocs(1, "Comscore publisher secret") newComscoreVirtual = getMetadataFromGoogleDocs(1, "Comscore virtual") #newHelppage = getMetadataFromGoogleDocs(1, "Help page") newHelppage = "http://device.e-pages.dk/content/amedia/webview.php?view=help&customer="+prefix resetToAppNameInGoogleDocs(11) xmlparser.xmlParse_SettingsXML(root, newTrackingAccount, newPrivacyPolicy, newAboutLocation, newWebURL, appName, prefix, newComscoreCustom, newComscoreDomain, newComscorePubSecret, newComscoreVirtual, newHelppage)
def Menu_BemTest(): try: menuNoticeToTester = "Bemærkninger til testere".decode('utf-8') wait_until(Text(menuNoticeToTester).exists, timeout_secs=10) except: sleep(10) if Text(menuNoticeToTester).exists() == False: SETAUTO(False) typeNum(20, TAB) press(ENTER) SETAUTO(True) else: click(menuNoticeToTester) log.printMessage("Going to Menu: Bemaerkninger til testere") sleep(10) log.printMessage("Writing notice to testere: " + messageToTestere) write(messageToTestere) press(TAB) press(ENTER) sleep(10)
def addIfSubmitsToList(): log.printMessage("Adding submit status from google docs to list...") press(CTRL+SPACE) press(CTRL+'c') press(RIGHT) if startUpFlag == True: if Window(tempfileName2).exists(): switch_to(tempfileName2) else: global notepad_2 notepad_2 = start("notepad") else: switch_to(tempfileName2) press(CTRL+'v') press(CTRL+'s') saveAs(tempfileName2) findTempLocation(tempfileName2) global ifsubmits ifsubmits = [] datafile = file(tempfileName2) for line in datafile: ifsubmits.append(line.strip()) switch_to(tempfileName2) press(CTRL+'a',DEL) press(CTRL+'s')
def seperateKeywords(): log.printMessage("seperating keywords...") datafile = open(tempLocation) global keywords keywords = [] for line in datafile: for letter in line: if ',' in letter: press(CTRL+'b') switch_to("Søg") write(",") click(RadioButton("Fremad")) press(TAB,ENTER,TAB,ENTER) write(";") press(ENTER) press(CTRL+'s') datafile = open(tempLocation) for line in datafile: if ";" in line: keyword = line.replace(";", "") word = keyword.decode("iso-8859-1") word = word.strip() log.printMessage("Appending keyword: " + keyword) keywords.append(word) press(CTRL+'a',DEL,CTRL+'s') switchTo(dashboardWindow)
def Menu_Krypto(): try: wait_until(Text("Kryptografi").exists, timeout_secs=10) except: sleep(10) if Text("Kryptografi").exists() == False: SETAUTO(False) typeNum(18, TAB) press(ENTER) SETAUTO(True) else: click("Kryptografi") log.printMessage("Going to Menu: Kryptografi") sleep(10) press(DOWN) sleep(3) press(TAB) press(SPACE) typeNum(2, TAB) press(ENTER) sleep(10)
def close(): log.printMessage("Closing applications...") if Window(tempfileName).exists(): switch_to(tempfileName) press(ALT+F4) if Window(tempfileName2).exists(): switch_to(tempfileName2) press(ALT+F4) if Window("Microsoft Visual Studio").exists(): kill("Microsoft Visual Studio") sleep(3) if Window("Lenovo Settings Power").exists(): switch_to("Lenovo Settings Power") press(ALT+F4) try: switchTo(googledocs) os.chdir(scripts_image_path) wait_until(Image("changes_saved.PNG").exists, timeout_secs=10) except: pass SETAUTO(False) try: while Window("Google Chrome").exists(): kill("Google Chrome") except: pass SETAUTO(True)
def restart(): log.printMessage("RESTARTING......") os.chdir(rootdir) execfile('screenshot_log.py') switchTo(googledocs) sleep(5) press(CTRL+'h') write(prefixtitelcolumn) press(ENTER) SETAUTO(False) typeNum(11, TAB) press(ENTER) SETAUTO(True) switch_to(tempfileName) press(CTRL+'a',DEL,CTRL+'s') global startUpFlag startUpFlag = False if Window("Gem som").exists(): switch_to("Gem som") press(ALT+F4) SETAUTO(False) try: while Window("Google Chrome").exists(): kill("Google Chrome") except: pass SETAUTO(True) start("Google Chrome", '-new-window', urldocs) sleep(15)
def findProductId(): log.printMessage("Finding product id...") press(CTRL+'a', CTRL+'c') switch_to(tempfileName) press(CTRL+'v', CTRL+'s') press(CTRL+'b') switch_to("Søg") write("App ID") try: click(RadioButton("Tilbage")) except: typeNum(2, TAB) press(LEFT) press(TAB,ENTER,TAB,ENTER,DEL,DEL) write(";"), press(CTRL+'s') findTempLocation(tempfileName) datafile = file(tempLocation) for line in datafile: if ";" in line: global productId productId = line.replace(";", "") productId = productId.strip() log.printMessage("Succesfully found product id: " + productId) break press(CTRL+'a', DEL, CTRL+'s') switchTo(dashboardWindow) click(dummyPoint)
def editPackageAppxManifest(root, prefix): log.printMessage("Editing PackageAppxManifest XML file") newColorCodeSplashBg = getMetadataFromGoogleDocs(1, "Color code background splash") newColorCodeHomeIcon = getMetadataFromGoogleDocs(1, "Color code home icon") xmlparser.xmlParse_PackageAppxManifest(root, publisherid, appName, prefix, newColorCodeSplashBg, newColorCodeHomeIcon) resetToAppNameInGoogleDocs(28)
def restart(): log.printMessage("RESTARTING......") os.chdir(rootdir) execfile('screenshot_log.py') switchTo(googledocs) sleep(5) press(CTRL+'h') write(prefixtitelcolumn) press(ENTER) SETAUTO(False) typeNum(11, TAB) press(ENTER) SETAUTO(True) searchInDocsForPrefix(visiolink_project_name) sleep(5) press(TAB) press(ENTER) press(CTRL+'a') write("FAILED") press(CTRL+'h') write(prefixtitelcolumn) press(ENTER) SETAUTO(False) typeNum(11, TAB) press(ENTER) SETAUTO(True) switch_to(tempfileName) press(CTRL+'a',DEL,CTRL+'s') global startUpFlag startUpFlag = False open_dialog = Window('Åbn') if open_dialog.exists(): switch_to(open_dialog) press(ALT+F4) if Window('Søg').exists(): switch_to('Søg') press(ALT+F4) if Window("Placeringen er ikke tilgængelig").exists(): switch_to("Placeringen er ikke tilgængelig") press(ALT+F4) if Window("Gem som").exists(): switch_to("Gem som") press(ALT+F4) if Window("Lenovo Settings Power").exists(): switch_to("Lenovo Settings Power") press(ALT+F4) """
def submitInAppProduct(): if Text("Submit").exists() == False: typeNum(24,TAB) press(ENTER) log.printMessage("Submitting In App Product") else: click("Submit") log.printMessage("Submitting In App Product")
def choosePriceForInAppProduct(): log.printMessage("Choosing price for In-app product...") SETAUTO(False) typeNum(27, TAB) press(ENTER) typeNum(9, DOWN) press(ENTER) SETAUTO(True)
def addNewDialog(): open_dialog = Window('Åbn') if open_dialog.exists(): switch_to(open_dialog) log.printMessage("Open dialog is open. Adding XAP file...") return True else: return False
def getAPPXFile(path, buildconfig): for filename in os.listdir(path): if filename.endswith(".appx"): version_current_date = buildconfig+"_"+str(appxversion)+"_"+str(xmlparser.current_date) if version_current_date in filename: appxfile = filename log.printMessage("Found APPX file "+buildconfig+": " + appxfile) return appxfile
def getXAPFile(root): for filename in os.listdir(root+xapfolder): if filename.endswith(".xap"): version_current_date = "_"+str(xapversion)+"_"+str(xmlparser.current_date) if version_current_date in filename: xapfile = filename log.printMessage("Found XAP file: " + xapfile) return xapfile
def copyGraphicsToProject(root): log.printMessage("Copying graphics to project...") dummySmallLogo = "tile_30-30.png" dummyLogo = "tile_150-150.png" dummyWideLogo = "tile_310-150.png" storeLogo = "StoreLogo.scale-100.png" logo = "Logo.scale-100.png" smallLogo = "b_30x30.scale-100.png" wideLogo = "b_310x150.scale-100.png" splashScreen = "b_620x300.scale-100.png" graphicPath = graphics.getGraphicPath(rootdir,appName) if graphicPath == None: raise Exception("ERROR: Graphicpath not found.") destination = root+metadataPath+"/images" os.chdir(destination) source = os.listdir(destination) #Remove existing image in ../images folder graphicOperation(source, destination, "remove") os.chdir(graphicPath) source = os.listdir(graphicPath) #Copy graphics to ../images graphicOperation(source, destination, "copy") destination = root+metadataPath os.chdir(graphicPath) source = os.listdir(graphicPath) #Copy graphics to ../WindowsGenericReader/WindowsGenericReader graphicOperation(source, destination, "copy") os.chdir(root+metadataPath) #Rename all images to graphics added to project renamePng(graphics.wideLogo, wideLogo) renamePng(graphics.storeLogo, storeLogo) renamePng(graphics.smallLogo, smallLogo) renamePng(graphics.logo, logo) renamePng(graphics.splashScreen, splashScreen) os.chdir(graphicPath) #Copy graphics to ../WindowsGenericReader/WindowsGenericReader AGAIN for files in source: if files.endswith(".png") and ("image_30x30" in files or "image_150x150" in files or "image_310x150" in files): shutil.copy(files, destination) os.chdir(root+metadataPath) #Rename graphics to dummy tiles not used in project renamePng(graphics.smallLogo, dummySmallLogo) renamePng(graphics.logo, dummyLogo) renamePng(graphics.wideLogo, dummyWideLogo)
def addPrivaryURL(): typeNum(2, TAB) log.printMessage("Getting privacy URL from Google Docs") switchTo(googledocs) press(TAB) press(ENTER) press(CTRL+'a', CTRL+'c') switchTo(menulistWindow) press(CTRL+'v')
def buildAppxPackage(root, prefix, buildconfig): global appxversion appxversion = xmlparser.getVersionAppx(root) global packagename packagename = getPackageName(prefix, buildconfig, appxversion) global packagePathStore packagePathStore = root+metadataPath+"/AppxPackagesStore" if os.path.exists(packagePathStore) == False: os.mkdir(packagePathStore) else: removeIfAPPXExists(root, buildconfig) package_map_path_app = root+metadataPath+"/package_maps" package_map_path_root = rootdir + "/package_maps"+"/"+buildconfig+"/package.map.txt" if os.path.exists(package_map_path_app) == False: os.mkdir(package_map_path_app) os.chdir(package_map_path_app) os.mkdir(buildconfig) shutil.copy(package_map_path_root, os.getcwd()+"/"+buildconfig) else: if os.path.exists(package_map_path_app+"/"+buildconfig) == False: os.chdir(package_map_path_app) os.mkdir(buildconfig) shutil.copy(package_map_path_root, os.getcwd()+"/"+buildconfig) package_map_path_app = package_map_path_app + "/" + buildconfig os.chdir(package_map_path_app) with open("package.map.txt", 'r') as file: data = file.readlines() home = expanduser("~") i=0 for d in data: data[i] = data[i].replace("PACKAGE_MAP_REPLACEMENT_PATH_HERE", rootdir) data[i] = data[i].replace("PREFIX_HERE", prefix) data[i] = data[i].replace("HOME_USER_PATH_HERE", home) i+=1 with open("package.map.txt", 'w') as file: file.writelines(data) makeappxExePath = r"C:\Program Files (x86)\Windows Kits\8.1\bin\x64\makeappx.exe" buildmsg = "Building appx file for..."+buildconfig log.printMessage(buildmsg) call("echo "+buildmsg, shell=True) call(makeappxExePath + " " + "pack /l /h SHA256 /f " + package_map_path_app + "\package.map.txt /o /p " + packagePathStore + "/" + packagename + ".appx")
def addCopyright(): typeNum(2, TAB) log.printMessage("Getting copyright text from Google Docs") switchTo(googledocs) press(TAB) press(ENTER) press(CTRL+'a',CTRL+'c') switchTo(menulistWindow) press(CTRL+'v')
def getDescOfAppFromGoogleDocs(): switchTo(googledocs) log.printMessage("Getting App Description from Google Docs...") SETAUTO(False) typeNum(9, TAB) press(ENTER) SETAUTO(True) press(CTRL+'a',CTRL+'c') switchTo(dashboardWindow)
def submissionList(): log.printMessage("Combining prefix list with submit status list...") i=0 comb = [] while(i<len(prefixes)): comb.append(str(prefixes[i])+"_"+str(ifsubmits[i])) i+=1 return comb
def goToDashboard(): switchTo(dashboardWindow) log.printMessage("Clicking Dashboard") press(HOME) if Text("Dashboard").exists() == False: typeNum(2, TAB) press(ENTER) else: click("Dashboard")
def addImageToList(path): log.printMessage("Screenshot path " + path + " does exists!") os.chdir(path) imgList = [] for image in os.listdir(os.getcwd()): if image.endswith(".png") and len(imgList) < maxImageUpload: log.printMessage("Adding image "+ image +" to list") imgList.append(image) return imgList
def goToSendEnApp(): log.printMessage("Clicking Send en app") if Text("Send en app").exists() == False: SETAUTO(False) typeNum(15, TAB) press(ENTER) SETAUTO(True) else: click("Send en app")
def searchInDocsForPrefix(prefix): log.printMessage("Searching for prefix: " + prefix + " with submit status to list...") switchTo(googledocs) press(CTRL+'h') write(prefix) press(ENTER) SETAUTO(False) typeNum(11, TAB) press(ENTER) SETAUTO(True)
def getEmailFromGoogleDocs(): log.printMessage("Getting E-Mail for support from Google Docs...") press(TAB) switchTo(googledocs) shiftTab(1) press(ENTER,CTRL+'a',CTRL+'c') switchTo(dashboardWindow) press(CTRL+'v') log.printMessage("Added E-Mail for support") press(PGDN) click(dummyPoint)
def run(): start("Google Chrome", '-new-window', "https://dev.windowsphone.com/en-us/dashboard?logged_in=1") sleep(10) i=0 while(i<3): checkList() i+=1 if appCounter == xappssubmits: log.printMessage("Maximum specified app submit reached..." + str(xappssubmits)) log.printMessage("All apps are ready to be submitted or already submitted...")
def saveFromAppUploadAndDesc(): press(PGDN) if Text("Save").exists() == False: SETAUTO(False) typeNum(37, TAB) press(ENTER) SETAUTO(True) else: click("Save") log.printMessage("Saving...")
def loopAllGraphics(): rootdir = r"C:\Users\David\Projekter\aMediaTest\Device\NytSetup\WindowsPhone" temp = "appnames.txt" userhome = os.path.expanduser('~') desktop = userhome + '/Desktop/' os.chdir(desktop) tempLocation = os.getcwd()+"/"+temp datafile = file(tempLocation) for line in datafile: log.printMessage(str(getGraphicPath(rootdir, line)))
def insertDescFromApp(): if Text("Description for the Store*").exists() == False: SETAUTO(False) typeNum(25, TAB) press(CTRL+'v') SETAUTO(True) else: write("", into="Description for the Store*") press(CTRL+'v') log.printMessage("Inserted App Description from Google Docs")