library(pptsdd)

connect_to_browser

connect_to_browser() is used to start selenium webdriver service. You can use this function before using download_csv_auto() and download_csv_schedule().

connect_to_browser(dest_dir = "C:/Users/Dell/Desktop/test")
#>  An appropriate version of chromedriver.exe is already present.
#>  You have already downloaded the .jar file in  C:/Users/Dell/Desktop/test/selenium/4.0 .
#>  Chrome browser was installed on this computer. 
#>  Java is installed on this computer.
#>  New selenium server process created.

download_csv_auto

download_csv_auto() can download pig performance test station CSVs from chrome browser.

# Start selenium webdriver service
connect_to_browser(dest_dir = "C:/Users/Dell/Desktop/test")
#>  An appropriate version of chromedriver.exe is already present.
#>  You have already downloaded the .jar file in  C:/Users/Dell/Desktop/test/selenium/4.0 .
#>  Chrome browser was installed on this computer. 
#>  Java is installed on this computer.
#>  Old selenium server process with PID 34860 terminated.
#>  New selenium server process created.
# Download CSVs
download_csv_auto(url = Sys.getenv("url"), 
                  username = Sys.getenv("username"), 
                  password = Sys.getenv("password"),
                  csv_position = "1",
                  location = c("606","607"), 
                  date = c("2024-02-18","2024-02-19"), 
                  download_path = "C:/Users/Dell/Downloads/download_rename")
#>  Directory already exists: NonEmptyCSVs 
#>  Directory already exists: EmptyCSVs 
#>  Downloading CSVs for date: 2024-02-18 
#>  Downloading CSVs for date: 2024-02-19 
#>  All stations and dates nedap ppt CSVs had been downloaded.

download_csv_schedule

download_csv_schedule() is used to make download task. You can download the Yesterday data at certain time in every day.

# Make a download task
download_csv_schedule(taskname = "ppt_csv_download",
                      schedule = "DAILY",
                      starttime = "20:00",
                      startdate = format(Sys.Date(), "%Y/%m/%d"),
                      rscript_args = list(url = Sys.getenv("url"),
                                          username = Sys.getenv("username"),
                                          password = Sys.getenv("password"),
                                          location = c("606","607"),
                                          csv_position = "1",
                                          download_path = "C:/Users/Dell/Downloads/download_temp"))
#> [1] "SUCCESS: The scheduled task \"ppt_csv_download\" has successfully been created."
# Delete download task
taskscheduleR::taskscheduler_delete("ppt_csv_download")
#> [1] 0
# Reset selenium webdriver service
disconnect_from_browser()
#>  Selenium server process with PID 18484 terminated.
#>  No Chromedriver process found.
#>  Startup .bat file removed.

disconnect_from_browser

disconnect_from_browser() is used to reset selenium webdriver service. You can use this function after using download_csv_auto() and download_csv_schedule().

disconnect_from_browser()
#>  No Selenium server process found.
#>  No Chromedriver process found.
#>  No startup .bat file found.

get_csv

# Download CSV data for a specific location range or date range.
get_csv(url = Sys.getenv("url"),
        username = Sys.getenv("username"),
        password = Sys.getenv("password"),
        location_min = "607",
        location_max = "608",
        date_min = "2024-02-18",
        date_max = "2024-02-19",
        download_path = "C:/Users/Dell/Downloads/download_temp", 
        show_message = TRUE)
#>  Locations: 607_608 and Dates: 2024-02-18_2024-02-19 downloaded

get_csv_auto

# Download CSV data for a specific location or date
get_csv_auto(url = Sys.getenv("url"),
             username = Sys.getenv("username"),
             password = Sys.getenv("password"),
             location = c("607","608"),
             date = c("2024-02-18", "2024-02-19"),
             download_path = "C:/Users/Dell/Downloads/download_rename")
#>  Directory already exists: NonEmptyCSVs 
#>  Directory already exists: EmptyCSVs 
#>  Downloading CSVs for date: 2024-02-18 
#>  Downloading CSVs for date: 2024-02-19 
#>  All stations and dates nedap ppt CSVs had been downloaded.

get_csv_schedule

# Make a download task
get_csv_schedule(taskname = "ppt_csv_download",
                 schedule = "DAILY",
                 starttime = "20:00",
                 startdate = format(Sys.Date(), "%Y/%m/%d"),
                 rscript_args = list(url = Sys.getenv("url"),
                                     username = Sys.getenv("username"),
                                     password = Sys.getenv("password"),
                                     location = c("606","607"),
                                     download_path = "C:/Users/Dell/Downloads/download_rename"))
#> [1] "SUCCESS: The scheduled task \"ppt_csv_download\" has successfully been created."
# Delete download task
taskscheduleR::taskscheduler_delete("ppt_csv_download")
#> [1] 0
# Reset selenium webdriver service
disconnect_from_browser()
#>  No Selenium server process found.
#>  No Chromedriver process found.
#>  No startup .bat file found.

That’s it ! This the end of the documented story of our package. All components are there.