app



 app object provides the application related functions used by PowerScene. Main functions are program termination, executing external programs, playing sound, and printing messages.

 The functions are available in PowerScene Studio, and some functions are available in Data Explorer.

 app object provides the followiing functions.




Methods



Return Type

Method

Explorer Support

Description


ackAll()


Acknowledge all alarms which are not acknowledged in the alarm window.


setAlarmStationFilter( name )


Reflect only the alarm which its station is 'name' from the PowerScene alarm window.

list[str]

analogPointNamesByStation( stationName )

O

Return the name of analog points belonging to that station.

  boolean

checkPassword( password )


Verify the password, and return whether the authentication is succeeded or failed.


clearTimer()


setInterval로 실행한 모든 스크립트를 중지합니다.

list[str]

commChennelGroupNames()


Return the communication channel group list.

 list[str]

commChennelNames()

O

Return the communication channel list.

list[str]

commChennelNamesInCommGroup( chennelName )


Return the communication channel list belonging to that communication channel group.

 boolean

confirmUserDialog( title, id )


Process the authentication with displaying the user authentication dialog.


connect( eventName, func )


Register a receivable event handler for log-in and log-off.

 str

connectedServer()


Return the IP address of the SCADA server.


connectValueChange( func, pointNames )


포인트값 변경시 수신되는 이벤트 핸들러를 등록합니다.


copyToClipboard( data )


Copy the data to a clipboard.

  list[int]

currentDate()

O

Return the current time. (Year, Month, Day, Hour, Minute, Second)

int

currentDay()

O

Return the current date.

int

currentHour()

O

Return the current hour.

int

currentMinute()

O

Return the current minute.

int

currentMonth()

O

Return the current month.

int

currentSecond()

O

Return the current second.

  str

currentUser()


Return the name of logged-in users

int

currentYear()

O

Return the current year.

  list[str]

dataReportNames()


Return the history data report group list.

int

daysInMonth( year, month )

O

Entered the year and month, and return the number of days for that month.

  list[str]

deviceNames()

O

Return the device list.


executeFile( path )


Execute the program for that path.


exitApp()


Terminate the running PowerScene application program.


fullScreen()


Maximize the running PowerScene canvas. ( * Same function as F5 of MS-PPT)

list[str]

generateReport( reportName, year, month, day, parameter )


등록된 파워씬 리포트를 생성하고 관련 정보를 반환합니다.

boolean

generateReport( path, reportName, year, month, day, parameter )

O

등록된 파워씬 리포트를 path 경로에 생성하고 결과를 반환합니다.

  str or float or int

getProperty( property )

O

Obtain the value of global variables.

boolean

hasProperty( property )

O

Validate the specified property exists.

 list[str]

historyDataGroupNames()


Return the history data group list.

 boolean

isCalculationRunning( name )

O

Return whether the calculation registered in Data Explorer is running.

boolean

isDataGroupEnabled( name )


이력 데이터 그룹의 수집 여부를 반환합니다.

boolean

isHoliday( year, month, day )

O

Validate whether the specified day is a holiday.

  boolean

isLogOn()


Return the current log-in state.

  boolean

isTodayHoliday()

O

Return whether today is a holiday.

boolean

isTrendSetEnabled( name )


Return whether the trend set is saved.

  boolean

logOn( user, password )


Log-in with entering the user ID and password.

  boolean

logOut( user, password )


Log-out with entering the user ID and password.


maximize()


Maximize the running PowerScene screen.


messageBox( text )


Print a message box.


messageBox( title, text )


Print a message box with title.


minimize()


Minimize the running PowerScene screen.


moveScreen( number )


Move the PowerScene HMI program to the desired monitor.

  int

onlineDuration()


Obtain the operating time of the SCADA server in seconds.

 str

onlineDurationString()


Obtain the operating time of the SCADA server in the form of hour:minute:second.


openAlarmWindow()


Open the detailed alarm window.

  boolean

openAuthDialog( title )


Open the user authentication window and return whether the authentication is succeeded or failed.


openExplorer( path )


Open the file explorer for that path.

 str

openFileDialog( path )


Open the file explorer for that path, if a file is selected, return the file path and file name.

  str

openFolderDialog()


Open the folder dialog, if a folder is selected, return the folder path.


openHistoryBrowser()


Open the history report browser.

boolean

openLoginOutForm ()


Open the log-in and log-out window.

  list[float]

openNumberInputDialog( title, defaultValue )


Open the number input dialog.


openNumberKeypad()


Open the number keypad.

 list[str]

openPasswordInputDialog( title, devaultValue )


Print the password input dialog on the screen.


openPointBrowser()


Open the point browser.


openReport( reportName, year, month, day )


등록된 파워씬 리포트를 생성하고 엽니다.

  str

openSaveFileDialog( path )


Open the save file dialog for that path, and return the entire path of the file on the dialog.

  str

openSaveFileDialog( path, title, ext )


Set the default path, file's extension, and dialog title. Then open the save file dialog.

Return the entire path of the entered file on the dialog.


openStationBrowser()


Open the SCADA summary information window.

list[str]

openStringInputDialog( title, defaultValue )


Print the string input dialog on the screen


openTrendView( name )


Open the trend window.

  app.PlatformType

platformType()


Return the platform for the currently running HMI program. ( Desktop(PC), Andriod, Embedied )


playSound( filepath )


Play the sound file for that path.


playTTS( tts )


Play the entered text in Korean. ( Voiceware TTS engine must be installed. )


playTTS( tts, lang )


Play the entered text in the desired language. ( Voiceware TTS engine must be installed. )

  boolean

questionMessageBox( title, message )


Open the message window to select yes or no.


reloadSchedule()


간편 스케줄을 재로드합니다.


restore()


Restore the fullScreen applied screen. ( * Restored screen is maximized screen. )


restoreCursor()


Restore the mouse pointer as a default.


runApp( filepath )


Execute the application program for that path.


runApp2( name, parameter )


Execute the application program for that path, then use the entered parameters.


setAllTriggerEnabled( enable )


Set all trigger control enable or disable.


setCalculationEnable( name, enable )

O

Set the registered calculation to enable or disable.


setDataGroupEnabled( name, enabled )


이력 데이터 그룹의 수집을 활성화하거나 비활성화합니다.


setDataGroupEnabled( enabled )


모든 이력 데이터 그룹의 수집을 활성화하거나 비활성화합니다.


setInterval( script, msec )


스크립트를 특정 시간(msec) 간격으로 반복 실행합니다.


setProperty( property, value )

O

Create a global variable and set the value.


setScreenAutoMove( move )


Set the screen auto move function to enable or disable.


setTrandSetEnabled( name, enabled )


Set the trend set saving to enable or disable.


setTrandSetEnabled( enabled )


모든 트랜드 그룹의 수집을 활성화하거나 비활성화합니다.


setTriggerEnabled( name, enabled )


Set the trigger to enable or disable.


showWaitCursor()


Change the mouse pointer to the shape of an hourglass.

list[str]

stationNames()

O

Return the name of all stations in the project.

list[str]

statusPointNamesByStation( stationName )

O

Return the name of status points belonging to the entered station.


stopInterval( script )


setInterval로 실행한 스크립트를 중지합니다.

  list[int]

sunsetTime( year, month, day, latitude, longitude )

O

Return the sunset time corresponding to the entered date of the entered location.

list[int]

sunriseTime( year, month, day, latitude, longitude )

O

Return the sunrise time corresponding to the entered date of the entered location.

  list[int]

systemSunsetTime( year, month, day )

O

Return the sunset time corresponding to the entered date of the system location.

  list[int]

systemSunriseTime( year, month, day )

O

Return the sunrise time corresponding to the entered date of the system location.

 list[int]

todaySystemSunsetTime()

O

Return today's sunset time of the system location.

list[int]

todaySunsetTime( latitude, longitude )

O

Return today's sunset time of the entered location.

 list[int]

todaySystemSunriseTime()

O

Return today's sunrise time of the system location.

  list[int]

todaySunriseTime( latitude, longitude )

O

Return today's sunrise time of the entered location.

datetime

toUtcDateTime( localtime )


Convert the local time to UTC Date time.

  list[str]

trandSetNames()

O

Return the name of all trend groups specified by Data Explorer.

  float

trimDecimal( value, decimal )


Set the decimal place for the entered value.


wait( msec )

O

PowerScene program waits for a set of period.


  ackAll()

 

  Acknowledge all alarms which are not acknowledged in the alarm window.



  Example)

   


       app.ackAll();  # Acknowledge all alarms which are not acknowledged in the alarm window.

   



  Print a message window that contains the name of trend groups via a loop.


                               



  setAlarmStationFilter( name:Station name )

 

  setAlarmStationFilter reflects only the alarm in which its station is corresponding to the user-set station. It is used to see only the alarms in that station.




  Example)

   


       app.setAlarmSationFilter('A');  # Reflects only the alarms about station 'A' in the alarm window.


   


                               



  boolean checkPassword( password:Password )

 

  Validate a password in the script.

 

  If the correct password is entered as a parameter 'password', return TRUE, or FALSE.



  Examples)

   

   

       # Suppose that the password is 1234


       ret = app.checkPassword('1234');  # If the correct password is entered, return TRUE.

       app.messageBox(ret);  # The value of ret is TRUE.


       ret = app.checkPassword('0000');  # If the wrong password is entered, return FALSE.

       app.messageBox(ret);  # The value of ret is FALSE.




  The following is the result of checkPassword


                               



  clearTimer()

 

  setInterval() 로 실행되고 있는 모든 스크립트를 중지합니다.

 


  예)

   

   

       app.clearTimer()




  list[str] commChennelNames()

 

  Return the communication channel list.



  Example)

   

     

       list = app.commChennelNames()  #Return the communication channel list.


       i = 0


       for item in list:

              print 'list[', i, '] = ',  item

              i = i + 1




  Result)


 


       list[ 0 ] =  Smart channel - 1

       list[ 1 ] =  Smart channel - 3

       list[ 2 ] =  Smart channel - 4

       list[ 3 ] =  Smart channel - 5





  boolean confirmUserDialog( title:Confirm title, id:Confirm ID )

 

  Process the authentication by displaying the user authentication dialog.


  Enter the authentication name and user.



  Example)

   

     

       title = 'Control authority'


       id = 'admin'


       ret = app.confirmUserDialog(title, id)

       

       #Success

       if ( ret == 1 ) :

              print 'Success'


       #Failed

       else:        

              print 'Failed'




                               



  str connectedServer()

 

  Return the IP address of the SCADA server.



  Example)

   

     

       app.messageBox(app.connectedServer());  # Return the IP address of the SCADA server.




  The following is the result of connectedServer.


                               



  copyToClipboard( text:String to copy on a clipboard )

 

  Copy data on a clipboard.


  By using the paste function in programs such as Notepad, Excel, and Powerpoint, Users can paste the copied contents



  Example)

   

     

       app.copyToClipboard('Copy the data.');





  list[int] currentDate()

 

  Return the current date and time.



  Example)

   


       year, month, day, hour, minute, second= app.currentDate()  # Return the current date and time.


       



  int currentDay()

 

  Return the current day.



  Example)

   


        day = app.currentDay()  # Return the current day.


       



  int currentHour()

 

  Return the current hour.



  Example)

   


       hour = app.currentHour()  # Return the current hour.


       



  int currentMinute()

 

  Return the current minute.



  Example)

   


       minute = app.currentMinute()  # Return the current minute.


       



  int currentMonth()

 

  Return the current month.



  Example)

   


       month = app.currentMonth()  # Return the current month.


       



  int currentSecond()

 

  Return the current second.



  Example)

   


       second = app.currentSecond()  # Return the current second.

       





  str currentUser()

 

  Obtain the name of the currently logged-in user.



  Example)

   


       User_Name = app.currentUser();  # Obtain the name of the currently logged-in user.


   


  Print the currentUser information using a messageBox.


                               



  int currentYear()

 

  Return the current year.



  Example)

   


       year = app.currentYear()  # Return the current year.

       




  list[str] dataReportNames()

 

  Return the history data report group list.



  Example)

   

     

       list = app.dataReportNames()  # Read the history data report group list.


       i = 0


       for item in list:

              print 'list[', i, '] = ',  item

              i = i + 1




  Result)


 


       list[ 0 ] =  Smart channel - 1

       list[ 1 ] =  Smart channel - 3

       list[ 2 ] =  Smart channel - 4

       list[ 3 ] =  Smart channel - 5




  int daysInMonth( year, month )

 

  Entered the year and month, and return the number of days for that month.



  Example)

   


       days = app.daysInMonth(2017, 2)  # Return the number of days for Feburary, 2017.

       print days

       



  Output)

   

       28

       


  list[str] deviceNames()

 

  Return the device list.



  Example)

   

     

       list = app.deviceNames()  # Return the device list.


       i = 0


       for item in list:

              print 'list[', i, '] = ',  item

              i = i + 1




  Result)


 


       list[ 0 ] =  Smart device - 1

       list[ 1 ] =  Smart device - 3

       list[ 2 ] =  Smart device - 4

       list[ 3 ] =  Smart device - 5




  executeFile( path:File path)

 

  path: Enter the file path to execute.



  Example)

   


       app.executeFile('C:/Workspace/test.txt')  # Execute the text.txt file for 'C:/Workspace'.

   



  Execute the text.txt file for 'C:/Workspace'.



                               


                               



  exitApp()

 

  exitApp terminates the PowerScene HMI program.


  Terminate the currently running PowerScene HMI program. It is used with PushButtons or other functions.



  Example)

   


       app.exitApp();  # Terminate the PowerScene HMI.


   


                               



  fullScreen()

 

  Set the currently running PowerScene canvas as a fullscreen.

  It is the same as the F5 of MS-PPT functions.

 


  Example)

   


       app.fullScreen()  # Set the canvas as a fullscreen.


   


                               



  [str or float or int] getProperty( property:Property )

 

  Return the value of selected property.


  If the value does not exist, return None.



  Example)

   

     

       Value = app.getProperty('LastResult');





  boolean hasProperty( property:Property )

 

  Validate whether the set property exists. If it exists, return TRUE, or return FALSE.



  Example)

   

     

       app.setProperty('property',1234);


       ret = app.hasProperty('property')


       if  ret == 1 :

              Value = app. getProperty('property');

              app.messageBox(Value);




  Result)

                               



  list[str] historyDataGroupNames()

 

  Return history data group names.



  Example)

   

     

       list = app.historyDataGroupNames()  # Return history data group names.


       i = 0


       for item in list:

              print 'list[', i, '] = ',  item

              i = i + 1




  Result)


 


       list[ 0 ] =  Smart channel - 1

       list[ 1 ] =  Smart channel - 3

       list[ 2 ] =  Smart channel - 4

       list[ 3 ] =  Smart channel - 5




  boolean isCalculationRunning( name:Script name )

 

  Represent whether the calculation is running in SCADA server.


  If the script is running in the server, return TRUE, or return FALSE.



  Example)

   


       Running = app.isCalculationRunning('A');  # Validate whether the calculation 'A' is running in SCADA server.

       app.messageBox(Running);




  The screen to check whether the calculation is running.


                               



  boolean isHoliday( year, month, day )

 

  Validate whether the entered date is a holiday. If it is, return TRUE, or return FALSE.



  Example)

   


       ret = app. isHoliday(2016, 1, 1)  # Validate whether January 1st ,2016 is a holiday.


       # If it is a holiday

       if (ret == 1) :

              print '2016-1-1 is a holiday.'


       # If it is not a holiday

       else:

              print '2016-1-1 is not a holiday.'

 




  boolean isLogOn()

 

  Return the currently log-in state.



  Example)

   

     

       ret = app.isLogOn();  # Return the current log-in state.





  boolean isTodayHoliday()

 

  Validate whether today is a holiday. If it is, return TRUE, or return FALSE.



  Example)

   


       ret = app.isTodayHoliday()  # Validate whether today is a holiday.


       # If today is a holiday

       if (ret == 1) :

              print 'today is a holiday.'


       # If today is not a holiday

       else:

              print 'today is not a holiday.'

 




  boolean logOn( user:User, password:Password )

 

  Process the log-on with the entered user ID and password. If the log-on succeeds, return TRUE, or return FALSE.



  Example)

   

     

       Ret = app.logOn('admin', '1234')  #  If the log-on succeeds, return TRUE.

       print Ret





  boolean logOut( user:User, password:Password )

 

  Process the log-out with the entered user ID and password. If the log-out succeeds, return TRUE, or return FALSE.



  Example)

   

     

       Ret = app.logOut('admin', '1234')  #  If the log-out succeeds, return TRUE.

       print Ret





  maximize()

 

  Maximize the currently running PowerScene window.

 

        ㆍ Maximizing window by conditional statements.

        ㆍ Maximize the screen without clicking on a window when the program is running.



  Example)

   


       app.maximize();  # Maximize the window.


   


                               



  messageBox( text:Output message )

 

  Print the string on the window.


        ㆍ The messageBox is used as a:

                1) Print a message

                2) Print an alarm


        ㆍ Enter the String to text.



  Example)

   


       app.messageBox('print a screen');  # Print a message 'print a screen' on the window.

   





  messageBox( title:Window name, text:Output message )

 

   Print the message on the window.


        ㆍ The messageBox is used as a:

                1) Print a message

                2) Print a alarm.


        ㆍ title represents the name of window, and enter string.

        ㆍ Enter the String to text.



  Example)

   


       app.messageBox('Title', 'Message');  # Print 'Message' on 'Title' window.




                               



  minimize()

 

  Minimize the currently running PowerScene window.

 

        ㆍ The minimize is used as a:

                1) Minimizing window by conditional statements.

                2) Minimize the screen without clicking on a window when the program is running.



  Example)

   


       app.minimize();  # Minimize the window.


   


                               



  moveScreen( number:Monitor number )

 

  Move the PowerScene program to the desired monitor.


        ㆍ number represents a monitor number.

                - You should validate the number before entering the number.

                - Enter the value of -1 for the monitor number.

                        Example) If the monitor number is 1, enter 0.

                        Example) If the monitor number is 2, enter 1.



  Example)

   

       

       app.moveScreen(0)  # Move to monitor 1.


       app.moveScreen(1)  # Move to monitor 2.




  This is the result screen after executing connectedServer.

                               

* Monitor 1 Example

* Monitor 2 Example



* Move the HMI to momitor 1

* Move the HMI to monitor 2



Users can check the monitor numer with [OK] button in the window screen display setting.



  int onlineDuration()

 

  Return the operating time of the PowerScene SCADA server.


          ㆍ  Unit is a second.



  Example)

   

     

       Duration = app.onlineDuration();  # Return the operating time of the SCADA server in seconds.


       app.messageBox(str(Duration) + 'seconds');




  This is the result screen after executing onlineDuration.


                               



  str onlineDurationString()

 

  Return the operating time of the SCADA server in a form of hour:minute:second.



  Example)

   

     

       Duration = app.onlineDurationString();  # Return the operating time of the SCADA server in a form of hour:minute:second.


       app.messageBox(Duration);




  This is the result screen after executing onlineDurationString.


                               



  openAlarmWindow()

 

  Open the detailed alarm window.



  Example)

   

     

       app.openAlarmWindow();  # Open the detailed alarm window.




  This is the result screen of executing openAlarmWindow.


                               



  boolean openAuthDialog( title:Title )

 

  Open the user authentication window.


        ㆍ Open the user authentication window part.

        ㆍ Process the authentication by entering user ID and password on the user confirm field.

                - User authentication success : Return TRUE.

                - User authentication failed : Return FALSE.



  Example)

   


       ret = app.openAuthDialog('Need a user authentication');  # Open user authentication. String 'Need a user authentication' is displayed on the command part.


       app.messageBox(ret);  # If an user authentication is succeeded, return TRUE, or return FALSE.


   


  This is the result window of executing openAuthDialog.


                               



  openExplorer( path:Folder path )

 

   Open the file explorer for that path.

 

        ㆍ Open the file explorer for that path.



  Example)

   


       app.openExplorer('C:\Program Files');  # Open the 'C:\Program Files' folder.


   


                               



  str openFileDialog( path:File extension)

 

  Open the file explorer for that path, and show files that corresponding to the entered file extension. If a file selected, return its path.


        ㆍ openFileDialog is used as a:

                1) Directly use the selected file in the PowerScene by openFileDialog.

                2) Run the application program using runApp.

                3) Play the sound using playSound.


        ㆍ path is entered as String.



  Example)

   


       FilePath = app.openFileDialog('*.wav');  # Show .wav files in the current project folder.


   


                               



  str openFolderDialog()

 

  Open the folder select dialog, and if a folder selected, return the path of that folder.



  Example)

   


       FolderPath = app.openFolderDialog();  # Return the path of the selected folder.


   


                               



  openHistoryBrowser()

 

  Open the history report browser for PowerScene.



  Example)

   

     

       app.openHistoryBrowser();  # Open the history report browser for PowerScene.




  This is the result screen of executing openHistoryBrowser.


                               



  boolean openLoginOutForm()

 

  Open the log-in window.


        ㆍ Log-in / Log-out success : Return TRUE.

        ㆍ Log-in / Log-out failed : Return FALSE.



  Example)

   

     

       ret = app.openLoginOutForm();  # Open the log-in window.


       app.messageBox(ret);




  Execute openLoginOutForm and return the value.


                               



  list[float] openNumberInputDialog( text:The text name under the title, default:The default value )

 

  Open the number input dialog.

 

        ㆍ If the OK button is selected, return TRUE(1) and the value, if the Cancel button is selected, return FALSE(0) and the value.

                - OK button : [ True(1), Value ]

                - Cancel button : [  False(0), Value ]



  Example)

   

     

       result , value = app.openNumberInputDialog('Enter the number.', 12.1234);  # Open the number input dialog.


       app.messageBox(result);

       app.messageBox(value);




  The following is the result of executing openNumberInputDialog.


                               



  list[str] openPasswordInputDialog( text:The text name under the title, default:The default value )

 

  Open the password input dialog on the screen.


        ㆍ If the OK button selected, return 1(TRUE) and the entered text, if the Cancel button selected, return 0(FALSE) and an empty text.

                - OK button : [ True(1), Entered text ]

                - Cancel button : [  False(0), Empty text ]



  Example)

   

     

       result , value  = app.openPasswordInputDialog('Enter the password.', '1234');  # Open the password input dialog.


       app.messageBox(result);

       app.messageBox(value);




  This is the result of executing openPasswordInputDialog.


                               



  str openSaveFileDialog( path:Folder path )

 

  Open the save file dialog for the user entered path.

 

        ㆍ If the file saved, return its path.



  Example)

   


       path = app.openSaveFileDialog('C:\Program Files');  # Open the save file dialog for 'C:\Program Files'

       print path




                               



  str openSaveFileDialog( path:Folder path, title:Dialog title, ext:File extension )

 

   Open the save file dialog for the user entering a path.


        ㆍ Enter the path of folders to path.

        ㆍ Enter the name of the save file dialog to the title.

        ㆍ Enter the file extension to ext.



  Example)

   


       path = app.openSaveFileDialog('C:\Program Files', 'Save text file', 'txt');  # Open the save file dialog for 'C:\Program Files'. The name of the dialog is 'Save text file', and the extension of saving file is 'txt'.

       print path




                             


                               



  openStationBrowser()

 

  Open the SCADA summary information window.



  Example)

   

     

       app.openStationBrowser();  # Open the SCADA summary information window.




  This is the result of executing openStationBrowser.


                               



  list[str] openStringInputDialog( text:The text under the title, default:The default value )

 

  Open the String input dialog.

 

        ㆍ If the OK button is selected, return TRUE(1) and the entered text, if the Cancel button is selected, return FALSE(0) and an empty text.

                - OK button : [ True(1), Entered text ]

                - Cancel button : [  False(0), Empty text ]



  Example)

   

     

       result , value  = app.openStringInputDialog('Enter the text.', 'Entered text');  # Open the String input dialog.


       app.messageBox(result);

       app.messageBox(value);




  This is the result of executing openStringInputDialog.


                               



  openTrendView( name:Trend group name )

 

  openTrendView is used to open the entered trend group with the trend viewer.



  Example)

   


       app.openTrendView('A');  # Open 'A' with the trend viewer.


   


                               


                               



  app.PlatformType platformType()

 

  Return the platform type of the currently running HMI program. ( Desktop(PC), Android, Embedded )



  Example)

   


       plat = app.platformType()  # Return the platform type of the currently running HMI program.


       # Desktop

       if ( plat == app.DeskTop ):

              print 'PC HMI'


       # Andriod

       elif ( plat == app.Mobilie ):

              print 'Android'


       # Embedded

       elif (plat == app.Embedded):

              print 'Embedded'


       


  


  playSound( filepath:File path )

 

  Used to play the sound file the user wanted.


        ㆍ playSound is used as:

                1) Play the alarm sound

                2) Play the sound depending on the graphic event action.


        ㆍ Enter the path of the sound to file path as a String format.

        ㆍ The extension is '.wav'.



  Example)

   


       app.playSound('soundfile');  # Play 'soundfile.wav' in the project folder.


   


                               



  playTTS( tts:Text to be played )

 

  Play the text in the Korean voice.


        ㆍ Voiceware TTS engine must be installed.



  Example)

   


       app.playTTS('환영합니다')  # Korean voice.

       




  playTTS( tts:Text to be played , lang:Languages ) 

 

  Play the text in the selected voice.


        ㆍ Voiceware TTS engine must be installed.



  Example)

   


       app.playTTS('환영합니다',  app.Korean) # Korean voice.

       

       app.playTTS('Welcome',  app.English)  # English voice.





  boolean questionMessageBox( title:The name of message box, message:message contents )

 

  Open the question message box.

 

        ㆍ If the OK button is selected, return TRUE, if the Cancel button is selected, return FALSE.

                - OK button : True(1)

                - Cancel button : False(0)



  Example)

   

     

       ret = app.questionMessageBox('Title', 'Would like to keep going?');  # Open the question message box.


       app.messageBox(ret);




  This is the result of executing questionMessageBox.


                               



  restore()

 

  Restore the fullscreen.

  Provide the same as F5 in MS-PPT.


        ㆍ restore() is applied in fullScreen() state only.



  Example)

   


       app.restore()  # Restore the fullscreen.


   


                               



  runApp( filepath:Application program path )

 

  Provide the function that can run the application program on PowerScene.


        ㆍ Used to need other programs such as documents or drawing board when using PowerScene.

        ㆍ Enter the application program to be executed to file path. It should be entered as String and include a file extension.



  Example)

   


       app.runApp('PowerScene.exe');  # 'Execute 'PowerScene.exe'.

   



                               



  runApp2( name:Application program name, parameter:File name )

 

  Provide the function that can run the application program on PowerScene.


        ㆍ runApp2 is used to need other programs such as documents or drawing board when using PowerScene.

        ㆍ runApp2 differs from runApp. It executes an application and opens the file generated by the application program.

        ㆍ Enter the application program to name. It should be entered in String and include a file extension.

        ㆍ The parameter has to enter consisting of the file path to be processed, and filename.

 



  Example)

   


       app.runApp2('notepad.exe', 'C:/test')


   


                               



  setAllTriggerEnabled( enable )

 

  Set all trigger control to enabled or disabled.


          ㆍ Enter 0 or 1 on enable.

                    - Enabled : Enter 1

                    - Disabled : Enter 0



  Example)

   


       days = app.setAllTriggerEnabled( 1 )  # All trigger control are enabled.

       days = app.setAllTriggerEnabled( 0 )  # All trigger control are disabled.


       


  


  setCalculationEnable( name:Calculation, enable:Using calculation )

 

  Set the registered calculation to enabled or disabled.



  Example)

   

     

       app.setCalculationEnable('A', False);  # Set A to disabled


       Running = app.isCalculationRunning('A');

       app.messageBox(Running);


       app.setCalculationEnable('B', True);  # Set B to enabled.


       Running = app.isCalculationRunning('B');

       app.messageBox(Running);




  This is the result of executing isCalculationRunning.


                               



  setProperty( property:Property, value:Value )

 

  Create a property and save it on property.


          ㆍ setProperty is used to save data.

          ㆍ property is the concept of global variables, and value means the value applying to the global variable.



  Example)

   

     

       app.setProperty('LastResult', 1234);  #Create LastResult and save 1234.






  setScreenAutoMove( move:Using )

 

  Set screen auto move function to enabled or disabled.


          ㆍ Execute : Enter 1

          ㆍ Stop : Enter 0



  Example)

   

     

       app.setScreenAutoMove(1)  # Execute screen auto move

       app.setScreenAutoMove(0)  # Stop screen auto move





  setTriggerEnabled( triggerName, enable )

 

  Set the trigger to enabled or disabled.


          ㆍ triggerName is entered as String.

          ㆍ Enter 0 or 1 to enable.

                    - Enable : Enter 1

                    - Disable : Enter 0




  Example)

   


       days = app.setTriggerEnabled('A' , 1 ) # Enable trigger A

       days = app.setTriggerEnabled('B' , 0 ) # Disable trigger B


       


  


  list[str] stationNames()

 

  Obtain the name of all stations in the project.


          ㆍ station is a form of lists.



  Example)

   


       StationNames = app.stationNames();  # Read the name of all stations.


       for x in StationNames:

              app.messageBox(x);




  Print a message that contains the trend group name through a loop.


                               



  list[int] sunsetTime( year:Year, month:Month, day:Day, latitude:Latitude, longitude:Lonitude )

 

  Return the sunset time corresponding to the entered date of the entered location.


        ㆍ Return the list in Hour:Minute:Second format.



  Example)

   

     

       hour , minute, second = app.sunsetTime(2016, 7, 25, 37.300, 127.000)  # Return the sunset time at July, 25, 2016, the latitude is 37.300 and the longitude is 127.000


       print "Sunset Time Time : ", hour, ':', minute, ':', second

 



  Result)


   

     

       Sunset Time :  19 : 44 : 0




  Users can check the location in the [Data Explorer]-[Region Setting] tab.


                                                              



  list[int] sunriseTime( year:Year, month:Month, day:Day, latitude:Latitude, longitude:Longitude )

 

  Return the sunrise time corresponding to the entered date of the entered location.


        ㆍ Return the list in Hour:Minute:Second format.



  Example)

   

     

       hour , minute, second = app.sunriseTime(2016, 7, 25, 37.300, 127.000)  # Return the sunrise time at July, 25, 2016, the latitude is 37.300 and the longitude is 127.000.


       print "Sunrise Time : ", hour, ':', minute, ':', second

 



  Result)


   

     

       Sunrise Time :  5 : 32 : 0




  Users can check the location in the [Data Explorer]-[Region Setting] tab.


                                                   



  list[int] systemSunsetTime( year:Year, month:Month, day:Day )

 

  Return the sunset time corresponding to the entered date of the system location.


        ㆍ Return the list in Hour:Minute:Second format.



  Example)

   

     

       hour , minute, second = app.systemSunsetTime(2016, 7, 25)  # Return the sunset time at July, 25, 2016.


       print "Sunset Time Time : ", hour, ':', minute, ':', second

 



  Result)


   

     

       Sunset Time :  19 : 44 : 0




  Users can check the location in the [Data Explorer]-[Region Setting] tab.


                                                



  list[int] systemSunriseTime( year:Year, month:Month, day:Day )

 

  Return the sunrise time corresponding to the entered date of system location.


        ㆍ Return the list in Hour:Minute:Second format.



  Example)

   

     

       hour , minute, second = app.systemSunriseTime(2016, 7, 25)  # Return the sunset time at July, 25, 2016.


       print "Sunrise Time : ", hour, ':', minute, ':', second

 



  Result)


   

     

       Sunrise Time :  5 : 32 : 0




  Users can check the location in the [Data Explorer]-[Region Setting] tab.


                                                   



  list[int] todaySystemSunsetTime()

 

  Return today's sunset time of system location.


        ㆍ Return the list in Hour:Minute:Second format.



  Example)

   

     

       hour , minute, second = app.todaySystemSunsetTime()  # Return today's sunset time of system location.


       print "Sunset Time Time : ", hour, ':', minute, ':', second

 



  Result)


   

     

       Sunset Time :  19 : 44 : 0




  Users can check the location in the [Data Explorer]-[Region Setting] tab.


                                                   



  list[int] todaySunsetTime( latitude:Latitude, longitude:Longitude )

 

  Return today's sunset time of the entered location


        ㆍ Return the list in Hour:Minute:Second format.



  Example)

   

     

       hour , minute, second = app.todaySunsetTime(37.300, 127.000)  # Return today's sunset time of the location that its latitude is 37.300 and longitude is 127.000


       print "Sunset Time Time : ", hour, ':', minute, ':', second

 



  Result)


   

     

       Sunset Time :  19 : 44 : 0




  Users can check the location in the [Data Explorer]-[Region Setting] tab.


                                                   



  list[int] todaySystemSunriseTime()

 

  Return today's sunrise time of system location.


        ㆍ Return the list in Hour:Minute:Second format.



  Example)

   

     

       hour , minute, second = app.todaySystemSunriseTime()  # Return today's sunrise time of system location.


       print "Sunrise Time : ", hour, ':', minute, ':', second




  Result)


   

     

       Sunrise Time :  5 : 32 : 0




  Users can check the location in the [Data Explorer]-[Region Setting] tab.


                                                   



  list[int] todaySunriseTime( latitude:Latitude, longitude:Longitude )

 

  Return today's sunrise time of the entered location.


        ㆍ Return the list in Hour:Minute:Second format.



  Example)

   

     

       hour , minute, second = app.todaySunriseTime(37.300, 127.000)  # Return today's sunrise time at the location that its latitude is 37.300 and longitude is 127.000.


       print "Sunrise Time : ", hour, ':', minute, ':', second




  Result)


   

     

       Sunrise Time :  5 : 32 : 0




  Users can check the location in the [Data Explorer]-[Region Setting] tab.


                                                   



  datetime toUtcDateTime( localtime:Local date time )

 

  Convert the local date time into UTC Date time.



  Example)

   

     

       import datetime


       local = datetime.datetime(2015,11,17,10,10,0);  # 17, November, 2015, 10:10:00

       app.messageBox(local);


       UTC = app.toUtcDateTime(local);  # Convert the local date time into UTC Date time.

       app.messageBox(UTC);





  list[str] trandSetNames()

 

  Read the name of all trend groups stored in Data Explorer.


        ㆍ Return value is a form of a list.



  Example)

   


       TrandNames = app.trandSetNames();  # Read the name of trend groups as a list.


       for x in TrandNames:

              app.messageBox(x);


   


  Print a message contains the name of trend groups through a loop.


                               



  float trimDecimal( value:Value, Decimal:Decimal point )

 

  Return the value that rounded off the numbers to set decimal places.



  Example)

   


       num = 23.1284;


       num=app.trimDecimal(num, 2);  # Round off 23.1284 to three decimal places.


       app.messageBox(num);


   


  Set two decimal places and print.


                               



  wait( msec:Time  )

 

  PowerScene program waits for a set of period.


        ㆍ 1000 msec equals a second.



  Example)

   


       app.wait(1000);  # wait for a second.


   




  list[str] analogPointNamesByStation( stationName )

 

  Read the list of analog points in the station.



  Example)

   


       pointnames = app.analogPointNamesByStation('LP1');  # Read the name of analog points in station LP1.

       print pointnames





  list[str] statusPointNamesByStation( stationName )

 

  Read the list of status points in the station.



  Example)

   


       pointnames = app.statusPointNamesByStation('LP1');  # Read the name of status points in the station LP1.

       print pointnames





  setTrandSetEnabled( name:Trend set name, enabled:Use saving )

 

  Set the trend set saving enabled or disabled.


        ㆍ Enabled   :  Enter 1

        ㆍ Disabled  :  Enter 0



  Example)

   


       app.setTrandSetEnabled('Trend name',1);  # Enable the saving of the trend set.


       app.setTrandSetEnabled('Trend name',0);  # Disable the saving of the trend set.




  setTrandSetEnabled( enabled:Use saving )

 

  모든 트랜드 그룹의 수집을 활성화하거나 비활성화합니다.


        ㆍ 수집 활성화     :  1 입력

        ㆍ 수집 비활성화  :  0 입력



  예)

   


       app.setTrandSetEnabled(1);  # 모든 트랜드 그룹의 수집을 활성화합니다.


       app.setTrandSetEnabled(0);  # 모든 트랜드 그룹의 수집을 비활성화합니다.




  boolean isTrendSetEnabled( name:Trend name )

 

  Return whether the trend set is saving.


        ㆍ Enabled  : Return TRUE

        ㆍ Disabled : Return FALSE



  Example)

   


       app.isTrendSetEnabled('Trend set');  # Return whether the trend set is saving.





  list[str] commChennelGroupNames()

 

  Return the communication group channel.



  Example)

   


       app.commChennelGroupNames();  # Return the communication group channel.





  list[str] commChennelNamesInCommGroup( chennelName:Communication channel name )

 

  Return the communication channel list that belongs to the communication channel group.



  Example)

   


       app.commChennelNamesInCommGroup('Communication channel name');  # Return the communication channel list that belongs to the communication channel group.





  showWaitCursor()

 

  Change the mouse pointer to the shape of an hourglass.

  when the executing time takes longer, it can change the mouse pointer to the shape of an hourglass to represent the working state.


  Example)

   


       app.showWaitCursor();  # Change the mouse pointer to the shape of an hourglass.





  restoreCursor()

 

  Restore the mouse pointer to the default.



  Example)

   


       app.restoreCursor();  # Restore the mouse pointer to the default.





  openPointBrowser()

 

  Open the point browser.



  Example)

   


       app.openPointBrowser();  # Open the point browser.





   connect( eventName:Event handler name, func:Event functions )

 

  Register an event handler and receive log-on / out events.

       


  Example)

   

       def onLogOn():

         print 'logoned'


       def onLogOut():

         print 'logouted'


      # Register log-on handler

      app.connect('logOned()' , onLogOn )

      # Register log-out handler

      app.connect('logOuted()' , onLogOut )





  result , value = openNumberKeypad(  )

 

  Open the number keypad.

       

  Example)

   

      result , value = app.openNumberKeypad()

      if ( result == 0 ):

       app.messageBox('Cancel','Cancel the input')

      else:

       print value




Result)



  setDataGroupEnabled ( name:이력 데이터 그룹명, enabled:수집 유무 )

 

  입력한 이력 데이터 그룹의 수집을 활성화하거나 비활성화합니다.


        ㆍ 수집 활성화     :  1 입력

        ㆍ 수집 비활성화  :  0 입력



  예)

   


       app.setDataGroupEnabled('이력 데이터 그룹명',1);  # 이력 데이터 그룹의 수집을 활성화합니다.


       app.setDataGroupEnabled('이력 데이터 그룹명',0);  # 이력 데이터 그룹의 수집을 비활성화합니다.





  setDataGroupEnabled( enabled:수집 유무 )

 

  모든 이력 데이터 그룹의 수집을 활성화하거나 비활성화합니다.


        ㆍ 수집 활성화     :  1 입력

        ㆍ 수집 비활성화  :  0 입력



  예)

   


       app.setDataGroupEnabled(1);  # 모든 이력 데이터 그룹의 수집을 활성화합니다.


       app.setDataGroupEnabled(0);  # 모든 이력 데이터 그룹의 수집을 비활성화합니다.






  boolean isDataGroupEnabled ( name:이력 데이터 그룹명 )

 

  입력한 이력 데이터 그룹의 수집 여부를 반환합니다.


        ㆍ 수집할 경우 : 참(true)를 반환

        ㆍ 수집하지 않을 경우 : 거짓(false)를 반



  예)

   


       app.isDataGroupEnabled('이력 데이터 그룹명');  # 입력한 이력 데이터 그룹의 수집 여부를 반환합니다.





  result, path = generateReport ( reportName:리포트명, year:년, month:월, day:일, parameter:추가 파라미터 전달 )

 

  미리 등록된 파워씬 리포트 양식으로 리포트를 생성하고 관련 정보를 리턴합니다.

       

        ㆍ reportName 에는 엑셀로 미리 등록된 파워씬 리포트명을 입력합니다.

        ㆍ parameter 에는 추가로 파워씬 리포트 스크립트에 사용될 데이터를 전달합니다.

        ㆍ result 에 결과값을 path 에는 저장된 경로를 반환합니다.


  예)

   

       param = {}

       param['a'] = '123'

       param['b'] = '제주'

       param['c'] = 456


       ret, path = app.generateReport('도시 리포트', 2022, 4, 12, param)

       

       if (ret == True):

           print path + u'위치에 생성되었습니다.'

       else:

           print u'생성에 실패했습니다.'




  파워씬 리포트 등록


  1. 파워씬 리포트 로그인

 

  2. 파워씬 리포트 양식 생성/저장 후 스크립트 작성

 

 


  생성된 리포트

 



  boolean generateReport ( path: 저장 경로, reportName:리포트명, year:년, month:월, day:일, parameter:추가 파라미터 전달 )

 

  미리 등록된 파워씬 리포트 양식으로 리포트를 생성하고 결과값을 리턴합니다.

       

        ㆍ path 에는 리포트가 저장될 경로를 입력합니다.

        ㆍ reportName 에는 엑셀로 미리 등록된 파워씬 리포트명을 입력합니다.

        ㆍ parameter 에는 추가로 파워씬 리포트 스크립트에 사용될 데이터를 전달합니다.


  예)

   

       param = {}

       param['a'] = '123'

       param['b'] = '제주'

       param['c'] = 456


       ret = app.generateReport('C:\\Report\\', '도시 리포트', 2022, 4, 12, param)

 

       if (ret == True):

           print u'생성되었습니다.'

       else:

           print u'생성에 실패했습니다.'




  openReport ( reportName:리포트명, year:년, month:월, day:일 )

 

  미리 등록된 파워씬 리포트 양식으로 리포트를 생성하고 엽니다.

       

        ㆍ reportName 에는 엑셀로 미리 등록된 파워씬 리포트명을 입력합니다.


  예)

   

       app.openReport('도시 리포트', 2022, 4, 12)




         



  reloadSchedule ()

 

  간편 스케줄에 등록된 모든 스케줄을 재로드합니다.

       

  예)

   

       app.reloadSchedule()





  setInterval ( script:표현식, msec:실행 주기 )

 

  사용자가 설정한 표현식 스크립트를 msec(1000=1초) 간격으로 실행합니다.

 

  ※ app.setInterval() 로 설정된 스크립트는 전역으로 실행되어 해당 캔버스가 닫혀도 계속 실행됩니다.

       

  예)

   

       app.setInterval('app.playSound("soundfile")', 5000)




  5초마다 app.playSound("soundfile") 스크립트가 실행됩니다.



  stopInterval ( script:표현식 )

 

  사용자가 설정한 표현식 스크립트를 중지합니다.

       

  예)

   

       app.stopInterval('app.playSound("soundfile")')





  connectValueChange ( func:함수, pointNames:포인트명 )

 

  입력한 포인트값이 변경될 때 등록된 이벤트 핸들러 함수가 실행됩니다.

       

        ㆍ func 에는 실행될 핸들러 함수를 입력합니다.

            ㆍ 핸들러 함수의 name 에는 변경된 포인트값의 이름이 전달됩니다.

            ㆍ 핸들러 함수의 value 에는 변경된 포인트값이 전달됩니다.

        ㆍ pointNames 에는 포인트명을 리스트형태로 입력합니다.


  ※ app.connectValueChange() 로 설정된 이벤트 핸들러 함수는 전역으로 실행되어 해당 캔버스가 닫혀도 계속 실행됩니다.


  예)

   

       def handleChange(name, value):

           if name == 'COM.1 충전상태':

               if value == 0:

                   app.playSound("alarm.wav")

               elif value == 1:

                   app.playSound("confirm.wav")


       lst = ['COM.1 충전상태', 'COM.2 충전상태']

       app.connectValueChange(handleChange, lst)




  'COM.1 충전상태', 'COM.2 충전상태' 포인트값의 변경에 따라 사운드를 재생합니다.