├── .SmartGitAuto ├── .idea ├── .gitignore ├── misc.xml ├── inspectionProfiles │ ├── profiles_settings.xml │ └── Project_Default.xml ├── modules.xml └── BackupCodeRetrieve.iml ├── test.py ├── main.py ├── oops.py └── C.py /.SmartGitAuto: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/BackupCodeRetrieve.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | -------------------------------------------------------------------------------- /test.py: -------------------------------------------------------------------------------- 1 | import pyautogui 2 | import win32clipboard 3 | import time 4 | import mysql.connector 5 | from termcolor import colored, cprint 6 | 7 | mydb = mysql.connector.connect( 8 | host="HOST", 9 | database="DATABASE", 10 | user="USER", 11 | password="PASSWORD" 12 | ) 13 | 14 | mycursor = mydb.cursor() 15 | 16 | def SelectCode(): 17 | global k 18 | print(k) 19 | 20 | 21 | 22 | # x-axis -- COMMON Y = 525 23 | # -- x DIFF = 198 (-1085 to -292) 24 | 25 | #251 , 335, 417, 506, 586, 673 26 | def menudrive(): 27 | global k 28 | #print(pyautogui.position()) 29 | for i in range(251, 678, 85): 30 | for j in range(-1085, -292, 198): 31 | k = k + 1 32 | if k <= 100: 33 | pyautogui.click(j, i) 34 | time.sleep(1) 35 | SelectCode() 36 | pyautogui.click(-623, 64) 37 | k = 0 38 | for menu in range(4): 39 | time.sleep(0.5) 40 | menudrive() 41 | #pyautogui.click(-1262, 307) 42 | pyautogui.keyDown('pagedown') 43 | #print(pyautogui.position()) 44 | #SelectCode() -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | import pyautogui 2 | import win32clipboard 3 | import time 4 | import mysql.connector 5 | 6 | mydb = mysql.connector.connect( 7 | host="HOST", 8 | database="DATABASE", 9 | user="USER", 10 | password="PASSWORD" 11 | ) 12 | 13 | mycursor = mydb.cursor() 14 | 15 | #print(pyautogui.position()) 16 | 17 | def SelectCode(): 18 | #SELECT 19 | print("SELECTING CODE...") 20 | #-682, 320 21 | #-763, 249 to -756, 656 22 | pyautogui.click(-763, 249, button='left') 23 | time.sleep(0.1) 24 | for i in range(20): 25 | pyautogui.keyDown('pagedown') 26 | pyautogui.keyUp('pagedown') 27 | pyautogui.keyDown('shift') 28 | pyautogui.click(-500, 656, button='left') 29 | pyautogui.keyUp('shift') 30 | print("Started Copying") 31 | time.sleep(0.1) 32 | pyautogui.hotkey("ctrl","a") 33 | pyautogui.hotkey("ctrl","c") 34 | time.sleep(0.1) 35 | win32clipboard.OpenClipboard() 36 | data = win32clipboard.GetClipboardData() 37 | win32clipboard.CloseClipboard() 38 | print(data) 39 | 40 | print("Copied to Clipboard") 41 | print("Writing to disc...") 42 | #sqlformula1 = "INSERT INTO elabdata (id, CODE) VALUES (%s, %s)" 43 | #val = (1, data) 44 | #mycursor.execute(sqlformula1,val) 45 | #mydb.commit() 46 | print("Data Transferred!!") 47 | print(pyautogui.position()) 48 | SelectCode() 49 | 50 | -------------------------------------------------------------------------------- /oops.py: -------------------------------------------------------------------------------- 1 | import pyautogui 2 | import win32clipboard 3 | import time 4 | import mysql.connector 5 | from termcolor import colored 6 | 7 | mydb = mysql.connector.connect( 8 | host="HOST", 9 | database="DATABASE", 10 | user="USER", 11 | password="PASSWORD" 12 | ) 13 | 14 | mycursor = mydb.cursor() 15 | def SelectCode(): 16 | global k 17 | #SELECT 18 | print("SELECTING CODE...") 19 | #-682, 320 20 | #-763, 249 to -756, 656 21 | pyautogui.click(-763, 249, button='left') 22 | time.sleep(1) 23 | pyautogui.hotkey("ctrl","a") 24 | pyautogui.hotkey("ctrl","c") 25 | time.sleep(0.1) 26 | print("Started Copying") 27 | win32clipboard.OpenClipboard() 28 | data = win32clipboard.GetClipboardData() 29 | win32clipboard.CloseClipboard() 30 | #print(data) 31 | 32 | print("Copied to Clipboard") 33 | print("Processing ...") 34 | data = list(data.split("\r\n")) 35 | SESSION_temp = data[2] 36 | SESSION_temp = list(SESSION_temp.split(' ')) 37 | SESSION = "" 38 | for sess in SESSION_temp: 39 | if sess != 'SESSION:': 40 | SESSION = SESSION + sess + " " 41 | NAME = data[4] 42 | code = "" 43 | question = "" 44 | testcase = [] 45 | temp = [] 46 | mainTestCase = [] 47 | for dat in data: 48 | if dat != "": 49 | temp.append(dat) 50 | 51 | if '#include ' in temp: 52 | codeS = temp.index('#include ') 53 | for codeI in range(codeS,len(temp)): 54 | code = code + temp[codeI] + '\r\n' 55 | 56 | if 'QUESTION DESCRIPTION' in temp: 57 | QUESTIONS = temp.index('QUESTION DESCRIPTION') 58 | QUESTIONE = temp.index('TEST CASE 1') 59 | for QI in range(QUESTIONS+1, QUESTIONE): 60 | question = question + temp[QI] + '
' 61 | 62 | testmain = [] 63 | for testdata in range(QUESTIONE,codeS): 64 | testmain.append(temp[testdata]) 65 | 66 | testD = "" 67 | testS = testmain.index('INPUT') + 1 68 | testE = testmain.index('OUTPUT') 69 | for io in range(testS, testE): 70 | testD = testD + testmain[io] + "
" 71 | 72 | testcase.append(k) 73 | testcase.append("TEST CASE 1") 74 | testcase.append(testD) 75 | testD = "" 76 | testS = testmain.index('OUTPUT') + 1 77 | if 'TEST CASE 2' in testmain: 78 | testE = testmain.index('TEST CASE 2') 79 | else: 80 | testE = len(testmain) 81 | for io in range(testS, testE): 82 | testD = testD + testmain[io] + "
" 83 | 84 | testcase.append(testD) 85 | mainTestCase.append(testcase) 86 | 87 | if testE != len(testmain): 88 | testcase = [] 89 | testD = "" 90 | testS = testmain.index('INPUT', testE) + 1 91 | testE = testmain.index('OUTPUT', testE) 92 | for io in range(testS, testE): 93 | testD = testD + testmain[io] + "
" 94 | 95 | testcase.append(k) 96 | testcase.append("TEST CASE 2") 97 | testcase.append(testD) 98 | testD = "" 99 | testS = testmain.index('OUTPUT', testE) + 1 100 | if 'TEST CASE 3' in testmain: 101 | testE = testmain.index('TEST CASE 3') 102 | else: 103 | testE = len(testmain) 104 | for io in range(testS, testE): 105 | testD = testD + testmain[io] + "
" 106 | 107 | testcase.append(testD) 108 | mainTestCase.append(testcase) 109 | 110 | if testE != len(testmain): 111 | testcase = [] 112 | testD = "" 113 | testS = testmain.index('INPUT', testE) + 1 114 | testE = testmain.index('OUTPUT', testE) 115 | for io in range(testS, testE): 116 | testD = testD + testmain[io] + "
" 117 | 118 | testcase.append(k) 119 | testcase.append("TEST CASE 3") 120 | testcase.append(testD) 121 | testD = "" 122 | testS = testmain.index('OUTPUT', testE) + 1 123 | if 'TEST CASE 4' in testmain: 124 | testE = testmain.index('TEST CASE 4') 125 | else: 126 | testE = len(testmain) 127 | for io in range(testS, testE): 128 | testD = testD + testmain[io] + "
" 129 | 130 | testcase.append(testD) 131 | mainTestCase.append(testcase) 132 | 133 | #print(k) 134 | print("Code Processed !!") 135 | print("Writing to disc...") 136 | sqlformula1 = "INSERT INTO elabdata (id, SESSION, QUESTION_NO, QUESTION_NAME, QUESTION_DESC, CODE)" \ 137 | " VALUES (%s, %s, %s, %s, %s, %s)" 138 | val = (k,SESSION,"Q. "+str(k)+":", NAME,question, code) 139 | mycursor.execute(sqlformula1,val) 140 | 141 | sqlformula2 = "INSERT INTO elabtestcase (dataid, TESTCASE_NO, INPUT, OUTPUT) VALUES (%s, %s, %s, %s)" 142 | mycursor.executemany(sqlformula2, mainTestCase) 143 | 144 | mydb.commit() 145 | print("Data Transferred!!") 146 | print("Completed - "+str(k)) 147 | 148 | else: 149 | err = colored('Error : ', 'red') 150 | text = colored('iostream headerfile is missing...', 'green') 151 | print(err + text) 152 | 153 | 154 | 155 | # x-axis -- COMMON Y = 525 156 | # -- x DIFF = 198 (-1085 to -292) 157 | 158 | #251 , 335, 417, 506, 586, 673 159 | def menudrive(): 160 | global k 161 | #print(pyautogui.position()) 162 | for i in range(251, 678, 85): 163 | for j in range(-1085, -292, 198): 164 | k = k + 1 165 | if k <= 100: 166 | pyautogui.click(j, i) 167 | time.sleep(3) 168 | SelectCode() 169 | time.sleep(1) 170 | pyautogui.click(-623, 64) 171 | 172 | 173 | k = 0 174 | for menu in range(4): 175 | time.sleep(0.5) 176 | menudrive() 177 | #pyautogui.click(-1262, 307) 178 | pyautogui.keyDown('pagedown') 179 | #print(pyautogui.position()) 180 | #SelectCode() -------------------------------------------------------------------------------- /C.py: -------------------------------------------------------------------------------- 1 | import pyautogui 2 | import win32clipboard 3 | import time 4 | import mysql.connector 5 | from termcolor import colored 6 | import pyttsx3 7 | 8 | def Talk(speech): 9 | engine = pyttsx3.init() 10 | voice = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens\TTS_MS_EN-US_ZIRA_11.0" 11 | engine.setProperty('voice',voice) 12 | engine.say(speech) 13 | engine.runAndWait() 14 | 15 | 16 | mydb = mysql.connector.connect( 17 | host="HOST", 18 | database="DATABASE", 19 | user="USER", 20 | password="PASSWORD" 21 | ) 22 | 23 | mycursor = mydb.cursor() 24 | def SelectCode(): 25 | global k 26 | #SELECT 27 | Talk("Checking Code Compatibility...") 28 | print("SELECTING CODE...") 29 | #-682, 320 30 | #-763, 249 to -756, 656 31 | pyautogui.click(-763, 249, button='left') 32 | time.sleep(1) 33 | pyautogui.hotkey("ctrl","a") 34 | pyautogui.hotkey("ctrl","c") 35 | time.sleep(0.1) 36 | print("Started Copying") 37 | win32clipboard.OpenClipboard() 38 | data = win32clipboard.GetClipboardData() 39 | win32clipboard.CloseClipboard() 40 | #print(data) 41 | 42 | print("Copied to Clipboard") 43 | print("Processing ...") 44 | data = list(data.split("\r\n")) 45 | SESSION_temp = data[2] 46 | SESSION_temp = list(SESSION_temp.split(' ')) 47 | SESSION = "" 48 | for sess in SESSION_temp: 49 | if sess != 'SESSION:': 50 | SESSION = SESSION + sess + " " 51 | NAME = data[4] 52 | code = "" 53 | question = "" 54 | testcase = [] 55 | temp = [] 56 | mainTestCase = [] 57 | for dat in data: 58 | if dat != "": 59 | temp.append(dat) 60 | 61 | if '#include ' in temp: 62 | Talk("Starting Code Transfer...") 63 | codeS = temp.index('#include ') 64 | for codeI in range(codeS,len(temp)): 65 | code = code + temp[codeI] + '\r\n' 66 | 67 | if 'QUESTION DESCRIPTION' in temp: 68 | QUESTIONS = temp.index('QUESTION DESCRIPTION') 69 | QUESTIONE = temp.index('TEST CASE 1') 70 | for QI in range(QUESTIONS+1, QUESTIONE): 71 | question = question + temp[QI] + '
' 72 | 73 | testmain = [] 74 | for testdata in range(QUESTIONE,codeS): 75 | testmain.append(temp[testdata]) 76 | 77 | testD = "" 78 | testS = testmain.index('INPUT') + 1 79 | testE = testmain.index('OUTPUT') 80 | for io in range(testS, testE): 81 | testD = testD + testmain[io] + "
" 82 | 83 | testcase.append(k) 84 | testcase.append("TEST CASE 1") 85 | testcase.append(testD) 86 | testD = "" 87 | testS = testmain.index('OUTPUT') + 1 88 | if 'TEST CASE 2' in testmain: 89 | testE = testmain.index('TEST CASE 2') 90 | else: 91 | testE = len(testmain) 92 | for io in range(testS, testE): 93 | testD = testD + testmain[io] + "
" 94 | 95 | testcase.append(testD) 96 | mainTestCase.append(testcase) 97 | 98 | if testE != len(testmain): 99 | testcase = [] 100 | testD = "" 101 | testS = testmain.index('INPUT', testE) + 1 102 | testE = testmain.index('OUTPUT', testE) 103 | for io in range(testS, testE): 104 | testD = testD + testmain[io] + "
" 105 | 106 | testcase.append(k) 107 | testcase.append("TEST CASE 2") 108 | testcase.append(testD) 109 | testD = "" 110 | testS = testmain.index('OUTPUT', testE) + 1 111 | if 'TEST CASE 3' in testmain: 112 | testE = testmain.index('TEST CASE 3') 113 | else: 114 | testE = len(testmain) 115 | for io in range(testS, testE): 116 | testD = testD + testmain[io] + "
" 117 | 118 | testcase.append(testD) 119 | mainTestCase.append(testcase) 120 | 121 | if testE != len(testmain): 122 | testcase = [] 123 | testD = "" 124 | testS = testmain.index('INPUT', testE) + 1 125 | testE = testmain.index('OUTPUT', testE) 126 | for io in range(testS, testE): 127 | testD = testD + testmain[io] + "
" 128 | 129 | testcase.append(k) 130 | testcase.append("TEST CASE 3") 131 | testcase.append(testD) 132 | testD = "" 133 | testS = testmain.index('OUTPUT', testE) + 1 134 | if 'TEST CASE 4' in testmain: 135 | testE = testmain.index('TEST CASE 4') 136 | else: 137 | testE = len(testmain) 138 | for io in range(testS, testE): 139 | testD = testD + testmain[io] + "
" 140 | 141 | testcase.append(testD) 142 | mainTestCase.append(testcase) 143 | 144 | #print(k) 145 | print("Code Processed !!") 146 | print("Writing to disc...") 147 | sqlformula1 = "INSERT INTO elabdata (id, SESSION, QUESTION_NO, QUESTION_NAME, QUESTION_DESC, CODE)" \ 148 | " VALUES (%s, %s, %s, %s, %s, %s)" 149 | val = (k,SESSION,"Q. "+str(k)+":", NAME,question, code) 150 | mycursor.execute(sqlformula1,val) 151 | 152 | sqlformula2 = "INSERT INTO elabtestcase (dataid, TESTCASE_NO, INPUT, OUTPUT) VALUES (%s, %s, %s, %s)" 153 | mycursor.executemany(sqlformula2, mainTestCase) 154 | 155 | mydb.commit() 156 | print("Data Transferred!!") 157 | Talk("Code Successfully Transfered.") 158 | print("Completed - "+str(k)) 159 | Talk("Completed Question "+str(k)) 160 | 161 | else: 162 | err = colored('Error : ', 'red') 163 | text = colored('stdio headerfile is missing...', 'green') 164 | print(err + text) 165 | Talk(err + text) 166 | 167 | 168 | 169 | # x-axis -- COMMON Y = 525 170 | # -- x DIFF = 198 (-1085 to -292) 171 | 172 | #251 , 335, 417, 506, 586, 673 173 | def menudrive(): 174 | global k 175 | #print(pyautogui.position()) 176 | for i in range(251, 678, 85): 177 | for j in range(-1085, -292, 198): 178 | k = k + 1 179 | if k <= 200: 180 | Talk("Starting Question "+str(k)) 181 | pyautogui.click(j, i) 182 | time.sleep(3) 183 | SelectCode() 184 | time.sleep(1) 185 | pyautogui.click(-623, 64) 186 | 187 | 188 | k = 100 189 | for menu in range(4): 190 | time.sleep(0.5) 191 | menudrive()#620,51 192 | #pyautogui.click(-1262, 307) 193 | pyautogui.keyDown('pagedown') 194 | #print(pyautogui.position()) 195 | #pyautogui.click(-623, 64) 196 | #SelectCode() --------------------------------------------------------------------------------