Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

os.manage - now asks the user in how many minutes to perform the oper…

…ation.
  • Loading branch information...
commit 94a3476f1de11e950b44500fd7943d60aea6c3b7 1 parent 42e6fd0
@talgalili authored
Showing with 26 additions and 8 deletions.
  1. +5 −1 NEWS
  2. +16 −6 R/os.manage.r
  3. +5 −1 man/os.manage.Rd
View
6 NEWS
@@ -6,6 +6,9 @@ NEW FUNCTIONS ADDED:
* install.7zip - for unzipping of FFmpeg
* system.PATH - to see what is in the users PATH for running .exe programs.
+UPDATED FUNCTIONS:
+ * os.manage - now asks the user in how many minutes to perform the operation.
+
BUG FIXES:
* Fixed a bug in install.LyX.rd that caused it to not load properly when using install_github (props goes to Richard Cotton for catching the bug.)
@@ -158,4 +161,5 @@ TODO for future releases:
* Add install.notepad and install.notepadpp
* Maybe add some timer to the os.manage functions. And also allow input for how long from x time to perform the action.
* Add a rate function for the package
- * Add automatic check for a new R version every X time.
+ * Add automatic check for a new R version every X time.
+ * a way to copy/move Rprofile.site from one installation to the next such as "C:\Program Files\R\R-2.15.2\etc\Rprofile.site" to "C:\Program Files\R\R-2.15.3\etc\Rprofile.site"? (requested by: Farrel Buchinsky)
View
22 R/os.manage.r
@@ -179,6 +179,7 @@ os.restart <- function(s=0, m=0, h=0) {
#' A centeral function to run functions for shuting down, restarting, sleeping (etc.) your computer.
#' This will run these functions immediatly.
#' @param use_GUI a logical indicating whether a graphics menu should be used if available. If TRUE, and on Windows, it will use \link{winDialog}, otherwise it will use \link[utils]{menu}.
+#' @param ask a logical indicating whether to ask the user for the number of minutes in which to perform the operation.
#' @param ... not in use
#' @return The status code of \code{\link[base]{system}}.
#' @seealso \code{\link[base]{system}},\code{\link[base]{shell}}, \code{\link[base]{Sys.sleep}},
@@ -191,7 +192,7 @@ os.restart <- function(s=0, m=0, h=0) {
#' os.manage()
#' ## the next day you wake up, "thank you, R" :)
#' }
-os.manage <- function(use_GUI = TRUE, ...) {
+os.manage <- function(use_GUI = TRUE, ask = TRUE, ...) {
choices <- c("Shutdown",
"Sleep",
"Hibernate",
@@ -201,12 +202,21 @@ os.manage <- function(use_GUI = TRUE, ...) {
the_answer <- menu(choices, graphics = use_GUI, title = "Manage your OS (for Windows)")
+ # in how many minutes to perform the operation?
+ if(ask) minutes <-
+ winDialogString(
+ paste("In how many MINUTES would you like to ", choices[the_answer] , "?", sep=""),
+ "")
+ minutes <- as.numeric(minutes)
+ if(is.na(minutes)) minutes<- 0
+
+ # perform the operation:
switch(the_answer,
- os.shutdown(),
- os.sleep(),
- os.hibernate(),
- os.lock(),
- os.restart(),
+ os.shutdown(m = minutes),
+ os.sleep(m = minutes),
+ os.hibernate(m = minutes),
+ os.lock(m = minutes),
+ os.restart(m = minutes),
return(FALSE)
)
}
View
6 man/os.manage.Rd
@@ -2,7 +2,7 @@
\alias{os.manage}
\title{Gives managing option to the current OS (shutdown, restart, sleep, hibernate, etc...)}
\usage{
- os.manage(use_GUI = TRUE, ...)
+ os.manage(use_GUI = TRUE, ask = TRUE, ...)
}
\arguments{
\item{use_GUI}{a logical indicating whether a graphics
@@ -10,6 +10,10 @@
Windows, it will use \link{winDialog}, otherwise it will
use \link[utils]{menu}.}
+ \item{ask}{a logical indicating whether to ask the user
+ for the number of minutes in which to perform the
+ operation.}
+
\item{...}{not in use}
}
\value{
Please sign in to comment.
Something went wrong with that request. Please try again.