#include #include #include #include #include #Region $Form1 = GUICreate("Automatic Programming Tool", 696, 336, 192, 124, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_TABSTOP)) $Input1 = GUICtrlCreateInput("", 56, 76, 498, 21) GUICtrlSetLimit(-1, 100) GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xFFFFFF) $Input2 = GUICtrlCreateInput("", 56, 156, 490, 21) GUICtrlSetLimit(-1, 100) GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xFFFFFF) $cancel = GUICtrlCreateButton("Cancel", 584, 296, 75, 25) GUICtrlSetColor(-1, 0x000000) $Ok = GUICtrlCreateButton("OK", 488, 296, 75, 25) GUICtrlSetColor(-1, 0x000000) $Label1 = GUICtrlCreateLabel("Location of Flashing files", 64, 48, 175, 22) GUICtrlSetFont(-1, 10, 800, 0, "@Arial Unicode MS") GUICtrlSetColor(-1, 0xFF0000) $Label2 = GUICtrlCreateLabel("Location of CANoe Configuration", 64, 128, 229, 22) GUICtrlSetFont(-1, 10, 800, 0, "@Arial Unicode MS") GUICtrlSetColor(-1, 0xFF0000) $hello=GUICtrlCreateInput("", 64, 232, 73, 21,$ES_NUMBER) GUICtrlSetColor(-1, 0x001234) $Label3 = GUICtrlCreateLabel("No. of times to be flashed", 56, 200, 180, 22) GUICtrlSetFont(-1, 10, 800, 0, "@Arial Unicode MS") GUICtrlSetColor(-1, 0xFF0000) $Browse_1 = GUICtrlCreateButton("Browse...", 568, 72, 75, 25) GUICtrlSetColor(-1, 0x000000) $Button4 = GUICtrlCreateButton("Browse...", 568, 152, 75, 25) GUICtrlSetColor(-1, 0x000000) GUISetState(@SW_SHOW) #EndRegion ;Assignments Global $auto_1=ControlGetText("Automatic Programming Tool","",9) ;Sleep(5000) ;MsgBox(0,"",$auto_1) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE,$cancel Exit Case $Browse_1 global $txt=FileOpenDialog("Open", "C:\","Text files (*.Zip)") GUICtrlSetData($Input1,$txt) Global $data=ControlGetText("Automatic Programming Tool","",$Input1) Case $Ok GUIDelete("Automatic Programming Tool") DPS() EndSwitch WEnd Func DPS() $open=run("C:\DPS\dps.exe") If not $open Then MsgBox(0&$MB_ICONQUESTION,"Note","DPS is not installed in the system") EndIf WinWaitActive("Development Programming System","","") send("{ALT}" & "{ENTER 2}") WinWaitActive("Development Programming System - Programming1","","") send("g") sleep(500) if auto_1>1 Then send("+{TAB}" & "{+}") WinWaitActive("Auto Repeat Mode","","") send("{TAB}") sleep(200) send("{+}") sleep(200) send("{TAB}") sleep(200) send($auto_1) sleep(200) send("{ENTER}") sleep(200) ;send("{UP 5}" & "{ENTER}") flash() EndIf send("{TAB 6}" & "{ENTER}") flash() EndFunc Func flash() WinWaitActive("Open","","") send($data & "{ENTER}") WinWaitClose("Open","","") sleep(200) ;send("{DOWN}" & "{ENTER}") sleep(3000) If WinActive("dps")Then ; Check if Notepad is currently active. MsgBox($MB_SYSTEMMODAL,"Error","Error occured during Programming") EndIf EndFunc