How to set desktop background in terminal with osascript? - osascript

I can change desktop background successfully in Script Editor with the following code.
tell application "Finder" to set desktop picture to POSIX file "/path/3Q83dROp3Fk.jpg"
But the following code in terminal doesn't work
osascript -e "tell application \"Finder\" to set desktop picture to POSIX file \"/path/3Q83dROp3Fk.jpg\""
Save the script file as 1.scpt and run the osascript 1.scpt returns 1.scpt: execution error: Finder got an error: AppleEvent handler failed. (-10000)
System: macOS High Sierra.

Related

Hide Console from Executing CMD /c <executable> On Registry for Context Menu

I have an executable to work on some data files. On Windows 10, because of the alias path of the executable, I need to put "CMD /c <executable_path>" on the registry to run the executable from the context menu (ref: Can't run an EXE from context menu when using ALIAS path in windows registry). However, this would show the console window until the executable finishes. Is there any way to hide the console window during the execution?
I have tried to add "START /b" or "START /min" to the command on the registry, but with those the Windows would pop up a dialog asking me what to do with the selected file.

I tried to create a small .exe file using pyinstaller but it is showing an error

I tried to create a small .exe file using pyinstaller but it is showing an error "The Application has failed to start because it's side-by-side is incorrect. Please see the application event log or use the command-line sxstrace.exe tool"
Error image

When running script: "julia -i run/run_nf.jl", the error following error is displayed "Could not determine command"

When I input the command
"julia -i run/run_nf.jl" the error "could not determine command" is shown.
before the error is shown this is how my cd looks like:
After activating the project with the command "activate." The following text is displayed in purple color ""
Finally with the command "julia -i run/run_nf.jl" I run the script "run_nf.jl" that is located on the folder "run". However, instead of running the script the following error is displayed.
The instruction for running and installing the necessary pachages are described in detail here:
Instruction, which I am based to run my script
As #fredrikekre mentioned in the comments, you are trying to run a terminal command from the Julia REPL's PKG mode, which will not work. You have two options:
Run the command from inside the REPL's shell mode by first using the "delete" or "backspace" key to exit out of the Pkg mode (you will see the prompt change) and then typing in ; which switched the REPL to shell mode and then you can run that command.
Same as above in that you need to exit the Pkg mode by clicking the "delete" or "backspace" key on you computer, and then you can run (from the REPL) include("run/run_nf.jl") which will run the file (assuming that is the correct file path).
I will also make a PR to that package you linked above to update the docs to be more clear. Edit, link to PR: https://github.com/dynamicslab/NormalFormAE/pull/7

MobaXterm console and Rscript

I recently started using MobaXterm console and I would like to execute Rscripts in it. I read that I should include # !usr/bin... code in my R script, but this doesnt work, as Moba still doesn't recognize Rscript command.
I also tried to move Rscript.exe in the directory where the R script is, but it doesn't work either.
I.e. Rscript my_code.R
The code is straightforward :print("Hello"), and doesn't send in error when ran in Rstudio
To make Rscript work from Windows shell in Windows 10:
-Right click on lower right part screen (windows legend) to open the menu
-Click on System
-Click on Associate Parameters / System information (right part of screen)
-Click on System advanced parameters
-Click on Advanced / Environmental variables
-In the lower window (system variables) click on "Path" and edit
-Add the location of Rscript.exe (i.e. C:\Program Files\R\R-3.4.4\bin)
To test whether it works:
-Right click on lower right part screen (windows legend) to open the menu
-Windows PowerShell
-Type Rscript
-Text should come out

Creating a desktop icon for Shiny App

I have a shiny app that opens in the browser when I provide the following code in the base R prompt:
shiny::runApp("C:/Myapp")
I use windows 7. I am trying to create a desktop icon to avoid my client typing the above code every time he wants to use the app. I have created a desktop icon and the set the path in "Target" as follows:
"C:\Program Files\R\R-3.2.2\bin\R.exe" -e "shiny::runApp("C:\Myapp")
and in the "start in" box I have included
"C:\Myapp"
The app is not opening. I have tried changing the \ to / in C:/Myapp - doesn't work. However, when I try the following:
"C:\Program Files\R\R-3.2.2\bin\R.exe" -e "shiny::runApp()
that is, without referring to my app folder, rhe R program runs, loads the code shiny::runApp() and prints the message
Listening on http://127.0.0.1:4354
Can someone help on how to resolve this? I have tried various combinations of the above.
First, if your app folder is "C:\Documents\myApp", then your working directory should be "C:\Documents" (to insert in "start in" box).
Second, use ' ' for your inner quotes:
"C:\Program Files\R\R-3.2.2\bin\R.exe" -e "shiny::runApp('C:/Myapp')"
Third, consider launching your browser with your runApp command. Otherwise there might be nothing to see. (shiny::runApp('C:/Myapp', launch.browser = TRUE))
The following code saved as a '.bat' file worked for me on Windows 10 as suggested by RBloggers
start "" "C:\Program Files\R\R-4.0.3\bin\Rscript.exe" C:\RShiny\MyShinyApp\app.R /k
start "MyShinyApp" "http://127.0.0.1:4354/"

Resources