-
-
Save Zidanela/9319976 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
terminal_app = "/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal" | |
project_path = "/Applications/CoronaSDK/SampleCode/GettingStarted/Clock/" | |
corona_path = "/Applications/CoronaSDK/simulator" | |
main_file = "main.lua" | |
app_name_text = "MyTestApp" | |
app_version_text = "1" | |
app_package_text = "com.arek.mytestapp" | |
app_destination_folder = "/Users/arek/tools/corona/helloworld/" | |
adb_path = "/Users/arek/Downloads/android-sdk-mac_x86/platform-tools/adb" | |
apk_name = "Clock.apk" | |
args = [adb_path,'install','-r',app_destination_folder+apk_name] | |
apk_start = [adb_path, "-d","shell","am","start","-a","android.intent.actoin.MAIN","-n",app_package_text+"/com.ansca.corona.CoronaActivity"] | |
enter = "\n" | |
menu_file = "MenuFile.png" | |
app_name = "Application.png" | |
app_version = "Version.png" | |
app_package = "Package.png" | |
key_alias = "KeyAlias.png" | |
build_button = "BuildButton.png" | |
build_done = "DoneButton.png" | |
build_response = "BuildSuccess.png" | |
tapp = App.open(terminal_app) | |
wait(1) | |
tapp.focus() | |
type(corona_path + " " + project_path + main_file + enter) | |
wait(2) | |
switchApp("Corona Simulator") | |
file = None | |
try: | |
file = Region(find(menu_file)) | |
except: | |
print "file button not found" | |
if file: | |
click(menu_file) | |
wait(0.2) | |
Screen().mouseMove(Location(350,65)) | |
wait(0.2) | |
Screen().mouseMove(Location(450,80)) | |
click(Location(450,80)) | |
try: | |
r = find(app_name) | |
print r | |
wait(0.2) | |
Screen().doubleClick(Location(r.getX()+200,r.getY()+10)) | |
type(app_name_text+"\t") | |
type(app_version_text+"\t") | |
type(app_package_text+"\t") | |
type(app_destination_folder) | |
r = find(key_alias) | |
Screen().click(Location(r.getX()+200,r.getY()+10)) | |
wait(0.2) | |
Screen().mouseMove(Location(r.getX()+200,r.getY()+30)) | |
click(Location(r.getX()+200,r.getY()+30)) | |
wait(0.2) | |
click(build_button) | |
built = None | |
while not built: | |
try: | |
print "Is done: ", | |
rb = find(build_response) | |
print rb | |
built = True | |
print "yes" | |
except: | |
print "no" | |
sleep(0.5) | |
click(build_done) | |
except: | |
print "Error in performing build operation" | |
wait(1) | |
print "Args: ", | |
print args | |
print "Installing:" | |
os.system(" ".join(args)) | |
print "Apk start: ", | |
print " ".join(apk_start) | |
os.system(" ".join(apk_start)) | |
if tapp is not None: | |
tapp.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment