Sign in to follow this  
Followers 0
vishu

Application Timeout

10 posts in this topic

Hi,

I have a query I have attached a snap shot, But not sure if you are able to see it in the text body.

Here I have an IP and Module selection Text Box, the use of it is like I have an excel sheet with different IP's based on whatever IP's I select from the drop down the corresponding sheet will be highlighted same w.r.t the Modules also.

The problem which am facing is am able to make the selecvtion only once and the appliaction won't accept the selection if made for the second time.I mean first I will slect 118 IP then 118 sheet is activated , but in the meanwhile I make a choice of selecting 114 and if I select the corresponding excel sheet is not getting activated.Also I have a problem where to accomdate the while loop because the application needs to wait for the user to make his choice but my application is going for a timeout.

I have 2 scripts first one stated below is the variables declaration script and the second one is the Main script .Pl suggest.

=============================================== Variable file ===================================================================

Pl save this file with the following name : "TS_Automator_Variables.au3"

;$sFilePath is the variable which contains the path of All Stream Details.

Global $sFilePath

;$readedit is the variable which holds the Control ID of the text box created to enter the row number.

Global $readedit

;$currentrangeselection is the variable which stores the frequency value read from the Combo box.

Global $currentrangeselection

;$hCombo is the variable which holds the control ID of the Combo Box having a range of frequencies.

Global $hCombo

;$chkbox is the variable to read if looping is enabled for Automation.

Global $chkbox

;$module is the variable which holds the control ID of the Combo box having a range of Modules

Global $module

;$mod is the variable which holds the Module selected.

Global $mod

;$modulator is the variable which holds the control ID of the Combo Box having a range of Modulator IPs.

Global $modulator

;$modip is the variable which holds the Modulator IP chosen by the user.

Global $modip

;$OKappbutton is the variable which holds the COntrol ID of the OK Button created.

Global $OKappbutton

;$infoitem is the variable which holds the Control ID for the Info option in Menu.

Global $infoitem

;$Mobility is the variable which holds the Control ID of the Radio button created.

Global $Mobility

; $MobilityRead is the variable which holds the data whether Mobility is enabled or disabled.

Global $MobilityRead

;$copystream is the variable which holds the stream name set in the Dectec.

Global $copystream

;$redvalue is the variable which accepts the 3 digit numerals for reading the row numbers from excel file

Global $redvalue = String(3)

;$sCellValue is the variable which holds the Stream name read from the All Stream Details.

Global $sCellValue

;Excel object

Global $oExcel

;$Startappbuttn is the variable which holds the Control ID for the Start button created.

Global $Startappbuttn

;$setvaluebuttn is the variable which holds the Control ID for the Setvalue button created.

Global $setvaluebuttn

;$Automateappbuttn is the variable which holds the Control ID for the Automate button created.

Global $Automateappbuttn

;$msg is the variable which holds the Control ID of an event.

Global $msg

;$exitappbuttn is the variable which holds the Control ID for the Exit button created.

Global $exitappbuttn

;$delay is the variable which holds the Control ID for the Text box created to enter the delay.

Global $delay

;$userdelay is the variable which reads the delay entered by the user.

Global $userdelay

;Variables which hold the Control ID for the text box created to enter the streams in the Automate UI.

Global $readfirstautoedit,$readsecondautoedit,$readthirdautoedit,$readfourthautoedit,$readfifthautoedit,$readsixthautoedit,$readseventhautoedit,$readeighthautoedit,$readninethautoedit,$readTenthautoedit

;Variables which hold the streams entered by the user in the Text box of the Automate UI.

Global $firstvalue,$secondvalue,$thirdvalue,$fourthvalue,$fifthvalue,$fifthvalue,$sixthvalue,$seventhvalue,$eigthvalue,$ninethvalue,$tenthvalue

;Variables which hold the Control IDs of the Combo box having the range of frequencies

Global $hCombo1,$hCombo2,$hCombo3,$hCombo4,$hCombo5,$hCombo6,$hCombo7,$hCombo8,$hCombo9,$hCombo10

;Array consisting of the variables which hols the Mobility related frequencies selected by the user in Automate UI.

Global $Class[50] = ["Edit2","Edit4","Edit6","Edit8","Edit10","Edit12","Edit14","Edit16","Edit18","Edit20"]

;$setappfreq is the variable which holds the frequency that is set in the Dektec.

Global $setappfreq

===================================================================================================================================

=============================================== Main file ===================================================================

Pl save this file in the following name : "TS Automator_Final.au3"

#include <Excel.au3> ;library for doing excel operations

#include <GUIConstantsEx.au3>

#include <Misc.au3>

#include <Array.au3>

#include <file.au3>

#include <TS_Automator_Variables.au3>

#include-Once

Opt("GUICoordMode", 1)

;Checking to see if the AllStreamDetails.xls is already opened

If WinExists("Microsoft Excel - AllStreamDetails.xls") Then

MsgBox(0, "", "The Excel file is already open")

Else

;Reading the files from Desktop

;This file should already exist on the desktop

$sFilePath = @DesktopDir & "\AllStreamDetails.xls"

;Opening the Excel file

$oExcel = _ExcelBookOpen($sFilePath)

EndIf

;Error handling in case the excel file is not existing

If @error = 1 Then

MsgBox(0, "Error!", "Unable to Create the Excel Object")

Exit

ElseIf @error = 2 Then

MsgBox(0, "Error!", "File does not exist - Please copy the AllStreamDetails.xls onto your desktop and try")

Exit

EndIf

;Calling the GUI create function

createGUI()

About()

Func createGUI()

$hGUI = GUICreate("TS-Automator",380,220)

GUICtrlCreateLabel("Enter the Modulator IP:",10,30,250,75)

;Combo box with default value as 172.24.18.114

$modulator = GUICtrlCreateCombo("172.24.18.114", 270, 20, 105, 40)

;Combo box with the range of Modulators

GUICtrlSetData(-1, "172.24.18.118|172.24.18.239","")

GUICtrlCreateLabel("Enter the Module:",10,55,250,75)

;Combo box with default value as EMM

$module = GUICtrlCreateCombo("[EMM]", 270, 45, 105, 40)

;Combo box with the range of Modules

GUICtrlSetData(-1, "[EWS]|[special Service]|[Parental Rating]|[Region ID]|[Version Change]|[LOGO]|[Frequency List]|[OAD]|[superimpose]|[Caption]|[EPG]|[Partial Stream]|[Audio Toggling]|[Others]","")

GUICtrlCreateLabel("Enter the Row Number of the stream to be loaded :",10,80,250,75)

$readedit = GUICtrlCreateInput(" ",270,75,75,20)

GUICtrlCreateLabel("Select the Frequency to be set from the list:",10,110,250,50)

;Combo box with default value as 473.000

$hCombo = GUICtrlCreateCombo("473.000", 270, 100, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$Automateappbuttn = GUICtrlCreateButton("Automate",220,150,70)

$setvaluebuttn = GUICtrlCreateButton("Set Value",30,150,70,25)

$exitappbuttn = GUICtrlCreateButton("Exit",120,150,70)

$helpmenu = GUICtrlCreateMenu("About")

;creating the info sub menu

$infoitem = GUICtrlCreateMenuItem("Info", $helpmenu)

;Making the GUI visible to the end user

GUISetState()

;~ sleep(2000)

;~ While($msg <> $setvaluebuttn)

;~ readmodule()

;~ Search()

;~ WEnd

EndFunc

Func About()

GUICreate("About",320,145)

Local $Msgfonts

$Msgfonts = "Comic Sans MS"

GUISetFont(8, 500, 0, $Msgfonts)

GUICtrlCreateLabel("** Developed by Vishwas K S and Chandana Prakash of CSG-SQE** ", 5, 30)

GUICtrlCreateLabel("** LG Soft India Pvt Ltd ** ", 5, 50)

GUICtrlCreateLabel("** Version : 0.0a ** ", 5, 70)

GUISetFont(7, 400, 0, $Msgfonts)

$OKappbutton = GUICtrlCreateButton("OK", 120, 100, 80)

GUISetState()

EndFunc

Func Exitabout()

;deleting the launched About UI

GUISetState(@SW_HIDE)

EndFunc

;~ Initiate()

;This function validates the user entry of the Excel row number based on positive value calls the setvalue function

Func validate()

$redvalue = GUICtrlRead($readedit);Reads the row number entered by the user.

If(Int($redvalue)) Then

Initiate()

Else

MsgBox(16, "Error", "Please enter numeric values only")

GUICtrlSetData($readedit,"")

EndIf

EndFunc

Func Initiate()

msgbox(0,"","entering Initaite")

$char = GUICtrlRead($readedit);Read the row number

$modip = GUICtrlRead($modulator);Read the modulator chosen by the user

Select

Case $modip = "172.24.18.114"

;Checking for Invalid rows

If ($char=1 Or $char=2 Or $char=6 Or $char=11 Or $char=15 Or $char=25 Or $char=30 Or $char=34 Or $char=47 Or $char=63 Or $char=76 Or $char=79 Or $char=114 Or $char=164 Or $char=168 Or $char=182 Or $char>189) Then

Else

;Proceed if valid row number is chosen.

WinActivate("Microsoft Excel - AllStreamDetails.xls")

$characteristics = _ExcelReadCell($oExcel,$char,4)

MsgBox(0,"Characteristics",$characteristics);Display the characteristics of the selected stream.

setvalue()

EndIf

Case $modip = "172.24.18.118"

;Checking for Invalid rows

If ($char=1 Or $char=2 Or $char=7 Or $char=17 Or $char=21 Or $char=31 Or $char=36 Or $char=40 Or $char=53 Or $char=69 Or $char=87 Or $char=90 Or $char=122 Or $char=175 Or $char=179 Or $char=195 Or $char>203) Then

MsgBox(0,"Error","Invalid Row number selected")

ControlSetText("[CLASS:AutoIt v3 GUI]","","Edit3","")

sleep(3000)

readmodule()

Else

;Proceed if valid row number is chosen.

WinActivate("Microsoft Excel - AllStreamDetails.xls")

$characteristics = _ExcelReadCell($oExcel,$char,4)

MsgBox(0,"Characteristics",$characteristics);Display the characteristics of the selected stream.

setvalue()

EndIf

Case $modip = "172.24.18.239"

;Checking for Invalid rows

If ($char=1 Or $char=2 Or $char=6 Or $char=11 Or $char=15 Or $char=25 Or $char=30 Or $char=34 Or $char=44 Or $char=53 Or $char=56 Or $char=58 Or $char=77 Or $char=101 Or $char=104 Or $char=114 Or $char>118) Then

MsgBox(0,"Error","Invalid Row number selected")

ControlSetText("[CLASS:AutoIt v3 GUI]","","Edit3","")

sleep(3000)

readmodule()

Else

;Proceed if valid row number is chosen.

WinActivate("Microsoft Excel - AllStreamDetails.xls")

$characteristics = _ExcelReadCell($oExcel,$char,4)

MsgBox(0,"Characteristics",$characteristics);Display the characteristics of the selected stream.

setvalue()

EndIf

EndSelect

EndFunc

;This function reads the Modulator chosen by the user.

Func readmodule()

$modip = GUICtrlRead($modulator); read the Modulator IP chosen by the user.

;Activate the particular sheet in All Stream Details depending on the Modulator IP chosen by the user.

Select

Case $modip = "172.24.18.114"

_ExcelSheetActivate($oExcel, "ISDB-T Stream Details_Mod-114")

Case $modip = "172.24.18.118"

_ExcelSheetActivate($oExcel, "ISDB-T Stream Details_Mod-118")

Case $modip = "172.24.18.239"

_ExcelSheetActivate($oExcel, "ISDB-T Stream Details_Mod-239")

EndSelect

EndFunc

;This function is used to search the location of the module name entered by the user and highlight it.

Func Search()

Local $i, $concat

$mod = GUICtrlRead($module)

For $i = 2 To 205

$readmodule = _ExcelReadCell($oExcel,$i,1)

If($mod = $readmodule) Then

$concat = "A" & $i

$oExcel.Activesheet.Range($concat).select

;~ MsgBox(0,"Module read from the Stream details",$readmodule )

EndIf

Next

EndFunc

Func setvalue()

Local $currentlistselection

;~ ;If condition which reads the combobox to find the current selection

If GUICtrlRead($hCombo) <> $currentlistselection Then

;Reads the new selection value to $hCombo variable

$currentlistselection = GUICtrlRead($hCombo)

;MsgBox(0, "", "The Cell Value is: " & @CRLF & $currentlistselection, 2)

EndIf

;Activates the already opened Dektec application

WinActivate("DekTec StreamXpress - Transport-Stream Player")

;Moves the application to screen co-ordinates to 0,0

WinMove("DekTec StreamXpress - Transport-Stream Player", "", 0, 0)

;Delay needed to ensure the dektec in moved to the left top corner

Sleep(500)

;Reading the file -> $oExcel, Reading the row number -> $redvalue,Reading the column -> 2

If IsString($sCellValue)Then

$sCellValue = _ExcelReadCell($oExcel, $redvalue, 2)

MsgBox(0, "", "The Cell Value is: " & @CRLF & $sCellValue, 2)

ElseIf $sCellValue = "" Then

MsgBox(0, "", "The Cell number selected is invalid: ")

EndIf

;This commented lines reads the current stream being played by the streamer xpress app

;local $getstreamervalue

;$getstreamervalue = ControlGetText("DekTec StreamXpress - Transport-Stream Player", "", "Edit1")

;MsgBox(0, "", "The stream being played is: " & @CRLF & $getstreamervalue, 2)

;This commented lines reads the current frequency selected in the streamer xpress app

;local $getstreamerfreq

;$getstreamerfreq = ControlGetText("Streamer set Frequency is:", "", "Edit2")

;MsgBox(0, "", "The streamer frequency Value is: " & @CRLF & $getstreamerfreq, 2)

Local $setstream

;Button1 clicks the "open" button in Dektec app

ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button1")

;Activating the UI which appears after clicking the "open" button

WinActivate("Open MPEG-2 Transport Stream")

;Delay provided to ensure the above window is launched

sleep(2000)

;Setting the stream path read from "$sCellValue"(Excel file) onto the Text box(Edit1) before the Open button

$setstream = ControlSetText ("Open MPEG-2 Transport Stream", " ", "Edit1", $sCellValue)

;MsgBox(0, "", "The Cell Value is: " & @CRLF & $sCellValue, 2)

;Delay provided to esnure the read stream path is copied onto the textbox(Edit1)

sleep(1000)

;Pressing the Open button(Button2) to ensure the selected stream is opened in streamer application

ControlClick("Open MPEG-2 Transport Stream", "", "Button2")

;MsgBox(0, "", "The stream being played is: " & @CRLF & $setstream, 2)

WinActivate("TS-Automator")

local $getappfreq

;Reading the frequency from our application and storing in $getappfreq

$getappfreq = ControlGetText("TS-Automator", "", "Edit4")

MsgBox(0, "", "The application frequency Value is: " & @CRLF & $getappfreq, 2)

;Copying the read frequency value to the streamer application(Edit6) text box

$setappfreq = ControlSetText ( "DekTec StreamXpress - Transport-Stream Player", " ", "Edit6", $getappfreq)

;Ensuring the playback is stopped in streamer application

ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button21","left",2)

sleep(1000)

;Ensuring the play button is pressed to start the current selected stream playback

ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button19","left",2)

EndFunc

Func Automate()

$hGUI = GUICreate("Automate",450,500)

GUICtrlCreateLabel("First Stream Path :",8,20,130,15)

GUICtrlCreateLabel("Second Stream Path :",8,60,130,15)

GUICtrlCreateLabel("Third Stream Path :",8,100,130,15)

GUICtrlCreateLabel("Fourth Stream Path :",8,140,130,15)

GUICtrlCreateLabel("Fifth Stream Path :",8,180,130,15)

GUICtrlCreateLabel("Sixth Stream Path :",8,220,130,15)

GUICtrlCreateLabel("Seventh Stream Path :",8,260,130,15)

GUICtrlCreateLabel("Eighth Stream Path :",8,300,130,15)

GUICtrlCreateLabel("Nineth Stream Path :",8,340,130,15)

GUICtrlCreateLabel("Tenth Stream Path :",8,380,130,15)

$readfirstautoedit = GUICtrlCreateInput("", 140,20,200,20)

$hCombo1 = GUICtrlCreateCombo("473.000", 360, 20, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readsecondautoedit = GUICtrlCreateInput("",140,60,200,20)

$hCombo2 = GUICtrlCreateCombo("473.000", 360, 60, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readthirdautoedit = GUICtrlCreateInput("",140,100,200,20)

$hCombo3 = GUICtrlCreateCombo("473.000", 360, 100, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readfourthautoedit = GUICtrlCreateInput("",140,140,200,20)

$hCombo4 = GUICtrlCreateCombo("473.000", 360, 140, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readfifthautoedit = GUICtrlCreateInput("",140,180,200,20)

$hCombo5 = GUICtrlCreateCombo("473.000", 360, 180, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readsixthautoedit = GUICtrlCreateInput("",140,220,200,20)

$hCombo6 = GUICtrlCreateCombo("473.000", 360, 220, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readseventhautoedit = GUICtrlCreateInput("",140,260,200,20)

$hCombo7 = GUICtrlCreateCombo("473.000", 360, 260, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readeighthautoedit = GUICtrlCreateInput("",140,300,200,20)

$hCombo8 = GUICtrlCreateCombo("473.000", 360, 300, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readninethautoedit = GUICtrlCreateInput("",140,340,200,20)

$hCombo9 = GUICtrlCreateCombo("473.000", 360, 340, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readTenthautoedit = GUICtrlCreateInput("",140,380,200,20)

$hCombo10 = GUICtrlCreateCombo("473.000", 360, 380, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$Mobility= GUICtrlCreateCheckbox("Mobility", 290, 433, 120, 20)

GUICtrlGetState($Mobility)

;Creating the delay button

GUICtrlCreateLabel("Delay",60,439,30,25)

$delay = GUICtrlCreateInput("", 90,433 ,30,20)

;Loop button checkbox

$chkbox = GUICtrlCreateCheckbox("Loop", 170, 433, 120, 20)

GUICtrlGetState($chkbox)

;Creating the Start button

$Startappbuttn = GUICtrlCreateButton("Start",55,460,70)

;The object refers to the already defined Exit button

$exitappbuttn = GUICtrlCreateButton("Exit",165,460,70)

GUISetState()

EndFunc

Func Batch()

if WinExists("Automate") Then

WinActivate("Automate")

$read = GUICtrlRead($chkbox);Check if the user has enabled the loop option

$MobilityRead=GUICtrlRead($Mobility)

if $read = $GUI_CHECKED Then

While(1)

$userdelay = GUICtrlRead($delay);Read the delay entered by the user

If (Int($userdelay)) Then

msgbox(0,"Delay","User defined delay is:"& @CRLF & $userdelay,1)

If $MobilityRead = $GUI_CHECKED Then

Mobility()

Else

setstream()

Endif

Else

MsgBox(16, "Error", "Please enter numeric values only")

EndIf

WEnd

Else

$userdelay = GUICtrlRead($delay);Read the delay entered by the user

If (Int($userdelay)) Then

msgbox(0,"Delay","User defined delay is:"& @CRLF & $userdelay,1)

If $MobilityRead = $GUI_CHECKED Then

Mobility()

Else

setstream()

Endif

Else

MsgBox(16, "Error", "Please enter numeric values only")

EndIf

EndIf

Endif

EndFunc

Func getvalues()

;reading the values from the text box for all the paths in Automate screen

$firstvalue = GUICtrlRead($readfirstautoedit)

$secondvalue = GUICtrlRead($readsecondautoedit)

$thirdvalue = GUICtrlRead($readthirdautoedit)

$fourthvalue = GUICtrlRead($readfourthautoedit)

$fifthvalue = GUICtrlRead($readfifthautoedit)

$sixthvalue = GUICtrlRead($readsixthautoedit)

$seventhvalue = GUICtrlRead($readseventhautoedit)

$eigthvalue = GUICtrlRead($readeighthautoedit)

$ninethvalue = GUICtrlRead($readninethautoedit)

EndFunc

Func setstream()

getvalues()

Local $Frequency

$Frequency = ControlGetText("Automate", "", "Edit2")

MsgBox(0,"Frequency",$Frequency,1 )

;Copying the read frequency value to the streamer application(Edit6) text box

Local $setfreq = ControlSetText ( "DekTec StreamXpress - Transport-Stream Player", " ", "Edit6", $Frequency)

Local $i

for $i = 0 to 9 step 1

Local $path[50] = [$firstvalue, $secondvalue,$thirdvalue,$fourthvalue,$fifthvalue,$sixthvalue,$seventhvalue,$eigthvalue,$ninethvalue,$tenthvalue]

;Activates the already opened Dektec application

WinActivate("DekTec StreamXpress - Transport-Stream Player")

;Button1 clicks the "open" button in Dektec app

sleep(1000)

ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button1")

;Activating the UI which appears after clicking the "open" button

sleep(1000)

WinActivate("Open MPEG-2 Transport Stream")

;Setting the stream path read from the Automate UI onto the Text box(Edit1) before the Open button

$copystream = ControlSetText ("Open MPEG-2 Transport Stream", " ", "Edit1", $path[$i])

sleep(1000)

;~ MsgBox(0, "", "The stream being played is: " & @CRLF & $path[$i] , 1)

sleep(1000)

ControlClick("Open MPEG-2 Transport Stream", "", "Button2")

;Ensuring the playback is stopped in streamer application

ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button21","left",2)

sleep(1000)

;Ensuring the play button is pressed to start the current selected stream playback

ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button19","left",2)

;These lines read the current stream being played by the streamer xpress app

local $getstreamervalue

$getstreamervalue = ControlGetText("DekTec StreamXpress - Transport-Stream Player", "", "Edit1")

;~ MsgBox(0, "", "The stream being played is in streamer is: " & @CRLF & $getstreamervalue, 2)

sleep($userdelay)

Next

EndFunc

Func Mobility()

$firstvalue = GUICtrlRead($readfirstautoedit)

;Activates the already opened Dektec application

WinActivate("DekTec StreamXpress - Transport-Stream Player")

;Button1 clicks the "open" button in Dektec app

sleep(1000)

ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button1")

;Activating the UI which appears after clicking the "open" button

;~ sleep(1000)

WinActivate("Open MPEG-2 Transport Stream")

;Setting the stream path read from the Automate UI onto the Text box(Edit1) before the Open button

$copystream = ControlSetText ("Open MPEG-2 Transport Stream", " ", "Edit1", $firstvalue)

sleep(1000)

MsgBox(0, "", "The stream being played is: " & @CRLF & $firstvalue , 1)

sleep(1000)

ControlClick("Open MPEG-2 Transport Stream", "", "Button2")

;These lines read the current stream being played by the streamer xpress app

local $getstreamervalue

$getstreamervalue = ControlGetText("DekTec StreamXpress - Transport-Stream Player", "", "Edit1")

;~ MsgBox(0, "", "The stream being played is in streamer is: " & @CRLF & $getstreamervalue, 2)

for $j=0 To 9

local $getMFNfreq

;Reading the frequency from our application and storing in $getappfreq

$getMFNfreq = ControlGetText("Automate", "", $Class[$j])

MsgBox(0,"Frequency",$getMFNfreq,1 )

;Copying the read frequency value to the streamer application(Edit6) text box

Local $setappfreq = ControlSetText ( "DekTec StreamXpress - Transport-Stream Player", " ", "Edit6", $getMFNfreq)

;Ensuring the playback is stopped in streamer application

ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button21","left",2)

sleep(2000)

;Ensuring the play button is pressed to start the current selected stream playback

ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button19","left",2)

sleep($userdelay)

Next

EndFunc

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

WinActivate("Microsoft Excel - AllStreamDetails.xls")

_ExcelBookClose($oExcel,0)

Exit

Case $msg = $setvaluebuttn

validate()

Case $msg = $Automateappbuttn

Automate()

Case $msg = $Startappbuttn

Batch()

Case $msg = $infoitem

About()

Case $msg = $OKappbutton

Exitabout()

Case $msg = $exitappbuttn

_ExcelBookClose($oExcel,0)

Exit

EndSelect

WEnd

========================================================================================================================================

Thanks

Share this post


Link to post
Share on other sites



file:///C:/Documents%20and%20Settings/vishwas/Desktop/24th%20September%202010/Main%20screen.JPG

Share this post


Link to post
Share on other sites

Can you post a sample AllStreaDetails.xls. You should be post scripts like this.

TS_Automator_Variables.au3

;$sFilePath is the variable which contains the path of All Stream Details.
Global $sFilePath

;$readedit is the variable which holds the Control ID of the text box created to enter the row number.
Global $readedit

;$currentrangeselection is the variable which stores the frequency value read from the Combo box.
Global $currentrangeselection

;$hCombo is the variable which holds the control ID of the Combo Box having a range of frequencies.
Global $hCombo

;$chkbox is the variable to read if looping is enabled for Automation.
Global $chkbox

;$module is the variable which holds the control ID of the Combo box having a range of Modules
Global $module

;$mod is the variable which holds the Module selected.
Global $mod

;$modulator is the variable which holds the control ID of the Combo Box having a range of Modulator IPs.
Global $modulator

;$modip is the variable which holds the Modulator IP chosen by the user.
Global $modip

;$OKappbutton is the variable which holds the COntrol ID of the OK Button created.
Global $OKappbutton

;$infoitem is the variable which holds the Control ID for the Info option in Menu.
Global $infoitem

;$Mobility is the variable which holds the Control ID of the Radio button created.
Global $Mobility

; $MobilityRead is the variable which holds the data whether Mobility is enabled or disabled.
Global $MobilityRead

;$copystream is the variable which holds the stream name set in the Dectec.
Global $copystream

;$redvalue is the variable which accepts the 3 digit numerals for reading the row numbers from excel file
Global $redvalue = String(3)

;$sCellValue is the variable which holds the Stream name read from the All Stream Details.
Global $sCellValue

;Excel object
Global $oExcel

;$Startappbuttn is the variable which holds the Control ID for the Start button created.
Global $Startappbuttn

;$setvaluebuttn is the variable which holds the Control ID for the Setvalue button created.
Global $setvaluebuttn

;$Automateappbuttn is the variable which holds the Control ID for the Automate button created.
Global $Automateappbuttn

;$msg is the variable which holds the Control ID of an event.
Global $msg

;$exitappbuttn is the variable which holds the Control ID for the Exit button created.
Global $exitappbuttn

;$delay is the variable which holds the Control ID for the Text box created to enter the delay.
Global $delay

;$userdelay is the variable which reads the delay entered by the user.
Global $userdelay

;Variables which hold the Control ID for the text box created to enter the streams in the Automate UI.
Global $readfirstautoedit,$readsecondautoedit,$readthirdautoedit,$readfourthautoedit,$readfifthautoedit,$readsixthautoedit,$readseventhautoedit,$readeighthautoedit,$readninethautoedit,$readTenthautoedit

;Variables which hold the streams entered by the user in the Text box of the Automate UI.
Global $firstvalue,$secondvalue,$thirdvalue,$fourthvalue,$fifthvalue,$fifthvalue,$sixthvalue,$seventhvalue,$eigthvalue,$ninethvalue,$tenthvalue

;Variables which hold the Control IDs of the Combo box having the range of frequencies
Global $hCombo1,$hCombo2,$hCombo3,$hCombo4,$hCombo5,$hCombo6,$hCombo7,$hCombo8,$hCombo9,$hCombo10

;Array consisting of the variables which hols the Mobility related frequencies selected by the user in Automate UI.
Global $Class[50] = ["Edit2","Edit4","Edit6","Edit8","Edit10","Edit12","Edit14","Edit16","Edit18","Edit20"]

;$setappfreq is the variable which holds the frequency that is set in the Dektec.
Global $setappfreq

TS Automator_Final.au3

#include <Excel.au3> ;library for doing excel operations
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <Array.au3>
#include <file.au3>
#include <TS_Automator_Variables.au3>
#include-Once

Opt("GUICoordMode", 1)

;Checking to see if the AllStreamDetails.xls is already opened
If WinExists("Microsoft Excel - AllStreamDetails.xls") Then
MsgBox(0, "", "The Excel file is already open")
Else
;Reading the files from Desktop
;This file should already exist on the desktop
$sFilePath = @DesktopDir & "\AllStreamDetails.xls"
;Opening the Excel file
$oExcel = _ExcelBookOpen($sFilePath)
EndIf

;Error handling in case the excel file is not existing
If @error = 1 Then
MsgBox(0, "Error!", "Unable to Create the Excel Object")
Exit
ElseIf @error = 2 Then
MsgBox(0, "Error!", "File does not exist - Please copy the AllStreamDetails.xls onto your desktop and try")
Exit
EndIf

;Calling the GUI create function
createGUI()
About()

Func createGUI()

$hGUI = GUICreate("TS-Automator",380,220)

GUICtrlCreateLabel("Enter the Modulator IP:",10,30,250,75)
;Combo box with default value as 172.24.18.114
$modulator = GUICtrlCreateCombo("172.24.18.114", 270, 20, 105, 40)
;Combo box with the range of Modulators
GUICtrlSetData(-1, "172.24.18.118|172.24.18.239","")

GUICtrlCreateLabel("Enter the Module:",10,55,250,75)
;Combo box with default value as EMM
$module = GUICtrlCreateCombo("[EMM]", 270, 45, 105, 40)
;Combo box with the range of Modules
GUICtrlSetData(-1, "[EWS]|[Special Service]|[Parental Rating]|[Region ID]|[Version Change]|[LOGO]|[Frequency List]|[OAD]|[Superimpose]|[Caption]|[EPG]|[Partial Stream]|[Audio Toggling]|[Others]","")

GUICtrlCreateLabel("Enter the Row Number of the stream to be loaded :",10,80,250,75)
$readedit = GUICtrlCreateInput(" ",270,75,75,20)

GUICtrlCreateLabel("Select the Frequency to be set from the list:",10,110,250,50)
;Combo box with default value as 473.000
$hCombo = GUICtrlCreateCombo("473.000", 270, 100, 75, 20)
;Combo box with range of frequencies
GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$Automateappbuttn = GUICtrlCreateButton("Automate",220,150,70)
$setvaluebuttn = GUICtrlCreateButton("Set Value",30,150,70,25)
$exitappbuttn = GUICtrlCreateButton("Exit",120,150,70)

$helpmenu = GUICtrlCreateMenu("About")
;creating the info sub menu
$infoitem = GUICtrlCreateMenuItem("Info", $helpmenu)

;Making the GUI visible to the end user
GUISetState()

;~ sleep(2000)

;~ While($msg <> $setvaluebuttn)
;~ readmodule()
;~ Search()
;~ WEnd
EndFunc


Func About()
GUICreate("About",320,145)
Local $Msgfonts
$Msgfonts = "Comic Sans MS"
GUISetFont(8, 500, 0, $Msgfonts)
GUICtrlCreateLabel("** Developed by Vishwas K S and Chandana Prakash of CSG-SQE** ", 5, 30)
GUICtrlCreateLabel("** LG Soft India Pvt Ltd ** ", 5, 50)
GUICtrlCreateLabel("** Version : 0.0a ** ", 5, 70)
GUISetFont(7, 400, 0, $Msgfonts)
$OKappbutton = GUICtrlCreateButton("OK", 120, 100, 80)
GUISetState()
EndFunc


Func Exitabout()
;deleting the launched About UI
GUISetState(@SW_HIDE)
EndFunc

;~ Initiate()
;This function validates the user entry of the Excel row number based on positive value calls the setvalue function
Func validate()
$redvalue = GUICtrlRead($readedit);Reads the row number entered by the user.
If(Int($redvalue)) Then
Initiate()
Else
MsgBox(16, "Error", "Please enter numeric values only")
GUICtrlSetData($readedit,"")
EndIf
EndFunc


Func Initiate()
msgbox(0,"","entering Initaite")
$char = GUICtrlRead($readedit);Read the row number
$modip = GUICtrlRead($modulator);Read the modulator chosen by the user

Select
Case $modip = "172.24.18.114"
;Checking for Invalid rows
If ($char=1 Or $char=2 Or $char=6 Or $char=11 Or $char=15 Or $char=25 Or $char=30 Or $char=34 Or $char=47 Or $char=63 Or $char=76 Or $char=79 Or $char=114 Or $char=164 Or $char=168 Or $char=182 Or $char>189) Then

Else
;Proceed if valid row number is chosen.
WinActivate("Microsoft Excel - AllStreamDetails.xls")
$characteristics = _ExcelReadCell($oExcel,$char,4)
MsgBox(0,"Characteristics",$characteristics);Display the characteristics of the selected stream.
setvalue()
EndIf

Case $modip = "172.24.18.118"
;Checking for Invalid rows
If ($char=1 Or $char=2 Or $char=7 Or $char=17 Or $char=21 Or $char=31 Or $char=36 Or $char=40 Or $char=53 Or $char=69 Or $char=87 Or $char=90 Or $char=122 Or $char=175 Or $char=179 Or $char=195 Or $char>203) Then
MsgBox(0,"Error","Invalid Row number selected")
ControlSetText("[CLASS:AutoIt v3 GUI]","","Edit3","")
sleep(3000)
readmodule()
Else
;Proceed if valid row number is chosen.
WinActivate("Microsoft Excel - AllStreamDetails.xls")
$characteristics = _ExcelReadCell($oExcel,$char,4)
MsgBox(0,"Characteristics",$characteristics);Display the characteristics of the selected stream.
setvalue()
EndIf

Case $modip = "172.24.18.239"
;Checking for Invalid rows
If ($char=1 Or $char=2 Or $char=6 Or $char=11 Or $char=15 Or $char=25 Or $char=30 Or $char=34 Or $char=44 Or $char=53 Or $char=56 Or $char=58 Or $char=77 Or $char=101 Or $char=104 Or $char=114 Or $char>118) Then
MsgBox(0,"Error","Invalid Row number selected")
ControlSetText("[CLASS:AutoIt v3 GUI]","","Edit3","")
sleep(3000)
readmodule()
Else
;Proceed if valid row number is chosen.
WinActivate("Microsoft Excel - AllStreamDetails.xls")
$characteristics = _ExcelReadCell($oExcel,$char,4)
MsgBox(0,"Characteristics",$characteristics);Display the characteristics of the selected stream.
setvalue()
EndIf
EndSelect
EndFunc


;This function reads the Modulator chosen by the user.
Func readmodule()
$modip = GUICtrlRead($modulator); read the Modulator IP chosen by the user.
;Activate the particular sheet in All Stream Details depending on the Modulator IP chosen by the user.
Select
Case $modip = "172.24.18.114"
_ExcelSheetActivate($oExcel, "ISDB-T Stream Details_Mod-114")
Case $modip = "172.24.18.118"
_ExcelSheetActivate($oExcel, "ISDB-T Stream Details_Mod-118")
Case $modip = "172.24.18.239"
_ExcelSheetActivate($oExcel, "ISDB-T Stream Details_Mod-239")
EndSelect
EndFunc


;This function is used to search the location of the module name entered by the user and highlight it.
Func Search()
Local $i, $concat
$mod = GUICtrlRead($module)

For $i = 2 To 205
$readmodule = _ExcelReadCell($oExcel,$i,1)
If($mod = $readmodule) Then
$concat = "A" & $i
$oExcel.Activesheet.Range($concat).select
;~ MsgBox(0,"Module read from the Stream details",$readmodule )
EndIf
Next
EndFunc


Func setvalue()
Local $currentlistselection
;~ ;If condition which reads the combobox to find the current selection
If GUICtrlRead($hCombo) <> $currentlistselection Then
;Reads the new selection value to $hCombo variable
$currentlistselection = GUICtrlRead($hCombo)
;MsgBox(0, "", "The Cell Value is: " & @CRLF & $currentlistselection, 2)
EndIf
;Activates the already opened Dektec application
WinActivate("DekTec StreamXpress - Transport-Stream Player")

;Moves the application to screen co-ordinates to 0,0
WinMove("DekTec StreamXpress - Transport-Stream Player", "", 0, 0)
;Delay needed to ensure the dektec in moved to the left top corner
Sleep(500)
;Reading the file -> $oExcel, Reading the row number -> $redvalue,Reading the column -> 2
If IsString($sCellValue)Then
$sCellValue = _ExcelReadCell($oExcel, $redvalue, 2)
MsgBox(0, "", "The Cell Value is: " & @CRLF & $sCellValue, 2)
ElseIf $sCellValue = "" Then
MsgBox(0, "", "The Cell number selected is invalid: ")
EndIf

;This commented lines reads the current stream being played by the streamer xpress app
;local $getstreamervalue
;$getstreamervalue = ControlGetText("DekTec StreamXpress - Transport-Stream Player", "", "Edit1")
;MsgBox(0, "", "The stream being played is: " & @CRLF & $getstreamervalue, 2)

;This commented lines reads the current frequency selected in the streamer xpress app
;local $getstreamerfreq
;$getstreamerfreq = ControlGetText("Streamer set Frequency is:", "", "Edit2")
;MsgBox(0, "", "The streamer frequency Value is: " & @CRLF & $getstreamerfreq, 2)


Local $setstream
;Button1 clicks the "open" button in Dektec app
ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button1")
;Activating the UI which appears after clicking the "open" button
WinActivate("Open MPEG-2 Transport Stream")
;Delay provided to ensure the above window is launched
sleep(2000)
;Setting the stream path read from "$sCellValue"(Excel file) onto the Text box(Edit1) before the Open button
$setstream = ControlSetText ("Open MPEG-2 Transport Stream", " ", "Edit1", $sCellValue)
;MsgBox(0, "", "The Cell Value is: " & @CRLF & $sCellValue, 2)
;Delay provided to esnure the read stream path is copied onto the textbox(Edit1)
sleep(1000)
;Pressing the Open button(Button2) to ensure the selected stream is opened in streamer application
ControlClick("Open MPEG-2 Transport Stream", "", "Button2")
;MsgBox(0, "", "The stream being played is: " & @CRLF & $setstream, 2)

WinActivate("TS-Automator")
local $getappfreq
;Reading the frequency from our application and storing in $getappfreq
$getappfreq = ControlGetText("TS-Automator", "", "Edit4")
MsgBox(0, "", "The application frequency Value is: " & @CRLF & $getappfreq, 2)

;Copying the read frequency value to the streamer application(Edit6) text box
$setappfreq = ControlSetText ( "DekTec StreamXpress - Transport-Stream Player", " ", "Edit6", $getappfreq)
;Ensuring the playback is stopped in streamer application
ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button21","left",2)
sleep(1000)
;Ensuring the play button is pressed to start the current selected stream playback
ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button19","left",2)
EndFunc


Func Automate()
$hGUI = GUICreate("Automate",450,500)
GUICtrlCreateLabel("First Stream Path :",8,20,130,15)
GUICtrlCreateLabel("Second Stream Path :",8,60,130,15)
GUICtrlCreateLabel("Third Stream Path :",8,100,130,15)
GUICtrlCreateLabel("Fourth Stream Path :",8,140,130,15)
GUICtrlCreateLabel("Fifth Stream Path :",8,180,130,15)
GUICtrlCreateLabel("Sixth Stream Path :",8,220,130,15)
GUICtrlCreateLabel("Seventh Stream Path :",8,260,130,15)
GUICtrlCreateLabel("Eighth Stream Path :",8,300,130,15)
GUICtrlCreateLabel("Nineth Stream Path :",8,340,130,15)
GUICtrlCreateLabel("Tenth Stream Path :",8,380,130,15)

$readfirstautoedit = GUICtrlCreateInput("", 140,20,200,20)
$hCombo1 = GUICtrlCreateCombo("473.000", 360, 20, 75, 20)
;Combo box with range of frequencies
GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readsecondautoedit = GUICtrlCreateInput("",140,60,200,20)
$hCombo2 = GUICtrlCreateCombo("473.000", 360, 60, 75, 20)
;Combo box with range of frequencies
GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readthirdautoedit = GUICtrlCreateInput("",140,100,200,20)
$hCombo3 = GUICtrlCreateCombo("473.000", 360, 100, 75, 20)
;Combo box with range of frequencies
GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readfourthautoedit = GUICtrlCreateInput("",140,140,200,20)
$hCombo4 = GUICtrlCreateCombo("473.000", 360, 140, 75, 20)
;Combo box with range of frequencies
GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readfifthautoedit = GUICtrlCreateInput("",140,180,200,20)
$hCombo5 = GUICtrlCreateCombo("473.000", 360, 180, 75, 20)
;Combo box with range of frequencies
GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readsixthautoedit = GUICtrlCreateInput("",140,220,200,20)
$hCombo6 = GUICtrlCreateCombo("473.000", 360, 220, 75, 20)
;Combo box with range of frequencies
GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readseventhautoedit = GUICtrlCreateInput("",140,260,200,20)
$hCombo7 = GUICtrlCreateCombo("473.000", 360, 260, 75, 20)
;Combo box with range of frequencies
GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readeighthautoedit = GUICtrlCreateInput("",140,300,200,20)
$hCombo8 = GUICtrlCreateCombo("473.000", 360, 300, 75, 20)
;Combo box with range of frequencies
GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readninethautoedit = GUICtrlCreateInput("",140,340,200,20)
$hCombo9 = GUICtrlCreateCombo("473.000", 360, 340, 75, 20)
;Combo box with range of frequencies
GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readTenthautoedit = GUICtrlCreateInput("",140,380,200,20)
$hCombo10 = GUICtrlCreateCombo("473.000", 360, 380, 75, 20)
;Combo box with range of frequencies
GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$Mobility= GUICtrlCreateCheckbox("Mobility", 290, 433, 120, 20)
GUICtrlGetState($Mobility)

;Creating the delay button
GUICtrlCreateLabel("Delay",60,439,30,25)
$delay = GUICtrlCreateInput("", 90,433 ,30,20)

;Loop button checkbox
$chkbox = GUICtrlCreateCheckbox("Loop", 170, 433, 120, 20)
GUICtrlGetState($chkbox)

;Creating the Start button
$Startappbuttn = GUICtrlCreateButton("Start",55,460,70)
;The object refers to the already defined Exit button
$exitappbuttn = GUICtrlCreateButton("Exit",165,460,70)

GUISetState()
EndFunc


Func Batch()
if WinExists("Automate") Then
WinActivate("Automate")
$read = GUICtrlRead($chkbox);Check if the user has enabled the loop option
$MobilityRead=GUICtrlRead($Mobility)
if $read = $GUI_CHECKED Then
While(1)
$userdelay = GUICtrlRead($delay);Read the delay entered by the user
If (Int($userdelay)) Then
msgbox(0,"Delay","User defined delay is:"& @CRLF & $userdelay,1)
If $MobilityRead = $GUI_CHECKED Then
Mobility()
Else
setstream()
Endif
Else
MsgBox(16, "Error", "Please enter numeric values only")
EndIf
WEnd
Else

$userdelay = GUICtrlRead($delay);Read the delay entered by the user
If (Int($userdelay)) Then
msgbox(0,"Delay","User defined delay is:"& @CRLF & $userdelay,1)
If $MobilityRead = $GUI_CHECKED Then
Mobility()
Else
setstream()
Endif
Else
MsgBox(16, "Error", "Please enter numeric values only")
EndIf
EndIf
Endif
EndFunc


Func getvalues()
;reading the values from the text box for all the paths in Automate screen
$firstvalue = GUICtrlRead($readfirstautoedit)
$secondvalue = GUICtrlRead($readsecondautoedit)
$thirdvalue = GUICtrlRead($readthirdautoedit)
$fourthvalue = GUICtrlRead($readfourthautoedit)
$fifthvalue = GUICtrlRead($readfifthautoedit)
$sixthvalue = GUICtrlRead($readsixthautoedit)
$seventhvalue = GUICtrlRead($readseventhautoedit)
$eigthvalue = GUICtrlRead($readeighthautoedit)
$ninethvalue = GUICtrlRead($readninethautoedit)
EndFunc


Func setstream()
getvalues()
Local $Frequency
$Frequency = ControlGetText("Automate", "", "Edit2")
MsgBox(0,"Frequency",$Frequency,1 )
;Copying the read frequency value to the streamer application(Edit6) text box
Local $setfreq = ControlSetText ( "DekTec StreamXpress - Transport-Stream Player", " ", "Edit6", $Frequency)

Local $i
for $i = 0 to 9 step 1
Local $path[50] = [$firstvalue, $secondvalue,$thirdvalue,$fourthvalue,$fifthvalue,$sixthvalue,$seventhvalue,$eigthvalue,$ninethvalue,$tenthvalue]

;Activates the already opened Dektec application
WinActivate("DekTec StreamXpress - Transport-Stream Player")
;Button1 clicks the "open" button in Dektec app
sleep(1000)
ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button1")
;Activating the UI which appears after clicking the "open" button
sleep(1000)
WinActivate("Open MPEG-2 Transport Stream")
;Setting the stream path read from the Automate UI onto the Text box(Edit1) before the Open button
$copystream = ControlSetText ("Open MPEG-2 Transport Stream", " ", "Edit1", $path[$i])
sleep(1000)
;~ MsgBox(0, "", "The stream being played is: " & @CRLF & $path[$i] , 1)
sleep(1000)
ControlClick("Open MPEG-2 Transport Stream", "", "Button2")

;Ensuring the playback is stopped in streamer application
ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button21","left",2)
sleep(1000)
;Ensuring the play button is pressed to start the current selected stream playback
ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button19","left",2)

;These lines read the current stream being played by the streamer xpress app
local $getstreamervalue
$getstreamervalue = ControlGetText("DekTec StreamXpress - Transport-Stream Player", "", "Edit1")
;~ MsgBox(0, "", "The stream being played is in streamer is: " & @CRLF & $getstreamervalue, 2)

sleep($userdelay)
Next
EndFunc


Func Mobility()
$firstvalue = GUICtrlRead($readfirstautoedit)
;Activates the already opened Dektec application
WinActivate("DekTec StreamXpress - Transport-Stream Player")
;Button1 clicks the "open" button in Dektec app
sleep(1000)
ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button1")
;Activating the UI which appears after clicking the "open" button
;~ sleep(1000)
WinActivate("Open MPEG-2 Transport Stream")
;Setting the stream path read from the Automate UI onto the Text box(Edit1) before the Open button
$copystream = ControlSetText ("Open MPEG-2 Transport Stream", " ", "Edit1", $firstvalue)
sleep(1000)
MsgBox(0, "", "The stream being played is: " & @CRLF & $firstvalue , 1)
sleep(1000)
ControlClick("Open MPEG-2 Transport Stream", "", "Button2")
;These lines read the current stream being played by the streamer xpress app
local $getstreamervalue
$getstreamervalue = ControlGetText("DekTec StreamXpress - Transport-Stream Player", "", "Edit1")
;~ MsgBox(0, "", "The stream being played is in streamer is: " & @CRLF & $getstreamervalue, 2)

for $j=0 To 9
local $getMFNfreq
;Reading the frequency from our application and storing in $getappfreq
$getMFNfreq = ControlGetText("Automate", "", $Class[$j])
MsgBox(0,"Frequency",$getMFNfreq,1 )
;Copying the read frequency value to the streamer application(Edit6) text box
Local $setappfreq = ControlSetText ( "DekTec StreamXpress - Transport-Stream Player", " ", "Edit6", $getMFNfreq)
;Ensuring the playback is stopped in streamer application
ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button21","left",2)
sleep(2000)
;Ensuring the play button is pressed to start the current selected stream playback
ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button19","left",2)

sleep($userdelay)
Next
EndFunc



While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
WinActivate("Microsoft Excel - AllStreamDetails.xls")
_ExcelBookClose($oExcel,0)
Exit
Case $msg = $setvaluebuttn
validate()
Case $msg = $Automateappbuttn
Automate()
Case $msg = $Startappbuttn
Batch()
Case $msg = $infoitem
About()
Case $msg = $OKappbutton
Exitabout()
Case $msg = $exitappbuttn
_ExcelBookClose($oExcel,0)
Exit
EndSelect
WEnd

Share this post


Link to post
Share on other sites

Hi Varian,

Thanks for the support offered. I am posting the excel sheet(AllStreamDetails.xls)for your reference on behalf of Vishu

He is not able to upload as he has exceeded the upload limit.

Thanks

Share this post


Link to post
Share on other sites

Hi Varian,

Thanks for the support offered. I am posting the excel sheet(AllStreamDetails.xls)for your reference on behalf of Vishu

He is not able to upload as he has exceeded the upload limit.

Thanks

AllStreamDetails.rar

Share this post


Link to post
Share on other sites

Can you explain what the procedure is. If I click the Set Value button it goes through and reads cells (all are 0) and then returns to the GUI. I can change IP addresses & modules and it goes through the same routine and returns me back to the GUI. It may be different having to parse/calculate data but I am not seeing an error. Please provide further instructions/descriptions of the problem.

Share this post


Link to post
Share on other sites

Can you explain what the procedure is. If I click the Set Value button it goes through and reads cells (all are 0) and then returns to the GUI. I can change IP addresses & modules and it goes through the same routine and returns me back to the GUI. It may be different having to parse/calculate data but I am not seeing an error. Please provide further instructions/descriptions of the problem.

Hi Varian,

Thanks for the reply actually we have the Excel sheet with each and every tab with the below stated IP's:

118

114 &

239

In the application for example if I select 118 it will highlight the 118 tab.Then I think instead of 118 I need to select 114 this is where the problem is when 114 is selected in the application it is not highlghting the corresponding worksheet in excel.

Am attaching the Main file pl use this one for your reference.

================================================= Main========================================================================

Pl replace the main file what you have with this file.

#include <Excel.au3> ;library for doing excel operations

#include <GUIConstantsEx.au3>

#include <Misc.au3>

#include <Array.au3>

#include <file.au3>

#include <TS_Automator_Variables.au3>

#include-Once

Opt("GUICoordMode", 1)

;Checking to see if the AllStreamDetails.xls is already opened

If WinExists("Microsoft Excel - AllStreamDetails.xls") Then

MsgBox(0, "", "The Excel file is already open")

Else

;Reading the files from Desktop

;This file should already exist on the desktop

$sFilePath = @DesktopDir & "\AllStreamDetails.xls"

;Opening the Excel file

$oExcel = _ExcelBookOpen($sFilePath)

EndIf

;Error handling in case the excel file is not existing

If @error = 1 Then

MsgBox(0, "Error!", "Unable to Create the Excel Object")

Exit

ElseIf @error = 2 Then

MsgBox(0, "Error!", "File does not exist - Please copy the AllStreamDetails.xls onto your desktop and try")

Exit

EndIf

;Calling the GUI create function

createGUI()

;About()

Func createGUI()

$hGUI = GUICreate("TS-Automator",380,220)

GUICtrlCreateLabel("Enter the Modulator IP:",10,30,250,75)

;Combo box with default value as 172.24.18.114

$modulator = GUICtrlCreateCombo("172.24.18.114", 270, 20, 105, 40)

;Combo box with the range of Modulators

GUICtrlSetData(-1, "172.24.18.118|172.24.18.239","")

GUICtrlCreateLabel("Enter the Module:",10,55,250,75)

;Combo box with default value as EMM

$module = GUICtrlCreateCombo("[EMM]", 270, 45, 105, 40)

;Combo box with the range of Modules

GUICtrlSetData(-1, "[EWS]|[special Service]|[Parental Rating]|[Region ID]|[Version Change]|[LOGO]|[Frequency List]|[OAD]|[superimpose]|[Caption]|[EPG]|[Partial Stream]|[Audio Toggling]|[Others]","")

GUICtrlCreateLabel("Enter the Row Number of the stream to be loaded :",10,80,250,75)

$readedit = GUICtrlCreateInput(" ",270,75,75,20)

GUICtrlCreateLabel("Select the Frequency to be set from the list:",10,110,250,50)

;Combo box with default value as 473.000

$hCombo = GUICtrlCreateCombo("473.000", 270, 100, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$Automateappbuttn = GUICtrlCreateButton("Automate",220,150,70)

$setvaluebuttn = GUICtrlCreateButton("Set Value",30,150,70,25)

$exitappbuttn = GUICtrlCreateButton("Exit",120,150,70)

$helpmenu = GUICtrlCreateMenu("About")

;creating the info sub menu

$infoitem = GUICtrlCreateMenuItem("Info", $helpmenu)

;Making the GUI visible to the end user

GUISetState()

;sleep(2000)

;~ While($msg <> $setvaluebuttn)

readmodule()

;sleep(3000)

Search()

;~ WEnd

EndFunc

Func About()

GUICreate("About",320,145)

Local $Msgfonts

$Msgfonts = "Comic Sans MS"

GUISetFont(8, 500, 0, $Msgfonts)

GUICtrlCreateLabel("** Developed by Vishwas K S and Chandana Prakash of CSG-SQE** ", 5, 30)

GUICtrlCreateLabel("** LG Soft India Pvt Ltd ** ", 5, 50)

GUICtrlCreateLabel("** Version : 0.0a ** ", 5, 70)

GUISetFont(7, 400, 0, $Msgfonts)

$OKappbutton = GUICtrlCreateButton("OK", 120, 100, 80)

GUISetState()

EndFunc

Func Exitabout()

;deleting the launched About UI

GUIDelete();

;GUISetState(@SW_HIDE)

EndFunc

;~ Initiate()

;This function validates the user entry of the Excel row number based on positive value calls the setvalue function

Func validate()

$redvalue = GUICtrlRead($readedit);Reads the row number entered by the user.

If(Int($redvalue)) Then

Initiate()

Else

MsgBox(16, "Error", "Please enter numeric values only")

GUICtrlSetData($readedit,"")

EndIf

EndFunc

Func Initiate()

msgbox(0,"","entering Initaite")

$char = GUICtrlRead($readedit);Read the row number

$modip = GUICtrlRead($modulator);Read the modulator chosen by the user

Select

Case $modip = "172.24.18.114"

;Checking for Invalid rows

If ($char=1 Or $char=2 Or $char=6 Or $char=11 Or $char=15 Or $char=25 Or $char=30 Or $char=34 Or $char=47 Or $char=63 Or $char=76 Or $char=79 Or $char=114 Or $char=164 Or $char=168 Or $char=182 Or $char>189) Then

Else

;Proceed if valid row number is chosen.

WinActivate("Microsoft Excel - AllStreamDetails.xls")

$characteristics = _ExcelReadCell($oExcel,$char,4)

MsgBox(0,"Characteristics",$characteristics);Display the characteristics of the selected stream.

setvalue()

EndIf

Case $modip = "172.24.18.118"

;Checking for Invalid rows

If ($char=1 Or $char=2 Or $char=7 Or $char=17 Or $char=21 Or $char=31 Or $char=36 Or $char=40 Or $char=53 Or $char=69 Or $char=87 Or $char=90 Or $char=122 Or $char=175 Or $char=179 Or $char=195 Or $char>203) Then

MsgBox(0,"Error","Invalid Row number selected")

ControlSetText("[CLASS:AutoIt v3 GUI]","","Edit3","")

sleep(3000)

readmodule()

Else

;Proceed if valid row number is chosen.

WinActivate("Microsoft Excel - AllStreamDetails.xls")

$characteristics = _ExcelReadCell($oExcel,$char,4)

MsgBox(0,"Characteristics",$characteristics);Display the characteristics of the selected stream.

setvalue()

EndIf

Case $modip = "172.24.18.239"

;Checking for Invalid rows

If ($char=1 Or $char=2 Or $char=6 Or $char=11 Or $char=15 Or $char=25 Or $char=30 Or $char=34 Or $char=44 Or $char=53 Or $char=56 Or $char=58 Or $char=77 Or $char=101 Or $char=104 Or $char=114 Or $char>118) Then

MsgBox(0,"Error","Invalid Row number selected")

ControlSetText("[CLASS:AutoIt v3 GUI]","","Edit3","")

sleep(3000)

readmodule()

Else

;Proceed if valid row number is chosen.

WinActivate("Microsoft Excel - AllStreamDetails.xls")

$characteristics = _ExcelReadCell($oExcel,$char,4)

MsgBox(0,"Characteristics",$characteristics);Display the characteristics of the selected stream.

setvalue()

EndIf

EndSelect

EndFunc

;This function reads the Modulator chosen by the user.

Func readmodule()

$modip = GUICtrlRead($modulator); read the Modulator IP chosen by the user.

;Activate the particular sheet in All Stream Details depending on the Modulator IP chosen by the user.

Select

Case $modip = "172.24.18.114"

_ExcelSheetActivate($oExcel, "ISDB-T Stream Details_Mod-114")

Case $modip = "172.24.18.118"

_ExcelSheetActivate($oExcel, "ISDB-T Stream Details_Mod-118")

Case $modip = "172.24.18.239"

_ExcelSheetActivate($oExcel, "ISDB-T Stream Details_Mod-239")

EndSelect

EndFunc

;This function is used to search the location of the module name entered by the user and highlight it.

Func Search()

Local $i, $concat

$mod = GUICtrlRead($module)

For $i = 2 To 205

$readmodule = _ExcelReadCell($oExcel,$i,1)

If($mod = $readmodule) Then

$concat = "A" & $i

$oExcel.Activesheet.Range($concat).select

;~ MsgBox(0,"Module read from the Stream details",$readmodule )

EndIf

Next

EndFunc

Func setvalue()

Local $currentlistselection

;~ ;If condition which reads the combobox to find the current selection

If GUICtrlRead($hCombo) <> $currentlistselection Then

;Reads the new selection value to $hCombo variable

$currentlistselection = GUICtrlRead($hCombo)

;MsgBox(0, "", "The Cell Value is: " & @CRLF & $currentlistselection, 2)

EndIf

;Activates the already opened Dektec application

WinActivate("DekTec StreamXpress - Transport-Stream Player")

;Moves the application to screen co-ordinates to 0,0

WinMove("DekTec StreamXpress - Transport-Stream Player", "", 0, 0)

;Delay needed to ensure the dektec in moved to the left top corner

Sleep(500)

;Reading the file -> $oExcel, Reading the row number -> $redvalue,Reading the column -> 2

If IsString($sCellValue)Then

$sCellValue = _ExcelReadCell($oExcel, $redvalue, 2)

MsgBox(0, "", "The Cell Value is: " & @CRLF & $sCellValue, 2)

ElseIf $sCellValue = "" Then

MsgBox(0, "", "The Cell number selected is invalid: ")

EndIf

;This commented lines reads the current stream being played by the streamer xpress app

;local $getstreamervalue

;$getstreamervalue = ControlGetText("DekTec StreamXpress - Transport-Stream Player", "", "Edit1")

;MsgBox(0, "", "The stream being played is: " & @CRLF & $getstreamervalue, 2)

;This commented lines reads the current frequency selected in the streamer xpress app

;local $getstreamerfreq

;$getstreamerfreq = ControlGetText("Streamer set Frequency is:", "", "Edit2")

;MsgBox(0, "", "The streamer frequency Value is: " & @CRLF & $getstreamerfreq, 2)

Local $setstream

;Button1 clicks the "open" button in Dektec app

ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button1")

;Activating the UI which appears after clicking the "open" button

WinActivate("Open MPEG-2 Transport Stream")

;Delay provided to ensure the above window is launched

sleep(2000)

;Setting the stream path read from "$sCellValue"(Excel file) onto the Text box(Edit1) before the Open button

$setstream = ControlSetText ("Open MPEG-2 Transport Stream", " ", "Edit1", $sCellValue)

;MsgBox(0, "", "The Cell Value is: " & @CRLF & $sCellValue, 2)

;Delay provided to esnure the read stream path is copied onto the textbox(Edit1)

sleep(1000)

;Pressing the Open button(Button2) to ensure the selected stream is opened in streamer application

ControlClick("Open MPEG-2 Transport Stream", "", "Button2")

;MsgBox(0, "", "The stream being played is: " & @CRLF & $setstream, 2)

WinActivate("TS-Automator")

local $getappfreq

;Reading the frequency from our application and storing in $getappfreq

$getappfreq = ControlGetText("TS-Automator", "", "Edit4")

MsgBox(0, "", "The application frequency Value is: " & @CRLF & $getappfreq, 2)

;Copying the read frequency value to the streamer application(Edit6) text box

$setappfreq = ControlSetText ( "DekTec StreamXpress - Transport-Stream Player", " ", "Edit6", $getappfreq)

;Ensuring the playback is stopped in streamer application

ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button21","left",2)

sleep(1000)

;Ensuring the play button is pressed to start the current selected stream playback

ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button19","left",2)

EndFunc

Func Automate()

$hGUI = GUICreate("Automate",450,500)

GUICtrlCreateLabel("First Stream Path :",8,20,130,15)

GUICtrlCreateLabel("Second Stream Path :",8,60,130,15)

GUICtrlCreateLabel("Third Stream Path :",8,100,130,15)

GUICtrlCreateLabel("Fourth Stream Path :",8,140,130,15)

GUICtrlCreateLabel("Fifth Stream Path :",8,180,130,15)

GUICtrlCreateLabel("Sixth Stream Path :",8,220,130,15)

GUICtrlCreateLabel("Seventh Stream Path :",8,260,130,15)

GUICtrlCreateLabel("Eighth Stream Path :",8,300,130,15)

GUICtrlCreateLabel("Nineth Stream Path :",8,340,130,15)

GUICtrlCreateLabel("Tenth Stream Path :",8,380,130,15)

$readfirstautoedit = GUICtrlCreateInput("", 140,20,200,20)

$hCombo1 = GUICtrlCreateCombo("473.000", 360, 20, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readsecondautoedit = GUICtrlCreateInput("",140,60,200,20)

$hCombo2 = GUICtrlCreateCombo("473.000", 360, 60, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readthirdautoedit = GUICtrlCreateInput("",140,100,200,20)

$hCombo3 = GUICtrlCreateCombo("473.000", 360, 100, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readfourthautoedit = GUICtrlCreateInput("",140,140,200,20)

$hCombo4 = GUICtrlCreateCombo("473.000", 360, 140, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readfifthautoedit = GUICtrlCreateInput("",140,180,200,20)

$hCombo5 = GUICtrlCreateCombo("473.000", 360, 180, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readsixthautoedit = GUICtrlCreateInput("",140,220,200,20)

$hCombo6 = GUICtrlCreateCombo("473.000", 360, 220, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readseventhautoedit = GUICtrlCreateInput("",140,260,200,20)

$hCombo7 = GUICtrlCreateCombo("473.000", 360, 260, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readeighthautoedit = GUICtrlCreateInput("",140,300,200,20)

$hCombo8 = GUICtrlCreateCombo("473.000", 360, 300, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readninethautoedit = GUICtrlCreateInput("",140,340,200,20)

$hCombo9 = GUICtrlCreateCombo("473.000", 360, 340, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$readTenthautoedit = GUICtrlCreateInput("",140,380,200,20)

$hCombo10 = GUICtrlCreateCombo("473.000", 360, 380, 75, 20)

;Combo box with range of frequencies

GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

$Mobility= GUICtrlCreateCheckbox("Mobility", 290, 433, 120, 20)

GUICtrlGetState($Mobility)

;Creating the delay button

GUICtrlCreateLabel("Delay",60,439,30,25)

$delay = GUICtrlCreateInput("", 90,433 ,30,20)

;Loop button checkbox

$chkbox = GUICtrlCreateCheckbox("Loop", 170, 433, 120, 20)

GUICtrlGetState($chkbox)

;Creating the Start button

$Startappbuttn = GUICtrlCreateButton("Start",55,460,70)

;The object refers to the already defined Exit button

$exitappbuttn = GUICtrlCreateButton("Exit",165,460,70)

GUISetState()

EndFunc

Func Batch()

if WinExists("Automate") Then

WinActivate("Automate")

$read = GUICtrlRead($chkbox);Check if the user has enabled the loop option

$MobilityRead=GUICtrlRead($Mobility)

if $read = $GUI_CHECKED Then

While(1)

$userdelay = GUICtrlRead($delay);Read the delay entered by the user

If (Int($userdelay)) Then

msgbox(0,"Delay","User defined delay is:"& @CRLF & $userdelay,1)

If $MobilityRead = $GUI_CHECKED Then

Mobility()

Else

setstream()

Endif

Else

MsgBox(16, "Error", "Please enter numeric values only")

EndIf

WEnd

Else

$userdelay = GUICtrlRead($delay);Read the delay entered by the user

If (Int($userdelay)) Then

msgbox(0,"Delay","User defined delay is:"& @CRLF & $userdelay,1)

If $MobilityRead = $GUI_CHECKED Then

Mobility()

Else

setstream()

Endif

Else

MsgBox(16, "Error", "Please enter numeric values only")

EndIf

EndIf

Endif

EndFunc

Func getvalues()

;reading the values from the text box for all the paths in Automate screen

$firstvalue = GUICtrlRead($readfirstautoedit)

$secondvalue = GUICtrlRead($readsecondautoedit)

$thirdvalue = GUICtrlRead($readthirdautoedit)

$fourthvalue = GUICtrlRead($readfourthautoedit)

$fifthvalue = GUICtrlRead($readfifthautoedit)

$sixthvalue = GUICtrlRead($readsixthautoedit)

$seventhvalue = GUICtrlRead($readseventhautoedit)

$eigthvalue = GUICtrlRead($readeighthautoedit)

$ninethvalue = GUICtrlRead($readninethautoedit)

EndFunc

Func setstream()

getvalues()

Local $Frequency

$Frequency = ControlGetText("Automate", "", "Edit2")

MsgBox(0,"Frequency",$Frequency,1 )

;Copying the read frequency value to the streamer application(Edit6) text box

Local $setfreq = ControlSetText ( "DekTec StreamXpress - Transport-Stream Player", " ", "Edit6", $Frequency)

Local $i

for $i = 0 to 9 step 1

Local $path[50] = [$firstvalue, $secondvalue,$thirdvalue,$fourthvalue,$fifthvalue,$sixthvalue,$seventhvalue,$eigthvalue,$ninethvalue,$tenthvalue]

;Activates the already opened Dektec application

WinActivate("DekTec StreamXpress - Transport-Stream Player")

;Button1 clicks the "open" button in Dektec app

sleep(1000)

ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button1")

;Activating the UI which appears after clicking the "open" button

sleep(1000)

WinActivate("Open MPEG-2 Transport Stream")

;Setting the stream path read from the Automate UI onto the Text box(Edit1) before the Open button

$copystream = ControlSetText ("Open MPEG-2 Transport Stream", " ", "Edit1", $path[$i])

sleep(1000)

;~ MsgBox(0, "", "The stream being played is: " & @CRLF & $path[$i] , 1)

sleep(1000)

ControlClick("Open MPEG-2 Transport Stream", "", "Button2")

;Ensuring the playback is stopped in streamer application

ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button21","left",2)

sleep(1000)

;Ensuring the play button is pressed to start the current selected stream playback

ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button19","left",2)

;These lines read the current stream being played by the streamer xpress app

local $getstreamervalue

$getstreamervalue = ControlGetText("DekTec StreamXpress - Transport-Stream Player", "", "Edit1")

;~ MsgBox(0, "", "The stream being played is in streamer is: " & @CRLF & $getstreamervalue, 2)

sleep($userdelay)

Next

EndFunc

Func Mobility()

$firstvalue = GUICtrlRead($readfirstautoedit)

;Activates the already opened Dektec application

WinActivate("DekTec StreamXpress - Transport-Stream Player")

;Button1 clicks the "open" button in Dektec app

sleep(1000)

ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button1")

;Activating the UI which appears after clicking the "open" button

;~ sleep(1000)

WinActivate("Open MPEG-2 Transport Stream")

;Setting the stream path read from the Automate UI onto the Text box(Edit1) before the Open button

$copystream = ControlSetText ("Open MPEG-2 Transport Stream", " ", "Edit1", $firstvalue)

sleep(1000)

MsgBox(0, "", "The stream being played is: " & @CRLF & $firstvalue , 1)

sleep(2000)

ControlClick("Open MPEG-2 Transport Stream", "", "Button2")

;These lines read the current stream being played by the streamer xpress app

local $getstreamervalue

$getstreamervalue = ControlGetText("DekTec StreamXpress - Transport-Stream Player", "", "Edit1")

;~ MsgBox(0, "", "The stream being played is in streamer is: " & @CRLF & $getstreamervalue, 2)

for $j=0 To 9

local $getMFNfreq

;Reading the frequency from our application and storing in $getappfreq

$getMFNfreq = ControlGetText("Automate", "", $Class[$j])

MsgBox(0,"Frequency",$getMFNfreq,1 )

;Copying the read frequency value to the streamer application(Edit6) text box

Local $setappfreq = ControlSetText ( "DekTec StreamXpress - Transport-Stream Player", " ", "Edit6", $getMFNfreq)

;Ensuring the playback is stopped in streamer application

ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button21","left",2)

sleep(10000)

;Ensuring the play button is pressed to start the current selected stream playback

ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button19","left",2)

sleep($userdelay)

Next

EndFunc

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

WinActivate("Microsoft Excel - AllStreamDetails.xls")

_ExcelBookClose($oExcel,0)

Exit

Case $msg = $setvaluebuttn

validate()

Case $msg = $Automateappbuttn

Automate()

Case $msg = $Startappbuttn

Batch()

Case $msg = $infoitem

About()

Case $msg = $OKappbutton

Exitabout()

Case $msg = $exitappbuttn

_ExcelBookClose($oExcel,0)

Exit

EndSelect

WEnd

=========================================================================================================================================

Share this post


Link to post
Share on other sites

The only thing that I can figure out is to add the "readmodule()" function to line 487. It now switches the pages when I click the "Set Value" button and before the "Initialize" prompt. I don't know if this solves your problem, but if not, please respond further. Also, can you please edit your earlier posts to add the autoit tags to your scripts..it makes the page REALLY long and hard to scroll.

TS Automator_Final.au3

#include <Excel.au3> ;library for doing excel operations
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <Array.au3>
#include <file.au3>
#include <TS_Automator_Variables.au3>
#include-Once

Opt("GUICoordMode", 1)

;Checking to see if the AllStreamDetails.xls is already opened
If WinExists("Microsoft Excel - AllStreamDetails.xls") Then
    MsgBox(0, "", "The Excel file is already open")
Else
    ;Reading the files from Desktop
    ;This file should already exist on the desktop
    $sFilePath = @DesktopDir & "\AllStreamDetails.xls"
    ;Opening the Excel file
    $oExcel = _ExcelBookOpen($sFilePath)
EndIf

;Error handling in case the excel file is not existing
If @error = 1 Then
    MsgBox(0, "Error!", "Unable to Create the Excel Object")
    Exit
ElseIf @error = 2 Then
    MsgBox(0, "Error!", "File does not exist - Please copy the AllStreamDetails.xls onto your desktop and try")
    Exit
EndIf

;Calling the GUI create function
createGUI()
;About()

Func createGUI()

    $hGUI = GUICreate("TS-Automator", 380, 220)

    GUICtrlCreateLabel("Enter the Modulator IP:", 10, 30, 250, 75)
    ;Combo box with default value as 172.24.18.114
    $Modulator = GUICtrlCreateCombo("172.24.18.114", 270, 20, 105, 40)
    ;Combo box with the range of Modulators
    GUICtrlSetData(-1, "172.24.18.118|172.24.18.239", "")

    GUICtrlCreateLabel("Enter the Module:", 10, 55, 250, 75)
    ;Combo box with default value as EMM
    $module = GUICtrlCreateCombo("[EMM]", 270, 45, 105, 40)
    ;Combo box with the range of Modules
    GUICtrlSetData(-1, "[EWS]|[Special Service]|[Parental Rating]|[Region ID]|[Version Change]|[LOGO]|[Frequency List]|[OAD]|[Superimpose]|[Caption]|[EPG]|[Partial Stream]|[Audio Toggling]|[Others]", "")

    GUICtrlCreateLabel("Enter the Row Number of the stream to be loaded :", 10, 80, 250, 75)
    $Readedit = GUICtrlCreateInput(" ", 270, 75, 75, 20)

    GUICtrlCreateLabel("Select the Frequency to be set from the list:", 10, 110, 250, 50)
    ;Combo box with default value as 473.000
    $hCombo = GUICtrlCreateCombo("473.000", 270, 100, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $Automateappbuttn = GUICtrlCreateButton("Automate", 220, 150, 70)
    $Setvaluebuttn = GUICtrlCreateButton("Set Value", 30, 150, 70, 25)
    $Exitappbuttn = GUICtrlCreateButton("Exit", 120, 150, 70)

    $Helpmenu = GUICtrlCreateMenu("About")
    ;creating the info sub menu
    $Infoitem = GUICtrlCreateMenuItem("Info", $Helpmenu)

    ;Making the GUI visible to the end user
    GUISetState()

    ;sleep(2000)

;~ While($Msg <> $setvaluebuttn)
    readmodule()
    ;sleep(3000)
    Search()
;~ WEnd
EndFunc   ;==>createGUI


Func About()
    GUICreate("About", 320, 145)
    Local $Msgfonts
    $Msgfonts = "Comic Sans MS"
    GUISetFont(8, 500, 0, $Msgfonts)
    GUICtrlCreateLabel("** Developed by Vishwas K S and Chandana Prakash of CSG-SQE** ", 5, 30)
    GUICtrlCreateLabel("** LG Soft India Pvt Ltd ** ", 5, 50)
    GUICtrlCreateLabel("** Version : 0.0a ** ", 5, 70)
    GUISetFont(7, 400, 0, $Msgfonts)
    $OKappbutton = GUICtrlCreateButton("OK", 120, 100, 80)
    GUISetState()
EndFunc   ;==>About


Func Exitabout()
    ;deleting the launched About UI
    GUIDelete();
    ;GUISetState(@SW_HIDE)
EndFunc   ;==>Exitabout

;~ Initiate()
;This function validates the user entry of the Excel row number based on positive value calls the setvalue function
Func validate()
    $redvalue = GUICtrlRead($Readedit);Reads the row number entered by the user.
    If (Int($redvalue)) Then
        Initiate()
    Else
        MsgBox(16, "Error", "Please enter numeric values only")
        GUICtrlSetData($Readedit, "")
    EndIf
EndFunc   ;==>validate


Func Initiate()
    MsgBox(0, "", "entering Initaite")
    $Char = GUICtrlRead($Readedit);Read the row number
    $modip = GUICtrlRead($Modulator);Read the modulator chosen by the user

    Select
        Case $modip = "172.24.18.114"
            ;Checking for Invalid rows
            If ($Char = 1 Or $Char = 2 Or $Char = 6 Or $Char = 11 Or $Char = 15 Or $Char = 25 Or $Char = 30 Or $Char = 34 Or $Char = 47 Or $Char = 63 Or $Char = 76 Or $Char = 79 Or $Char = 114 Or $Char = 164 Or $Char = 168 Or $Char = 182 Or $Char > 189) Then

            Else
                ;Proceed if valid row number is chosen.
                WinActivate("Microsoft Excel - AllStreamDetails.xls")
                $characteristics = _ExcelReadCell($oExcel, $Char, 4)
                MsgBox(0, "Characteristics", $characteristics);Display the characteristics of the selected stream.
                setvalue()
            EndIf

        Case $modip = "172.24.18.118"
            ;Checking for Invalid rows
            If ($Char = 1 Or $Char = 2 Or $Char = 7 Or $Char = 17 Or $Char = 21 Or $Char = 31 Or $Char = 36 Or $Char = 40 Or $Char = 53 Or $Char = 69 Or $Char = 87 Or $Char = 90 Or $Char = 122 Or $Char = 175 Or $Char = 179 Or $Char = 195 Or $Char > 203) Then
                MsgBox(0, "Error", "Invalid Row number selected")
                ControlSetText("[CLASS:AutoIt v3 GUI]", "", "Edit3", "")
                Sleep(3000)
                readmodule()
            Else
                ;Proceed if valid row number is chosen.
                WinActivate("Microsoft Excel - AllStreamDetails.xls")
                $characteristics = _ExcelReadCell($oExcel, $Char, 4)
                MsgBox(0, "Characteristics", $characteristics);Display the characteristics of the selected stream.
                setvalue()
            EndIf

        Case $modip = "172.24.18.239"
            ;Checking for Invalid rows
            If ($Char = 1 Or $Char = 2 Or $Char = 6 Or $Char = 11 Or $Char = 15 Or $Char = 25 Or $Char = 30 Or $Char = 34 Or $Char = 44 Or $Char = 53 Or $Char = 56 Or $Char = 58 Or $Char = 77 Or $Char = 101 Or $Char = 104 Or $Char = 114 Or $Char > 118) Then
                MsgBox(0, "Error", "Invalid Row number selected")
                ControlSetText("[CLASS:AutoIt v3 GUI]", "", "Edit3", "")
                Sleep(3000)
                readmodule()
            Else
                ;Proceed if valid row number is chosen.
                WinActivate("Microsoft Excel - AllStreamDetails.xls")
                $characteristics = _ExcelReadCell($oExcel, $Char, 4)
                MsgBox(0, "Characteristics", $characteristics);Display the characteristics of the selected stream.
                setvalue()
            EndIf
    EndSelect
EndFunc   ;==>Initiate


;This function reads the Modulator chosen by the user.
Func readmodule()
    $modip = GUICtrlRead($Modulator); read the Modulator IP chosen by the user.
    ;Activate the particular sheet in All Stream Details depending on the Modulator IP chosen by the user.
    Select
        Case $modip = "172.24.18.114"
            _ExcelSheetActivate($oExcel, "ISDB-T Stream Details_Mod-114")
        Case $modip = "172.24.18.118"
            _ExcelSheetActivate($oExcel, "ISDB-T Stream Details_Mod-118")
        Case $modip = "172.24.18.239"
            _ExcelSheetActivate($oExcel, "ISDB-T Stream Details_Mod-239")
    EndSelect
EndFunc   ;==>readmodule


;This function is used to search the location of the module name entered by the user and highlight it.
Func Search()
    Local $I, $Concat
    $mod = GUICtrlRead($module)

    For $I = 2 To 205
        $readmodule = _ExcelReadCell($oExcel, $I, 1)
        If ($mod = $readmodule) Then
            $Concat = "A" & $I
            $oExcel.Activesheet.Range($concat).Select
;~ MsgBox(0,"Module read from the Stream details",$readmodule )
        EndIf
    Next
EndFunc   ;==>Search


Func setvalue()
    Local $Currentlistselection
;~ ;If condition which reads the combobox to find the current selection
    If GUICtrlRead($hCombo) <> $Currentlistselection Then
        ;Reads the new selection value to $hCombo variable
        $Currentlistselection = GUICtrlRead($hCombo)
        ;MsgBox(0, "", "The Cell Value is: " & @CRLF & $currentlistselection, 2)
    EndIf
    ;Activates the already opened Dektec application
    WinActivate("DekTec StreamXpress - Transport-Stream Player")

    ;Moves the application to screen co-ordinates to 0,0
    WinMove("DekTec StreamXpress - Transport-Stream Player", "", 0, 0)
    ;Delay needed to ensure the dektec in moved to the left top corner
    Sleep(500)
    ;Reading the file -> $oExcel, Reading the row number -> $redvalue,Reading the column -> 2
    If IsString($sCellValue) Then
        $sCellValue = _ExcelReadCell($oExcel, $redvalue, 2)
        MsgBox(0, "", "The Cell Value is: " & @CRLF & $sCellValue, 2)
    ElseIf $sCellValue = "" Then
        MsgBox(0, "", "The Cell number selected is invalid: ")
    EndIf

    ;This commented lines reads the current stream being played by the streamer xpress app
    ;local $Getstreamervalue
    ;$getstreamervalue = ControlGetText("DekTec StreamXpress - Transport-Stream Player", "", "Edit1")
    ;MsgBox(0, "", "The stream being played is: " & @CRLF & $getstreamervalue, 2)

    ;This commented lines reads the current frequency selected in the streamer xpress app
    ;local $getstreamerfreq
    ;$getstreamerfreq = ControlGetText("Streamer set Frequency is:", "", "Edit2")
    ;MsgBox(0, "", "The streamer frequency Value is: " & @CRLF & $getstreamerfreq, 2)


    Local $setstream
    ;Button1 clicks the "open" button in Dektec app
    ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button1")
    ;Activating the UI which appears after clicking the "open" button
    WinActivate("Open MPEG-2 Transport Stream")
    ;Delay provided to ensure the above window is launched
    Sleep(2000)
    ;Setting the stream path read from "$sCellValue"(Excel file) onto the Text box(Edit1) before the Open button
    $setstream = ControlSetText("Open MPEG-2 Transport Stream", " ", "Edit1", $sCellValue)
    ;MsgBox(0, "", "The Cell Value is: " & @CRLF & $sCellValue, 2)
    ;Delay provided to esnure the read stream path is copied onto the textbox(Edit1)
    Sleep(1000)
    ;Pressing the Open button(Button2) to ensure the selected stream is opened in streamer application
    ControlClick("Open MPEG-2 Transport Stream", "", "Button2")
    ;MsgBox(0, "", "The stream being played is: " & @CRLF & $setstream, 2)

    WinActivate("TS-Automator")
    Local $getappfreq
    ;Reading the frequency from our application and storing in $getappfreq
    $getappfreq = ControlGetText("TS-Automator", "", "Edit4")
    MsgBox(0, "", "The application frequency Value is: " & @CRLF & $getappfreq, 2)

    ;Copying the read frequency value to the streamer application(Edit6) text box
    $setappfreq = ControlSetText("DekTec StreamXpress - Transport-Stream Player", " ", "Edit6", $getappfreq)
    ;Ensuring the playback is stopped in streamer application
    ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button21", "left", 2)
    Sleep(1000)
    ;Ensuring the play button is pressed to start the current selected stream playback
    ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button19", "left", 2)
EndFunc   ;==>setvalue


Func Automate()
    $hGUI = GUICreate("Automate", 450, 500)
    GUICtrlCreateLabel("First Stream Path :", 8, 20, 130, 15)
    GUICtrlCreateLabel("Second Stream Path :", 8, 60, 130, 15)
    GUICtrlCreateLabel("Third Stream Path :", 8, 100, 130, 15)
    GUICtrlCreateLabel("Fourth Stream Path :", 8, 140, 130, 15)
    GUICtrlCreateLabel("Fifth Stream Path :", 8, 180, 130, 15)
    GUICtrlCreateLabel("Sixth Stream Path :", 8, 220, 130, 15)
    GUICtrlCreateLabel("Seventh Stream Path :", 8, 260, 130, 15)
    GUICtrlCreateLabel("Eighth Stream Path :", 8, 300, 130, 15)
    GUICtrlCreateLabel("Nineth Stream Path :", 8, 340, 130, 15)
    GUICtrlCreateLabel("Tenth Stream Path :", 8, 380, 130, 15)

    $readfirstautoedit = GUICtrlCreateInput("", 140, 20, 200, 20)
    $hCombo1 = GUICtrlCreateCombo("473.000", 360, 20, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readsecondautoedit = GUICtrlCreateInput("", 140, 60, 200, 20)
    $hCombo2 = GUICtrlCreateCombo("473.000", 360, 60, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readthirdautoedit = GUICtrlCreateInput("", 140, 100, 200, 20)
    $hCombo3 = GUICtrlCreateCombo("473.000", 360, 100, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readfourthautoedit = GUICtrlCreateInput("", 140, 140, 200, 20)
    $hCombo4 = GUICtrlCreateCombo("473.000", 360, 140, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readfifthautoedit = GUICtrlCreateInput("", 140, 180, 200, 20)
    $hCombo5 = GUICtrlCreateCombo("473.000", 360, 180, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readsixthautoedit = GUICtrlCreateInput("", 140, 220, 200, 20)
    $hCombo6 = GUICtrlCreateCombo("473.000", 360, 220, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readseventhautoedit = GUICtrlCreateInput("", 140, 260, 200, 20)
    $hCombo7 = GUICtrlCreateCombo("473.000", 360, 260, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readeighthautoedit = GUICtrlCreateInput("", 140, 300, 200, 20)
    $hCombo8 = GUICtrlCreateCombo("473.000", 360, 300, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readninethautoedit = GUICtrlCreateInput("", 140, 340, 200, 20)
    $hCombo9 = GUICtrlCreateCombo("473.000", 360, 340, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readTenthautoedit = GUICtrlCreateInput("", 140, 380, 200, 20)
    $hCombo10 = GUICtrlCreateCombo("473.000", 360, 380, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $Mobility = GUICtrlCreateCheckbox("Mobility", 290, 433, 120, 20)
    GUICtrlGetState($Mobility)

    ;Creating the delay button
    GUICtrlCreateLabel("Delay", 60, 439, 30, 25)
    $Delay = GUICtrlCreateInput("", 90, 433, 30, 20)

    ;Loop button checkbox
    $chkbox = GUICtrlCreateCheckbox("Loop", 170, 433, 120, 20)
    GUICtrlGetState($chkbox)

    ;Creating the Start button
    $Startappbuttn = GUICtrlCreateButton("Start", 55, 460, 70)
    ;The object refers to the already defined Exit button
    $Exitappbuttn = GUICtrlCreateButton("Exit", 165, 460, 70)

    GUISetState()
EndFunc   ;==>Automate


Func Batch()
    If WinExists("Automate") Then
        WinActivate("Automate")
        $read = GUICtrlRead($chkbox);Check if the user has enabled the loop option
        $MobilityRead = GUICtrlRead($Mobility)
        If $read = $GUI_CHECKED Then
            While (1)
                $Userdelay = GUICtrlRead($Delay);Read the delay entered by the user
                If (Int($Userdelay)) Then
                    MsgBox(0, "Delay", "User defined delay is:" & @CRLF & $Userdelay, 1)
                    If $MobilityRead = $GUI_CHECKED Then
                        Mobility()
                    Else
                        setstream()
                    EndIf
                Else
                    MsgBox(16, "Error", "Please enter numeric values only")
                EndIf
            WEnd
        Else

            $Userdelay = GUICtrlRead($Delay);Read the delay entered by the user
            If (Int($Userdelay)) Then
                MsgBox(0, "Delay", "User defined delay is:" & @CRLF & $Userdelay, 1)
                If $MobilityRead = $GUI_CHECKED Then
                    Mobility()
                Else
                    setstream()
                EndIf
            Else
                MsgBox(16, "Error", "Please enter numeric values only")
            EndIf
        EndIf
    EndIf
EndFunc   ;==>Batch


Func getvalues()
    ;reading the values from the text box for all the paths in Automate screen
    $Firstvalue = GUICtrlRead($readfirstautoedit)
    $secondvalue = GUICtrlRead($readsecondautoedit)
    $thirdvalue = GUICtrlRead($readthirdautoedit)
    $fourthvalue = GUICtrlRead($readfourthautoedit)
    $fifthvalue = GUICtrlRead($readfifthautoedit)
    $sixthvalue = GUICtrlRead($readsixthautoedit)
    $seventhvalue = GUICtrlRead($readseventhautoedit)
    $eigthvalue = GUICtrlRead($readeighthautoedit)
    $ninethvalue = GUICtrlRead($readninethautoedit)
EndFunc   ;==>getvalues


Func setstream()
    getvalues()
    Local $Frequency
    $Frequency = ControlGetText("Automate", "", "Edit2")
    MsgBox(0, "Frequency", $Frequency, 1)
    ;Copying the read frequency value to the streamer application(Edit6) text box
    Local $setfreq = ControlSetText("DekTec StreamXpress - Transport-Stream Player", " ", "Edit6", $Frequency)

    Local $I
    For $I = 0 To 9 Step 1
        Local $Path[50] = [$Firstvalue, $secondvalue, $thirdvalue, $fourthvalue, $fifthvalue, $sixthvalue, $seventhvalue, $eigthvalue, $ninethvalue, $Tenthvalue]

        ;Activates the already opened Dektec application
        WinActivate("DekTec StreamXpress - Transport-Stream Player")
        ;Button1 clicks the "open" button in Dektec app
        Sleep(1000)
        ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button1")
        ;Activating the UI which appears after clicking the "open" button
        Sleep(1000)
        WinActivate("Open MPEG-2 Transport Stream")
        ;Setting the stream path read from the Automate UI onto the Text box(Edit1) before the Open button
        $copystream = ControlSetText("Open MPEG-2 Transport Stream", " ", "Edit1", $Path[$I])
        Sleep(1000)
;~ MsgBox(0, "", "The stream being played is: " & @CRLF & $path[$i] , 1)
        Sleep(1000)
        ControlClick("Open MPEG-2 Transport Stream", "", "Button2")

        ;Ensuring the playback is stopped in streamer application
        ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button21", "left", 2)
        Sleep(1000)
        ;Ensuring the play button is pressed to start the current selected stream playback
        ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button19", "left", 2)

        ;These lines read the current stream being played by the streamer xpress app
        Local $getstreamervalue
        $getstreamervalue = ControlGetText("DekTec StreamXpress - Transport-Stream Player", "", "Edit1")
;~ MsgBox(0, "", "The stream being played is in streamer is: " & @CRLF & $getstreamervalue, 2)

        Sleep($Userdelay)
    Next
EndFunc   ;==>setstream


Func Mobility()
    $Firstvalue = GUICtrlRead($readfirstautoedit)
    ;Activates the already opened Dektec application
    WinActivate("DekTec StreamXpress - Transport-Stream Player")
    ;Button1 clicks the "open" button in Dektec app
    Sleep(1000)
    ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button1")
    ;Activating the UI which appears after clicking the "open" button
;~ sleep(1000)
    WinActivate("Open MPEG-2 Transport Stream")
    ;Setting the stream path read from the Automate UI onto the Text box(Edit1) before the Open button
    $copystream = ControlSetText("Open MPEG-2 Transport Stream", " ", "Edit1", $Firstvalue)
    Sleep(1000)
    MsgBox(0, "", "The stream being played is: " & @CRLF & $Firstvalue, 1)
    Sleep(2000)
    ControlClick("Open MPEG-2 Transport Stream", "", "Button2")
    ;These lines read the current stream being played by the streamer xpress app
    Local $getstreamervalue
    $getstreamervalue = ControlGetText("DekTec StreamXpress - Transport-Stream Player", "", "Edit1")
;~ MsgBox(0, "", "The stream being played is in streamer is: " & @CRLF & $getstreamervalue, 2)

    For $J = 0 To 9
        Local $getMFNfreq
        ;Reading the frequency from our application and storing in $getappfreq
        $getMFNfreq = ControlGetText("Automate", "", $Class[$J])
        MsgBox(0, "Frequency", $getMFNfreq, 1)
        ;Copying the read frequency value to the streamer application(Edit6) text box
        Local $setappfreq = ControlSetText("DekTec StreamXpress - Transport-Stream Player", " ", "Edit6", $getMFNfreq)
        ;Ensuring the playback is stopped in streamer application
        ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button21", "left", 2)
        Sleep(10000)
        ;Ensuring the play button is pressed to start the current selected stream playback
        ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button19", "left", 2)

        Sleep($Userdelay)
    Next
EndFunc   ;==>Mobility



While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            WinActivate("Microsoft Excel - AllStreamDetails.xls")
            _ExcelBookClose($oExcel, 0)
            Exit
        Case $msg = $Setvaluebuttn
            readmodule()
            validate()
        Case $msg = $Automateappbuttn
            Automate()
        Case $msg = $Startappbuttn
            Batch()
        Case $msg = $Infoitem
            About()
        Case $msg = $OKappbutton
            Exitabout()
        Case $msg = $Exitappbuttn
            _ExcelBookClose($oExcel, 0)
            Exit
    EndSelect
WEnd

Share this post


Link to post
Share on other sites

The only thing that I can figure out is to add the "readmodule()" function to line 487. It now switches the pages when I click the "Set Value" button and before the "Initialize" prompt. I don't know if this solves your problem, but if not, please respond further. Also, can you please edit your earlier posts to add the autoit tags to your scripts..it makes the page REALLY long and hard to scroll.

TS Automator_Final.au3

#include <Excel.au3> ;library for doing excel operations
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <Array.au3>
#include <file.au3>
#include <TS_Automator_Variables.au3>
#include-Once

Opt("GUICoordMode", 1)

;Checking to see if the AllStreamDetails.xls is already opened
If WinExists("Microsoft Excel - AllStreamDetails.xls") Then
    MsgBox(0, "", "The Excel file is already open")
Else
    ;Reading the files from Desktop
    ;This file should already exist on the desktop
    $sFilePath = @DesktopDir & "\AllStreamDetails.xls"
    ;Opening the Excel file
    $oExcel = _ExcelBookOpen($sFilePath)
EndIf

;Error handling in case the excel file is not existing
If @error = 1 Then
    MsgBox(0, "Error!", "Unable to Create the Excel Object")
    Exit
ElseIf @error = 2 Then
    MsgBox(0, "Error!", "File does not exist - Please copy the AllStreamDetails.xls onto your desktop and try")
    Exit
EndIf

;Calling the GUI create function
createGUI()
;About()

Func createGUI()

    $hGUI = GUICreate("TS-Automator", 380, 220)

    GUICtrlCreateLabel("Enter the Modulator IP:", 10, 30, 250, 75)
    ;Combo box with default value as 172.24.18.114
    $Modulator = GUICtrlCreateCombo("172.24.18.114", 270, 20, 105, 40)
    ;Combo box with the range of Modulators
    GUICtrlSetData(-1, "172.24.18.118|172.24.18.239", "")

    GUICtrlCreateLabel("Enter the Module:", 10, 55, 250, 75)
    ;Combo box with default value as EMM
    $module = GUICtrlCreateCombo("[EMM]", 270, 45, 105, 40)
    ;Combo box with the range of Modules
    GUICtrlSetData(-1, "[EWS]|[Special Service]|[Parental Rating]|[Region ID]|[Version Change]|[LOGO]|[Frequency List]|[OAD]|[Superimpose]|[Caption]|[EPG]|[Partial Stream]|[Audio Toggling]|[Others]", "")

    GUICtrlCreateLabel("Enter the Row Number of the stream to be loaded :", 10, 80, 250, 75)
    $Readedit = GUICtrlCreateInput(" ", 270, 75, 75, 20)

    GUICtrlCreateLabel("Select the Frequency to be set from the list:", 10, 110, 250, 50)
    ;Combo box with default value as 473.000
    $hCombo = GUICtrlCreateCombo("473.000", 270, 100, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $Automateappbuttn = GUICtrlCreateButton("Automate", 220, 150, 70)
    $Setvaluebuttn = GUICtrlCreateButton("Set Value", 30, 150, 70, 25)
    $Exitappbuttn = GUICtrlCreateButton("Exit", 120, 150, 70)

    $Helpmenu = GUICtrlCreateMenu("About")
    ;creating the info sub menu
    $Infoitem = GUICtrlCreateMenuItem("Info", $Helpmenu)

    ;Making the GUI visible to the end user
    GUISetState()

    ;sleep(2000)

;~ While($Msg <> $setvaluebuttn)
    readmodule()
    ;sleep(3000)
    Search()
;~ WEnd
EndFunc   ;==>createGUI


Func About()
    GUICreate("About", 320, 145)
    Local $Msgfonts
    $Msgfonts = "Comic Sans MS"
    GUISetFont(8, 500, 0, $Msgfonts)
    GUICtrlCreateLabel("** Developed by Vishwas K S and Chandana Prakash of CSG-SQE** ", 5, 30)
    GUICtrlCreateLabel("** LG Soft India Pvt Ltd ** ", 5, 50)
    GUICtrlCreateLabel("** Version : 0.0a ** ", 5, 70)
    GUISetFont(7, 400, 0, $Msgfonts)
    $OKappbutton = GUICtrlCreateButton("OK", 120, 100, 80)
    GUISetState()
EndFunc   ;==>About


Func Exitabout()
    ;deleting the launched About UI
    GUIDelete();
    ;GUISetState(@SW_HIDE)
EndFunc   ;==>Exitabout

;~ Initiate()
;This function validates the user entry of the Excel row number based on positive value calls the setvalue function
Func validate()
    $redvalue = GUICtrlRead($Readedit);Reads the row number entered by the user.
    If (Int($redvalue)) Then
        Initiate()
    Else
        MsgBox(16, "Error", "Please enter numeric values only")
        GUICtrlSetData($Readedit, "")
    EndIf
EndFunc   ;==>validate


Func Initiate()
    MsgBox(0, "", "entering Initaite")
    $Char = GUICtrlRead($Readedit);Read the row number
    $modip = GUICtrlRead($Modulator);Read the modulator chosen by the user

    Select
        Case $modip = "172.24.18.114"
            ;Checking for Invalid rows
            If ($Char = 1 Or $Char = 2 Or $Char = 6 Or $Char = 11 Or $Char = 15 Or $Char = 25 Or $Char = 30 Or $Char = 34 Or $Char = 47 Or $Char = 63 Or $Char = 76 Or $Char = 79 Or $Char = 114 Or $Char = 164 Or $Char = 168 Or $Char = 182 Or $Char > 189) Then

            Else
                ;Proceed if valid row number is chosen.
                WinActivate("Microsoft Excel - AllStreamDetails.xls")
                $characteristics = _ExcelReadCell($oExcel, $Char, 4)
                MsgBox(0, "Characteristics", $characteristics);Display the characteristics of the selected stream.
                setvalue()
            EndIf

        Case $modip = "172.24.18.118"
            ;Checking for Invalid rows
            If ($Char = 1 Or $Char = 2 Or $Char = 7 Or $Char = 17 Or $Char = 21 Or $Char = 31 Or $Char = 36 Or $Char = 40 Or $Char = 53 Or $Char = 69 Or $Char = 87 Or $Char = 90 Or $Char = 122 Or $Char = 175 Or $Char = 179 Or $Char = 195 Or $Char > 203) Then
                MsgBox(0, "Error", "Invalid Row number selected")
                ControlSetText("[CLASS:AutoIt v3 GUI]", "", "Edit3", "")
                Sleep(3000)
                readmodule()
            Else
                ;Proceed if valid row number is chosen.
                WinActivate("Microsoft Excel - AllStreamDetails.xls")
                $characteristics = _ExcelReadCell($oExcel, $Char, 4)
                MsgBox(0, "Characteristics", $characteristics);Display the characteristics of the selected stream.
                setvalue()
            EndIf

        Case $modip = "172.24.18.239"
            ;Checking for Invalid rows
            If ($Char = 1 Or $Char = 2 Or $Char = 6 Or $Char = 11 Or $Char = 15 Or $Char = 25 Or $Char = 30 Or $Char = 34 Or $Char = 44 Or $Char = 53 Or $Char = 56 Or $Char = 58 Or $Char = 77 Or $Char = 101 Or $Char = 104 Or $Char = 114 Or $Char > 118) Then
                MsgBox(0, "Error", "Invalid Row number selected")
                ControlSetText("[CLASS:AutoIt v3 GUI]", "", "Edit3", "")
                Sleep(3000)
                readmodule()
            Else
                ;Proceed if valid row number is chosen.
                WinActivate("Microsoft Excel - AllStreamDetails.xls")
                $characteristics = _ExcelReadCell($oExcel, $Char, 4)
                MsgBox(0, "Characteristics", $characteristics);Display the characteristics of the selected stream.
                setvalue()
            EndIf
    EndSelect
EndFunc   ;==>Initiate


;This function reads the Modulator chosen by the user.
Func readmodule()
    $modip = GUICtrlRead($Modulator); read the Modulator IP chosen by the user.
    ;Activate the particular sheet in All Stream Details depending on the Modulator IP chosen by the user.
    Select
        Case $modip = "172.24.18.114"
            _ExcelSheetActivate($oExcel, "ISDB-T Stream Details_Mod-114")
        Case $modip = "172.24.18.118"
            _ExcelSheetActivate($oExcel, "ISDB-T Stream Details_Mod-118")
        Case $modip = "172.24.18.239"
            _ExcelSheetActivate($oExcel, "ISDB-T Stream Details_Mod-239")
    EndSelect
EndFunc   ;==>readmodule


;This function is used to search the location of the module name entered by the user and highlight it.
Func Search()
    Local $I, $Concat
    $mod = GUICtrlRead($module)

    For $I = 2 To 205
        $readmodule = _ExcelReadCell($oExcel, $I, 1)
        If ($mod = $readmodule) Then
            $Concat = "A" & $I
            $oExcel.Activesheet.Range($concat).Select
;~ MsgBox(0,"Module read from the Stream details",$readmodule )
        EndIf
    Next
EndFunc   ;==>Search


Func setvalue()
    Local $Currentlistselection
;~ ;If condition which reads the combobox to find the current selection
    If GUICtrlRead($hCombo) <> $Currentlistselection Then
        ;Reads the new selection value to $hCombo variable
        $Currentlistselection = GUICtrlRead($hCombo)
        ;MsgBox(0, "", "The Cell Value is: " & @CRLF & $currentlistselection, 2)
    EndIf
    ;Activates the already opened Dektec application
    WinActivate("DekTec StreamXpress - Transport-Stream Player")

    ;Moves the application to screen co-ordinates to 0,0
    WinMove("DekTec StreamXpress - Transport-Stream Player", "", 0, 0)
    ;Delay needed to ensure the dektec in moved to the left top corner
    Sleep(500)
    ;Reading the file -> $oExcel, Reading the row number -> $redvalue,Reading the column -> 2
    If IsString($sCellValue) Then
        $sCellValue = _ExcelReadCell($oExcel, $redvalue, 2)
        MsgBox(0, "", "The Cell Value is: " & @CRLF & $sCellValue, 2)
    ElseIf $sCellValue = "" Then
        MsgBox(0, "", "The Cell number selected is invalid: ")
    EndIf

    ;This commented lines reads the current stream being played by the streamer xpress app
    ;local $Getstreamervalue
    ;$getstreamervalue = ControlGetText("DekTec StreamXpress - Transport-Stream Player", "", "Edit1")
    ;MsgBox(0, "", "The stream being played is: " & @CRLF & $getstreamervalue, 2)

    ;This commented lines reads the current frequency selected in the streamer xpress app
    ;local $getstreamerfreq
    ;$getstreamerfreq = ControlGetText("Streamer set Frequency is:", "", "Edit2")
    ;MsgBox(0, "", "The streamer frequency Value is: " & @CRLF & $getstreamerfreq, 2)


    Local $setstream
    ;Button1 clicks the "open" button in Dektec app
    ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button1")
    ;Activating the UI which appears after clicking the "open" button
    WinActivate("Open MPEG-2 Transport Stream")
    ;Delay provided to ensure the above window is launched
    Sleep(2000)
    ;Setting the stream path read from "$sCellValue"(Excel file) onto the Text box(Edit1) before the Open button
    $setstream = ControlSetText("Open MPEG-2 Transport Stream", " ", "Edit1", $sCellValue)
    ;MsgBox(0, "", "The Cell Value is: " & @CRLF & $sCellValue, 2)
    ;Delay provided to esnure the read stream path is copied onto the textbox(Edit1)
    Sleep(1000)
    ;Pressing the Open button(Button2) to ensure the selected stream is opened in streamer application
    ControlClick("Open MPEG-2 Transport Stream", "", "Button2")
    ;MsgBox(0, "", "The stream being played is: " & @CRLF & $setstream, 2)

    WinActivate("TS-Automator")
    Local $getappfreq
    ;Reading the frequency from our application and storing in $getappfreq
    $getappfreq = ControlGetText("TS-Automator", "", "Edit4")
    MsgBox(0, "", "The application frequency Value is: " & @CRLF & $getappfreq, 2)

    ;Copying the read frequency value to the streamer application(Edit6) text box
    $setappfreq = ControlSetText("DekTec StreamXpress - Transport-Stream Player", " ", "Edit6", $getappfreq)
    ;Ensuring the playback is stopped in streamer application
    ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button21", "left", 2)
    Sleep(1000)
    ;Ensuring the play button is pressed to start the current selected stream playback
    ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button19", "left", 2)
EndFunc   ;==>setvalue


Func Automate()
    $hGUI = GUICreate("Automate", 450, 500)
    GUICtrlCreateLabel("First Stream Path :", 8, 20, 130, 15)
    GUICtrlCreateLabel("Second Stream Path :", 8, 60, 130, 15)
    GUICtrlCreateLabel("Third Stream Path :", 8, 100, 130, 15)
    GUICtrlCreateLabel("Fourth Stream Path :", 8, 140, 130, 15)
    GUICtrlCreateLabel("Fifth Stream Path :", 8, 180, 130, 15)
    GUICtrlCreateLabel("Sixth Stream Path :", 8, 220, 130, 15)
    GUICtrlCreateLabel("Seventh Stream Path :", 8, 260, 130, 15)
    GUICtrlCreateLabel("Eighth Stream Path :", 8, 300, 130, 15)
    GUICtrlCreateLabel("Nineth Stream Path :", 8, 340, 130, 15)
    GUICtrlCreateLabel("Tenth Stream Path :", 8, 380, 130, 15)

    $readfirstautoedit = GUICtrlCreateInput("", 140, 20, 200, 20)
    $hCombo1 = GUICtrlCreateCombo("473.000", 360, 20, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readsecondautoedit = GUICtrlCreateInput("", 140, 60, 200, 20)
    $hCombo2 = GUICtrlCreateCombo("473.000", 360, 60, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readthirdautoedit = GUICtrlCreateInput("", 140, 100, 200, 20)
    $hCombo3 = GUICtrlCreateCombo("473.000", 360, 100, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readfourthautoedit = GUICtrlCreateInput("", 140, 140, 200, 20)
    $hCombo4 = GUICtrlCreateCombo("473.000", 360, 140, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readfifthautoedit = GUICtrlCreateInput("", 140, 180, 200, 20)
    $hCombo5 = GUICtrlCreateCombo("473.000", 360, 180, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readsixthautoedit = GUICtrlCreateInput("", 140, 220, 200, 20)
    $hCombo6 = GUICtrlCreateCombo("473.000", 360, 220, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readseventhautoedit = GUICtrlCreateInput("", 140, 260, 200, 20)
    $hCombo7 = GUICtrlCreateCombo("473.000", 360, 260, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readeighthautoedit = GUICtrlCreateInput("", 140, 300, 200, 20)
    $hCombo8 = GUICtrlCreateCombo("473.000", 360, 300, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readninethautoedit = GUICtrlCreateInput("", 140, 340, 200, 20)
    $hCombo9 = GUICtrlCreateCombo("473.000", 360, 340, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readTenthautoedit = GUICtrlCreateInput("", 140, 380, 200, 20)
    $hCombo10 = GUICtrlCreateCombo("473.000", 360, 380, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $Mobility = GUICtrlCreateCheckbox("Mobility", 290, 433, 120, 20)
    GUICtrlGetState($Mobility)

    ;Creating the delay button
    GUICtrlCreateLabel("Delay", 60, 439, 30, 25)
    $Delay = GUICtrlCreateInput("", 90, 433, 30, 20)

    ;Loop button checkbox
    $chkbox = GUICtrlCreateCheckbox("Loop", 170, 433, 120, 20)
    GUICtrlGetState($chkbox)

    ;Creating the Start button
    $Startappbuttn = GUICtrlCreateButton("Start", 55, 460, 70)
    ;The object refers to the already defined Exit button
    $Exitappbuttn = GUICtrlCreateButton("Exit", 165, 460, 70)

    GUISetState()
EndFunc   ;==>Automate


Func Batch()
    If WinExists("Automate") Then
        WinActivate("Automate")
        $read = GUICtrlRead($chkbox);Check if the user has enabled the loop option
        $MobilityRead = GUICtrlRead($Mobility)
        If $read = $GUI_CHECKED Then
            While (1)
                $Userdelay = GUICtrlRead($Delay);Read the delay entered by the user
                If (Int($Userdelay)) Then
                    MsgBox(0, "Delay", "User defined delay is:" & @CRLF & $Userdelay, 1)
                    If $MobilityRead = $GUI_CHECKED Then
                        Mobility()
                    Else
                        setstream()
                    EndIf
                Else
                    MsgBox(16, "Error", "Please enter numeric values only")
                EndIf
            WEnd
        Else

            $Userdelay = GUICtrlRead($Delay);Read the delay entered by the user
            If (Int($Userdelay)) Then
                MsgBox(0, "Delay", "User defined delay is:" & @CRLF & $Userdelay, 1)
                If $MobilityRead = $GUI_CHECKED Then
                    Mobility()
                Else
                    setstream()
                EndIf
            Else
                MsgBox(16, "Error", "Please enter numeric values only")
            EndIf
        EndIf
    EndIf
EndFunc   ;==>Batch


Func getvalues()
    ;reading the values from the text box for all the paths in Automate screen
    $Firstvalue = GUICtrlRead($readfirstautoedit)
    $secondvalue = GUICtrlRead($readsecondautoedit)
    $thirdvalue = GUICtrlRead($readthirdautoedit)
    $fourthvalue = GUICtrlRead($readfourthautoedit)
    $fifthvalue = GUICtrlRead($readfifthautoedit)
    $sixthvalue = GUICtrlRead($readsixthautoedit)
    $seventhvalue = GUICtrlRead($readseventhautoedit)
    $eigthvalue = GUICtrlRead($readeighthautoedit)
    $ninethvalue = GUICtrlRead($readninethautoedit)
EndFunc   ;==>getvalues


Func setstream()
    getvalues()
    Local $Frequency
    $Frequency = ControlGetText("Automate", "", "Edit2")
    MsgBox(0, "Frequency", $Frequency, 1)
    ;Copying the read frequency value to the streamer application(Edit6) text box
    Local $setfreq = ControlSetText("DekTec StreamXpress - Transport-Stream Player", " ", "Edit6", $Frequency)

    Local $I
    For $I = 0 To 9 Step 1
        Local $Path[50] = [$Firstvalue, $secondvalue, $thirdvalue, $fourthvalue, $fifthvalue, $sixthvalue, $seventhvalue, $eigthvalue, $ninethvalue, $Tenthvalue]

        ;Activates the already opened Dektec application
        WinActivate("DekTec StreamXpress - Transport-Stream Player")
        ;Button1 clicks the "open" button in Dektec app
        Sleep(1000)
        ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button1")
        ;Activating the UI which appears after clicking the "open" button
        Sleep(1000)
        WinActivate("Open MPEG-2 Transport Stream")
        ;Setting the stream path read from the Automate UI onto the Text box(Edit1) before the Open button
        $copystream = ControlSetText("Open MPEG-2 Transport Stream", " ", "Edit1", $Path[$I])
        Sleep(1000)
;~ MsgBox(0, "", "The stream being played is: " & @CRLF & $path[$i] , 1)
        Sleep(1000)
        ControlClick("Open MPEG-2 Transport Stream", "", "Button2")

        ;Ensuring the playback is stopped in streamer application
        ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button21", "left", 2)
        Sleep(1000)
        ;Ensuring the play button is pressed to start the current selected stream playback
        ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button19", "left", 2)

        ;These lines read the current stream being played by the streamer xpress app
        Local $getstreamervalue
        $getstreamervalue = ControlGetText("DekTec StreamXpress - Transport-Stream Player", "", "Edit1")
;~ MsgBox(0, "", "The stream being played is in streamer is: " & @CRLF & $getstreamervalue, 2)

        Sleep($Userdelay)
    Next
EndFunc   ;==>setstream


Func Mobility()
    $Firstvalue = GUICtrlRead($readfirstautoedit)
    ;Activates the already opened Dektec application
    WinActivate("DekTec StreamXpress - Transport-Stream Player")
    ;Button1 clicks the "open" button in Dektec app
    Sleep(1000)
    ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button1")
    ;Activating the UI which appears after clicking the "open" button
;~ sleep(1000)
    WinActivate("Open MPEG-2 Transport Stream")
    ;Setting the stream path read from the Automate UI onto the Text box(Edit1) before the Open button
    $copystream = ControlSetText("Open MPEG-2 Transport Stream", " ", "Edit1", $Firstvalue)
    Sleep(1000)
    MsgBox(0, "", "The stream being played is: " & @CRLF & $Firstvalue, 1)
    Sleep(2000)
    ControlClick("Open MPEG-2 Transport Stream", "", "Button2")
    ;These lines read the current stream being played by the streamer xpress app
    Local $getstreamervalue
    $getstreamervalue = ControlGetText("DekTec StreamXpress - Transport-Stream Player", "", "Edit1")
;~ MsgBox(0, "", "The stream being played is in streamer is: " & @CRLF & $getstreamervalue, 2)

    For $J = 0 To 9
        Local $getMFNfreq
        ;Reading the frequency from our application and storing in $getappfreq
        $getMFNfreq = ControlGetText("Automate", "", $Class[$J])
        MsgBox(0, "Frequency", $getMFNfreq, 1)
        ;Copying the read frequency value to the streamer application(Edit6) text box
        Local $setappfreq = ControlSetText("DekTec StreamXpress - Transport-Stream Player", " ", "Edit6", $getMFNfreq)
        ;Ensuring the playback is stopped in streamer application
        ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button21", "left", 2)
        Sleep(10000)
        ;Ensuring the play button is pressed to start the current selected stream playback
        ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button19", "left", 2)

        Sleep($Userdelay)
    Next
EndFunc   ;==>Mobility



While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            WinActivate("Microsoft Excel - AllStreamDetails.xls")
            _ExcelBookClose($oExcel, 0)
            Exit
        Case $msg = $Setvaluebuttn
            readmodule()
            validate()
        Case $msg = $Automateappbuttn
            Automate()
        Case $msg = $Startappbuttn
            Batch()
        Case $msg = $Infoitem
            About()
        Case $msg = $OKappbutton
            Exitabout()
        Case $msg = $Exitappbuttn
            _ExcelBookClose($oExcel, 0)
            Exit
    EndSelect
WEnd

Hi Varian,

Thanks for the reply.Actually we wanted the functionality to be as stated below.

Actually we want the excel sheet to be highlighted based on the option selected from the drop down list and without clicking the "SetValue" button.

For Ex: I select 114 in drop down and this should highlight the 114 worksheet without clicking the setvalue button and if i make a second choice thinking I wanted to select 118 then accordingly it should highlight the 118 worksheet even without clicking the setvalue button.

Thanks

Share this post


Link to post
Share on other sites

I made 2 changes to get that to work.

  • I moved the "readmodule()" function to top-level of the main loop so it runs without any button being pressed.
  • I also changed the "readmodule()" function to check whether the Active sheet differs from the $ModIP value. The active sheet only changes if the $ModIP value is different from the corresponding sheet. This avoids any flickering from Excel. It also allows the Active sheet to change when you scroll through the IP list with the wheel mouse or keyboard arrows.
  • I also added "$oExcel.Application.Quit" to the GUI_CLOSE event and the EXIT BUTTON event. This was more for me and you may remove if it does not suit you better. Let me know what other help you may need.
#include <Excel.au3> ;library for doing excel operations
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <Array.au3>
#include <file.au3>
#include <TS_Automator_Variables.au3>
#include-Once

Opt("GUICoordMode", 1)
;Checking to see if the AllStreamDetails.xls is already opened
If WinExists("Microsoft Excel - AllStreamDetails.xls") Then
    MsgBox(0, "", "The Excel file is already open")
Else
    ;Reading the files from Desktop
    ;This file should already exist on the desktop
    $sFilePath = @DesktopDir & "\AllStreamDetails.xls"
    ;Opening the Excel file
    $oExcel = _ExcelBookOpen($sFilePath)
EndIf

;Error handling in case the excel file is not existing
If @error = 1 Then
    MsgBox(0, "Error!", "Unable to Create the Excel Object")
    Exit
ElseIf @error = 2 Then
    MsgBox(0, "Error!", "File does not exist - Please copy the AllStreamDetails.xls onto your desktop and try")
    Exit
EndIf

;Calling the GUI create function
createGUI()
;About()

Func createGUI()

    $hGUI = GUICreate("TS-Automator", 380, 220)

    GUICtrlCreateLabel("Enter the Modulator IP:", 10, 30, 250, 75)
    ;Combo box with default value as 172.24.18.114
    Global $Modulator = GUICtrlCreateCombo("172.24.18.114", 270, 20, 105, 40)
    ;Combo box with the range of Modulators
    GUICtrlSetData(-1, "172.24.18.118|172.24.18.239", "")

    GUICtrlCreateLabel("Enter the Module:", 10, 55, 250, 75)
    ;Combo box with default value as EMM
    $module = GUICtrlCreateCombo("[EMM]", 270, 45, 105, 40)
    ;Combo box with the range of Modules
    GUICtrlSetData(-1, "[EWS]|[Special Service]|[Parental Rating]|[Region ID]|[Version Change]|[LOGO]|[Frequency List]|[OAD]|[Superimpose]|[Caption]|[EPG]|[Partial Stream]|[Audio Toggling]|[Others]", "")

    GUICtrlCreateLabel("Enter the Row Number of the stream to be loaded :", 10, 80, 250, 75)
    $Readedit = GUICtrlCreateInput(" ", 270, 75, 75, 20)

    GUICtrlCreateLabel("Select the Frequency to be set from the list:", 10, 110, 250, 50)
    ;Combo box with default value as 473.000
    $hCombo = GUICtrlCreateCombo("473.000", 270, 100, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $Automateappbuttn = GUICtrlCreateButton("Automate", 220, 150, 70)
    $Setvaluebuttn = GUICtrlCreateButton("Set Value", 30, 150, 70, 25)
    $Exitappbuttn = GUICtrlCreateButton("Exit", 120, 150, 70)

    $Helpmenu = GUICtrlCreateMenu("About")
    ;creating the info sub menu
    $Infoitem = GUICtrlCreateMenuItem("Info", $Helpmenu)

    ;Making the GUI visible to the end user
    GUISetState()

    ;sleep(2000)

;~ While($Msg <> $setvaluebuttn)
    readmodule()
    ;sleep(3000)
    Search()
;~ WEnd
EndFunc   ;==>createGUI


Func About()
    GUICreate("About", 320, 145)
    Local $Msgfonts
    $Msgfonts = "Comic Sans MS"
    GUISetFont(8, 500, 0, $Msgfonts)
    GUICtrlCreateLabel("** Developed by Vishwas K S and Chandana Prakash of CSG-SQE** ", 5, 30)
    GUICtrlCreateLabel("** LG Soft India Pvt Ltd ** ", 5, 50)
    GUICtrlCreateLabel("** Version : 0.0a ** ", 5, 70)
    GUISetFont(7, 400, 0, $Msgfonts)
    $OKappbutton = GUICtrlCreateButton("OK", 120, 100, 80)
    GUISetState()
EndFunc   ;==>About


Func Exitabout()
    ;deleting the launched About UI
    GUIDelete();
    ;GUISetState(@SW_HIDE)
EndFunc   ;==>Exitabout

;~ Initiate()
;This function validates the user entry of the Excel row number based on positive value calls the setvalue function
Func validate()
    $redvalue = GUICtrlRead($Readedit);Reads the row number entered by the user.
    If (Int($redvalue)) Then
        Initiate()
    Else
        MsgBox(16, "Error", "Please enter numeric values only")
        GUICtrlSetData($Readedit, "")
    EndIf
EndFunc   ;==>validate


Func Initiate()
    MsgBox(0, "", "entering Initaite")
    $Char = GUICtrlRead($Readedit);Read the row number
    $modip = GUICtrlRead($Modulator);Read the modulator chosen by the user

    Select
        Case $modip = "172.24.18.114"
            ;Checking for Invalid rows
            If ($Char = 1 Or $Char = 2 Or $Char = 6 Or $Char = 11 Or $Char = 15 Or $Char = 25 Or $Char = 30 Or $Char = 34 Or $Char = 47 Or $Char = 63 Or $Char = 76 Or $Char = 79 Or $Char = 114 Or $Char = 164 Or $Char = 168 Or $Char = 182 Or $Char > 189) Then

            Else
                ;Proceed if valid row number is chosen.
                WinActivate("Microsoft Excel - AllStreamDetails.xls")
                $characteristics = _ExcelReadCell($oExcel, $Char, 4)
                MsgBox(0, "Characteristics", $characteristics);Display the characteristics of the selected stream.
                setvalue()
            EndIf

        Case $modip = "172.24.18.118"
            ;Checking for Invalid rows
            If ($Char = 1 Or $Char = 2 Or $Char = 7 Or $Char = 17 Or $Char = 21 Or $Char = 31 Or $Char = 36 Or $Char = 40 Or $Char = 53 Or $Char = 69 Or $Char = 87 Or $Char = 90 Or $Char = 122 Or $Char = 175 Or $Char = 179 Or $Char = 195 Or $Char > 203) Then
                MsgBox(0, "Error", "Invalid Row number selected")
                ControlSetText("[CLASS:AutoIt v3 GUI]", "", "Edit3", "")
                Sleep(3000)
                readmodule()
            Else
                ;Proceed if valid row number is chosen.
                WinActivate("Microsoft Excel - AllStreamDetails.xls")
                $characteristics = _ExcelReadCell($oExcel, $Char, 4)
                MsgBox(0, "Characteristics", $characteristics);Display the characteristics of the selected stream.
                setvalue()
            EndIf

        Case $modip = "172.24.18.239"
            ;Checking for Invalid rows
            If ($Char = 1 Or $Char = 2 Or $Char = 6 Or $Char = 11 Or $Char = 15 Or $Char = 25 Or $Char = 30 Or $Char = 34 Or $Char = 44 Or $Char = 53 Or $Char = 56 Or $Char = 58 Or $Char = 77 Or $Char = 101 Or $Char = 104 Or $Char = 114 Or $Char > 118) Then
                MsgBox(0, "Error", "Invalid Row number selected")
                ControlSetText("[CLASS:AutoIt v3 GUI]", "", "Edit3", "")
                Sleep(3000)
                readmodule()
            Else
                ;Proceed if valid row number is chosen.
                WinActivate("Microsoft Excel - AllStreamDetails.xls")
                $characteristics = _ExcelReadCell($oExcel, $Char, 4)
                MsgBox(0, "Characteristics", $characteristics);Display the characteristics of the selected stream.
                setvalue()
            EndIf
    EndSelect
EndFunc   ;==>Initiate


;This function reads the Modulator chosen by the user.
Func readmodule()
    $modip = GUICtrlRead($Modulator); read the Modulator IP chosen by the user.
    ;Activate the particular sheet in All Stream Details depending on the Modulator IP chosen by the user.
    Select
        Case $modip = "172.24.18.114"
            If _ExcelSheetNameGet($oExcel) <> "ISDB-T Stream Details_Mod-114" Then _ExcelSheetActivate($oExcel, "ISDB-T Stream Details_Mod-114")
        Case $modip = "172.24.18.118"
            If _ExcelSheetNameGet($oExcel) <> "ISDB-T Stream Details_Mod-118" Then _ExcelSheetActivate($oExcel, "ISDB-T Stream Details_Mod-118")
        Case $modip = "172.24.18.239"
            If _ExcelSheetNameGet($oExcel) <> "ISDB-T Stream Details_Mod-239" Then _ExcelSheetActivate($oExcel, "ISDB-T Stream Details_Mod-239")
    EndSelect
EndFunc   ;==>readmodule


;This function is used to search the location of the module name entered by the user and highlight it.
Func Search()
    Local $I, $Concat
    $mod = GUICtrlRead($module)

    For $I = 2 To 205
        $readmodule = _ExcelReadCell($oExcel, $I, 1)
        If ($mod = $readmodule) Then
            $Concat = "A" & $I
            $oExcel.Activesheet.Range($concat).Select
;~ MsgBox(0,"Module read from the Stream details",$readmodule )
        EndIf
    Next
EndFunc   ;==>Search


Func setvalue()
    Local $Currentlistselection
;~ ;If condition which reads the combobox to find the current selection
    If GUICtrlRead($hCombo) <> $Currentlistselection Then
        ;Reads the new selection value to $hCombo variable
        $Currentlistselection = GUICtrlRead($hCombo)
        ;MsgBox(0, "", "The Cell Value is: " & @CRLF & $currentlistselection, 2)
    EndIf
    ;Activates the already opened Dektec application
    WinActivate("DekTec StreamXpress - Transport-Stream Player")

    ;Moves the application to screen co-ordinates to 0,0
    WinMove("DekTec StreamXpress - Transport-Stream Player", "", 0, 0)
    ;Delay needed to ensure the dektec in moved to the left top corner
    Sleep(500)
    ;Reading the file -> $oExcel, Reading the row number -> $redvalue,Reading the column -> 2
    If IsString($sCellValue) Then
        $sCellValue = _ExcelReadCell($oExcel, $redvalue, 2)
        MsgBox(0, "", "The Cell Value is: " & @CRLF & $sCellValue, 2)
    ElseIf $sCellValue = "" Then
        MsgBox(0, "", "The Cell number selected is invalid: ")
    EndIf

    ;This commented lines reads the current stream being played by the streamer xpress app
    ;local $Getstreamervalue
    ;$getstreamervalue = ControlGetText("DekTec StreamXpress - Transport-Stream Player", "", "Edit1")
    ;MsgBox(0, "", "The stream being played is: " & @CRLF & $getstreamervalue, 2)

    ;This commented lines reads the current frequency selected in the streamer xpress app
    ;local $getstreamerfreq
    ;$getstreamerfreq = ControlGetText("Streamer set Frequency is:", "", "Edit2")
    ;MsgBox(0, "", "The streamer frequency Value is: " & @CRLF & $getstreamerfreq, 2)


    Local $setstream
    ;Button1 clicks the "open" button in Dektec app
    ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button1")
    ;Activating the UI which appears after clicking the "open" button
    WinActivate("Open MPEG-2 Transport Stream")
    ;Delay provided to ensure the above window is launched
    Sleep(2000)
    ;Setting the stream path read from "$sCellValue"(Excel file) onto the Text box(Edit1) before the Open button
    $setstream = ControlSetText("Open MPEG-2 Transport Stream", " ", "Edit1", $sCellValue)
    ;MsgBox(0, "", "The Cell Value is: " & @CRLF & $sCellValue, 2)
    ;Delay provided to esnure the read stream path is copied onto the textbox(Edit1)
    Sleep(1000)
    ;Pressing the Open button(Button2) to ensure the selected stream is opened in streamer application
    ControlClick("Open MPEG-2 Transport Stream", "", "Button2")
    ;MsgBox(0, "", "The stream being played is: " & @CRLF & $setstream, 2)

    WinActivate("TS-Automator")
    Local $getappfreq
    ;Reading the frequency from our application and storing in $getappfreq
    $getappfreq = ControlGetText("TS-Automator", "", "Edit4")
    MsgBox(0, "", "The application frequency Value is: " & @CRLF & $getappfreq, 2)

    ;Copying the read frequency value to the streamer application(Edit6) text box
    $setappfreq = ControlSetText("DekTec StreamXpress - Transport-Stream Player", " ", "Edit6", $getappfreq)
    ;Ensuring the playback is stopped in streamer application
    ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button21", "left", 2)
    Sleep(1000)
    ;Ensuring the play button is pressed to start the current selected stream playback
    ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button19", "left", 2)
EndFunc   ;==>setvalue


Func Automate()
    $hGUI = GUICreate("Automate", 450, 500)
    GUICtrlCreateLabel("First Stream Path :", 8, 20, 130, 15)
    GUICtrlCreateLabel("Second Stream Path :", 8, 60, 130, 15)
    GUICtrlCreateLabel("Third Stream Path :", 8, 100, 130, 15)
    GUICtrlCreateLabel("Fourth Stream Path :", 8, 140, 130, 15)
    GUICtrlCreateLabel("Fifth Stream Path :", 8, 180, 130, 15)
    GUICtrlCreateLabel("Sixth Stream Path :", 8, 220, 130, 15)
    GUICtrlCreateLabel("Seventh Stream Path :", 8, 260, 130, 15)
    GUICtrlCreateLabel("Eighth Stream Path :", 8, 300, 130, 15)
    GUICtrlCreateLabel("Nineth Stream Path :", 8, 340, 130, 15)
    GUICtrlCreateLabel("Tenth Stream Path :", 8, 380, 130, 15)

    $readfirstautoedit = GUICtrlCreateInput("", 140, 20, 200, 20)
    $hCombo1 = GUICtrlCreateCombo("473.000", 360, 20, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readsecondautoedit = GUICtrlCreateInput("", 140, 60, 200, 20)
    $hCombo2 = GUICtrlCreateCombo("473.000", 360, 60, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readthirdautoedit = GUICtrlCreateInput("", 140, 100, 200, 20)
    $hCombo3 = GUICtrlCreateCombo("473.000", 360, 100, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readfourthautoedit = GUICtrlCreateInput("", 140, 140, 200, 20)
    $hCombo4 = GUICtrlCreateCombo("473.000", 360, 140, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readfifthautoedit = GUICtrlCreateInput("", 140, 180, 200, 20)
    $hCombo5 = GUICtrlCreateCombo("473.000", 360, 180, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readsixthautoedit = GUICtrlCreateInput("", 140, 220, 200, 20)
    $hCombo6 = GUICtrlCreateCombo("473.000", 360, 220, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readseventhautoedit = GUICtrlCreateInput("", 140, 260, 200, 20)
    $hCombo7 = GUICtrlCreateCombo("473.000", 360, 260, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readeighthautoedit = GUICtrlCreateInput("", 140, 300, 200, 20)
    $hCombo8 = GUICtrlCreateCombo("473.000", 360, 300, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readninethautoedit = GUICtrlCreateInput("", 140, 340, 200, 20)
    $hCombo9 = GUICtrlCreateCombo("473.000", 360, 340, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $readTenthautoedit = GUICtrlCreateInput("", 140, 380, 200, 20)
    $hCombo10 = GUICtrlCreateCombo("473.000", 360, 380, 75, 20)
    ;Combo box with range of frequencies
    GUICtrlSetData(-1, "479.000|485.000|491.000|497.000|503.000|509.000|515.000|521.000|527.000|533.000|539.000|545.000|551.000|557.000|563.000|569.000|575.000|581.000|587.000|593.000|599.000|605.000|611.000|617.000|623.000|629.000|635.000|641.000|647.000|653.000|659.000|665.000|671.000|677.000|683.000|689.000|695.000|701.000|707.000|713.000|719.000|725.000|731.000|743.000|749.000|755.000|761.000|767.000", "") ; add other item snd set a new default

    $Mobility = GUICtrlCreateCheckbox("Mobility", 290, 433, 120, 20)
    GUICtrlGetState($Mobility)

    ;Creating the delay button
    GUICtrlCreateLabel("Delay", 60, 439, 30, 25)
    $Delay = GUICtrlCreateInput("", 90, 433, 30, 20)

    ;Loop button checkbox
    $chkbox = GUICtrlCreateCheckbox("Loop", 170, 433, 120, 20)
    GUICtrlGetState($chkbox)

    ;Creating the Start button
    $Startappbuttn = GUICtrlCreateButton("Start", 55, 460, 70)
    ;The object refers to the already defined Exit button
    $Exitappbuttn = GUICtrlCreateButton("Exit", 165, 460, 70)

    GUISetState()
EndFunc   ;==>Automate


Func Batch()
    If WinExists("Automate") Then
        WinActivate("Automate")
        $read = GUICtrlRead($chkbox);Check if the user has enabled the loop option
        $MobilityRead = GUICtrlRead($Mobility)
        If $read = $GUI_CHECKED Then
            While (1)
                $Userdelay = GUICtrlRead($Delay);Read the delay entered by the user
                If (Int($Userdelay)) Then
                    MsgBox(0, "Delay", "User defined delay is:" & @CRLF & $Userdelay, 1)
                    If $MobilityRead = $GUI_CHECKED Then
                        Mobility()
                    Else
                        setstream()
                    EndIf
                Else
                    MsgBox(16, "Error", "Please enter numeric values only")
                EndIf
            WEnd
        Else

            $Userdelay = GUICtrlRead($Delay);Read the delay entered by the user
            If (Int($Userdelay)) Then
                MsgBox(0, "Delay", "User defined delay is:" & @CRLF & $Userdelay, 1)
                If $MobilityRead = $GUI_CHECKED Then
                    Mobility()
                Else
                    setstream()
                EndIf
            Else
                MsgBox(16, "Error", "Please enter numeric values only")
            EndIf
        EndIf
    EndIf
EndFunc   ;==>Batch


Func getvalues()
    ;reading the values from the text box for all the paths in Automate screen
    $Firstvalue = GUICtrlRead($readfirstautoedit)
    $secondvalue = GUICtrlRead($readsecondautoedit)
    $thirdvalue = GUICtrlRead($readthirdautoedit)
    $fourthvalue = GUICtrlRead($readfourthautoedit)
    $fifthvalue = GUICtrlRead($readfifthautoedit)
    $sixthvalue = GUICtrlRead($readsixthautoedit)
    $seventhvalue = GUICtrlRead($readseventhautoedit)
    $eigthvalue = GUICtrlRead($readeighthautoedit)
    $ninethvalue = GUICtrlRead($readninethautoedit)
EndFunc   ;==>getvalues


Func setstream()
    getvalues()
    Local $Frequency
    $Frequency = ControlGetText("Automate", "", "Edit2")
    MsgBox(0, "Frequency", $Frequency, 1)
    ;Copying the read frequency value to the streamer application(Edit6) text box
    Local $setfreq = ControlSetText("DekTec StreamXpress - Transport-Stream Player", " ", "Edit6", $Frequency)

    Local $I
    For $I = 0 To 9 Step 1
        Local $Path[50] = [$Firstvalue, $secondvalue, $thirdvalue, $fourthvalue, $fifthvalue, $sixthvalue, $seventhvalue, $eigthvalue, $ninethvalue, $Tenthvalue]

        ;Activates the already opened Dektec application
        WinActivate("DekTec StreamXpress - Transport-Stream Player")
        ;Button1 clicks the "open" button in Dektec app
        Sleep(1000)
        ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button1")
        ;Activating the UI which appears after clicking the "open" button
        Sleep(1000)
        WinActivate("Open MPEG-2 Transport Stream")
        ;Setting the stream path read from the Automate UI onto the Text box(Edit1) before the Open button
        $copystream = ControlSetText("Open MPEG-2 Transport Stream", " ", "Edit1", $Path[$I])
        Sleep(1000)
;~ MsgBox(0, "", "The stream being played is: " & @CRLF & $path[$i] , 1)
        Sleep(1000)
        ControlClick("Open MPEG-2 Transport Stream", "", "Button2")

        ;Ensuring the playback is stopped in streamer application
        ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button21", "left", 2)
        Sleep(1000)
        ;Ensuring the play button is pressed to start the current selected stream playback
        ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button19", "left", 2)

        ;These lines read the current stream being played by the streamer xpress app
        Local $getstreamervalue
        $getstreamervalue = ControlGetText("DekTec StreamXpress - Transport-Stream Player", "", "Edit1")
;~ MsgBox(0, "", "The stream being played is in streamer is: " & @CRLF & $getstreamervalue, 2)

        Sleep($Userdelay)
    Next
EndFunc   ;==>setstream


Func Mobility()
    $Firstvalue = GUICtrlRead($readfirstautoedit)
    ;Activates the already opened Dektec application
    WinActivate("DekTec StreamXpress - Transport-Stream Player")
    ;Button1 clicks the "open" button in Dektec app
    Sleep(1000)
    ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button1")
    ;Activating the UI which appears after clicking the "open" button
;~ sleep(1000)
    WinActivate("Open MPEG-2 Transport Stream")
    ;Setting the stream path read from the Automate UI onto the Text box(Edit1) before the Open button
    $copystream = ControlSetText("Open MPEG-2 Transport Stream", " ", "Edit1", $Firstvalue)
    Sleep(1000)
    MsgBox(0, "", "The stream being played is: " & @CRLF & $Firstvalue, 1)
    Sleep(2000)
    ControlClick("Open MPEG-2 Transport Stream", "", "Button2")
    ;These lines read the current stream being played by the streamer xpress app
    Local $getstreamervalue
    $getstreamervalue = ControlGetText("DekTec StreamXpress - Transport-Stream Player", "", "Edit1")
;~ MsgBox(0, "", "The stream being played is in streamer is: " & @CRLF & $getstreamervalue, 2)

    For $J = 0 To 9
        Local $getMFNfreq
        ;Reading the frequency from our application and storing in $getappfreq
        $getMFNfreq = ControlGetText("Automate", "", $Class[$J])
        MsgBox(0, "Frequency", $getMFNfreq, 1)
        ;Copying the read frequency value to the streamer application(Edit6) text box
        Local $setappfreq = ControlSetText("DekTec StreamXpress - Transport-Stream Player", " ", "Edit6", $getMFNfreq)
        ;Ensuring the playback is stopped in streamer application
        ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button21", "left", 2)
        Sleep(10000)
        ;Ensuring the play button is pressed to start the current selected stream playback
        ControlClick("DekTec StreamXpress - Transport-Stream Player", "", "Button19", "left", 2)

        Sleep($Userdelay)
    Next
EndFunc   ;==>Mobility


While 1
    $msg = GUIGetMsg()
    readmodule()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            WinActivate("Microsoft Excel - AllStreamDetails.xls")
            _ExcelBookClose($oExcel, 0)
            $oExcel.Application.Quit
            Exit
        Case $msg = $Setvaluebuttn
            validate()
        Case $msg = $Automateappbuttn
            Automate()
        Case $msg = $Startappbuttn
            Batch()
        Case $msg = $Infoitem
            About()
        Case $msg = $OKappbutton
            Exitabout()
        Case $msg = $Exitappbuttn
            _ExcelBookClose($oExcel, 0)
            $oExcel.Application.Quit
            Exit
    EndSelect
WEnd

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0