I have a fullscreen OpenGL application, written in Scala. It is supposed to being launched as .cmd file that sets up classpath (some .class files, some of them are third-party libraries and optionally in .jars) and runs JVM with the right parameters. I'm wondering, is there an easy way to use this .cmd file as Windows screensaver? (without usual screensaver preview and settings dialog, they are not needed there) I guess I need to register the application somewhere? Is there any restriction on what file type it must be?
You can install a screensaver by doing as #Kevin suggested and right click the file and install (provided that this is a .scr file). Or you can copy the file straight to C:\Windows or sometimes C:\Windows\system32.
However, unless the file is a valid screensaver then it won't show up in the list of screensavers when you choose which one you want, so I think you are out of luck.
Unless you created your own screensaver, and then you might be able to launch the file from one of the events it has.
Related
I have a keyboard with 6 keys I can assign pretty much anything to, including opening apps.
I want to be able to open Spotify with one of these keys, but I have to have to link a .exe to to the key - no other file type will work.
I have Spotify downloaded from the Windows Store, so it's stuck under the WindowsApp folder in Program Files, which means I can't access it directly. Even if I create a shortcut and put it on the desktop, it's not an .exe, it a .lnk.
I'm wondering if there's a way to create a .exe file that will run the Spotify shortcut that I have on my desktop, or any app at all.
I know it sounds redundant - creating a .exe to run a .exe - but I can't access the WindowsApp folder to directly link it to my keyboard. I know a batch file would work, but I can't link a .bat to my keyboard, only .exe.
I don't have experience creating executables, so I don't even know where to start and I haven't been able to find anything online.
If you wish to try this yourself, you will need to:
install a compiler
write the code
use the compiler to create an executable
While this might sound complicated for somebody without experience, in this case is not that hard.
Here is how you can do it using the very simple PureBasic compiler:
download and install the PureBasic compiler from this website
https://www.purebasic.com/download.php
(the demo version is fine, it will do the job)
choose [PureBasic-Demo.zip (x64 - 64 bit)]
launch the PureBasic IDE and write this code:
in this example I'm making an executable which will launch Sublime Text, so change the path to your Spotify executable
```
; // make this a console program
OpenConsole()
; // specify path to another executable
pathToExecutable$ = "C:\Program Files\Sublime Text 3\sublime_text.exe"
; // use RunProgram to launch another executable
x = RunProgram(pathToExecutable$)
```
after you enter the code, click on File menu at the top, then click on Save As..., you will be prompted for a name for your source code file.
select a location, for example your Desktop then, enter a name for the file, for example proxy. (this will create a proxy.pb file)
last step, create the proxy.exe executable
click on Compiler menu, then click on Create Executable...
select location (again I recommend your Desktop), then enter a name for the executable, again for example proxy and then click on Save (this will create proxy.exe on your Desktop)
You can move your new created executable anywhere, it's portable.
Good luck!
This is Stack Overflow where you can do it yourself so here is how.
Download a BAT to EXE convertor from here or here.
Make a batch file to start the program of your choice. (Code would look like the following)
#start "" "C:\users\JimithyJones\Desktop\Spotify.exe" && exit
Convert it to an EXE with one of the previous programs. WARNING! Sometimes they are detected as malicious files because batch files have the capability to do harm to your computor.
Assign the new EXE to your hotkeys.
Where is in the registry the path executed when I run the "notepad" command in windows "Start->run command" interface? I want to change it for notepad++ (it is required so, although could look not really good)
If you are like me you use windows run command all the time. I hate using the mouse to point and click a shortcut on the start menu. WIN-R are probably the two most over used keys on my keyboard. After thinking about if awhile I hunted down how the run command works. It turns out that it makes a call to ShellExecute, which I guess is not too surprising. The next thing I wanted to find out was exactly how the commands are resolved. The following is an ordered list of how they are resolved ([1]):
The current working directory
The Windows directory (no subdirectories are searched)
The Windows\System32 directory
Directories listed in the PATH environment variable
The App Paths registry key
Naturally the next thing I wanted to do was customize existing commands or add new commands so I do not have to type as much (standard lazy approach). After examining my options which were to put the executable in one of those paths (since it only locates executables and not shortcuts), modify the path environment variable or add a key to App Paths. The App Paths option seems to be the easiest and most flexible to me. Here is a layout of what you need to do to add an App Paths entry ([1]):
HKEY_LOCAL_MACHINE-->
SOFTWARE-->
Microsoft-->
Windows-->
CurrentVersion==>
App Paths-->
file.exe-->
(Default) = The fully-qualified path and file name
Path = A semicolon-separated list of directories
DropTarget = {CLSID}
Disclaimer: Modifying the registry can cause serious problems that may require you to reinstall your operating system. I cannot guarantee that problems resulting from modifications to the registry can be solved. Use the information provided at your own risk.
The minimum needed to add a new entry is to add the key file.exe where file is the string you want to type into the run command and to add the Default entry which is the fully-qualified path to the file you want to execute. Note that even it the file you are going to reference isn't an exe file you still need to put the .exe on the key. Here is a sample registry file that I created to add a shorter keyword for Internet Explorer:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App
Paths\ie.exe] #="C:\Program Files\Internet Explorer\iexplore.exe"
After entering that entry into the registry I can simply type “ie” at
the run command to open internet explorer.
Here is a list of some common commands I use at the run command:
cmd – Command prompt winword – Microsoft Word excel – Microsoft Excel
outlook – Microsoft Outlook iexplore – Internet Explorer firefox –
Mozilla Firefox notepad – Notepad compmgmt.msc – Computer Management
Console control appwiz.cpl – Add/Remove programs dialog mstsc –
Microsoft Terminal Service Client regedit – Registry Editor
…
If there is some program that I find myself using all the time I figure out what the run command is for it and if there is not a short easy one I add one to my App Paths as described above. Does anyone else have some other common run commands they use?
In matlab, I used a windows standalone application. There is a line in this application that writes a file in C:\...\...\. When I run the output exe file produced from this windows standalone application, the exe doesn't write in C:\...\...\ neither tells me that there is a security issues in that partition. All the execution does is nothing. But, when I right-click and run the exe as administrator, it runs correctly.
I want to do it without right-click and run as administrator. Are there is a command in matlab that can do that?
If you create a shortcut to your application, you can go to the Properties of the shortcut, click on Advanced in the Shortcut tab, and select "Run as administrator". That way, whenever you start the application from the shortcut it will be run as an administrator.
(Disclaimer: applications really shouldn't "foul their own nest" by writing into Program Files. This is bad design.)
Starting from Vista, unprivileged processes are not allowed to write to protected folders such as Program Files, because Program Files is designed to store code and not data. However, since this limitation has not been enforced in XP, MS has provided a backward-compatibility hack in the form of Virtual Store. Now, when a program tries to write to protected folder, its output is being redirected into a dedicated folder. This way, the program still "thinks" it writes to its usual location, while in fact it writes to an unprotected location. However, when you later check the Program Files location, you might not see the file - because it's not really there.
You can find more details here: User Account Control Data Redirection.
If you are administrator, add full control permission for your username to the destination folder. You do that by right clicking on the folder, going to properties and then security tab. Then edit and add you username with Full Control rights. Then you don;t have to run the the program as an administrator.
There is no way you can elevate a process once it is started, so Matlab cannot possibly have a command for that. Just running Matlab elevated.
Can you execute a VBS file as a screen saver? I have managed to rename cmd.exe to *.scr and this works, but I need to be able to run a VBS file as the screen saver if this is possible.
No, this is not possible.
In Windows, screen savers (*.scr files) are a special type of executable (.exe) file. That is why renaming a program like cmd.exe to cmd.scr causes it to sort of "work" as a screen saver. In particular, screen savers respond to certain command line switches (or parameters), which is how the OS gets them to do things like show the configuration dialog or display a preview.
But you can't compile VBScript files into executables, so there's no way to make this trick work for them.
You might be able to migrate the VBScript code to a VB 6 application, which you could then compile into an executable and run as a screen saver, but I can't imagine that this would be worth the development time. If you're interested in such a thing (and can get your hands on an old copy of VB 6!), you can probably find several how-to guides online, like this one.
But I'm honestly having a hard time imagining why one would ever want to run a VBScript script as a screen saver, or what it would display on the screen. You don't have very much control over what gets displayed on the screen, and you can't call down to native Windows API functions from VBScript. You'd end up relying upon some external library, so you might as well just use that library in the first place.
You can simply write a batch file that starts your vb script:
CD "%SystemRoot%\System32"
Start /Wait Wscript.exe "c:\program files\myscript.vbs"
Exit
Then compile the batch to exe, rename the exe to scr.
I'm creating a small ruby script to resize images and save them in a specified directory. I'd like the application to be as transparent as possible.
Is it possible to allow file dropping onto my Ruby script in all platforms? For instance, the user drags a file onto the script, which then takes the file path as an argument and resizes the image accordingly -- No GUI, no console, etc..
The behavior of drag & drop is dependent on the OS (and in case of Linux of the Window Manager), so no.
In Windows, you get the behavior you want for free. Just put a .rb file on the Desktop, and the files dragged onto it will be arguments to your script.
Another easy way for integrating with Windows is to write to registry entry HKLM\Software\Classes*.jpg\myhandler\command with the command you want to appear in the context menu of Windows Explorer (right click on a jpg file will popup a menu which will have your script in the menu).
I don't use drag & drop at all in Linux, so I wouldn't know how to do that there. I would expect it to have more security issues (permissions must be right, ...) but you could get there by creating a .desktop file, see http://standards.freedesktop.org/desktop-entry-spec/latest/ for the complete standard, or read some examples from ~/Desktop/*.desktop .
Platform dependend, so here for windowsusers and reference only.
Save the following to a .reg file and load it by doublecliking it, tested on Windows Vista and 7
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\rbfile\ShellEx\DropHandler]
#="{86C86720-42A0-1069-A2E8-08002B30309D}"
[HKEY_CLASSES_ROOT\rbwfile\ShellEx\DropHandler]
#="{86C86720-42A0-1069-A2E8-08002B30309D}"
[HKEY_CLASSES_ROOT\RubyFile\ShellEx\DropHandler]
#="{86C86720-42A0-1069-A2E8-08002B30309D}"
[HKEY_CLASSES_ROOT\RubyWFile\ShellEx\DropHandler]
#="{86C86720-42A0-1069-A2E8-08002B30309D}"
Such behavior would surely be platform specific, as drag-and-drop is implemented by the OS in this case, not by ruby.
So answering your question: no, it is not possible.
You can use platypus on os x to create a wrapper around your script.
http://sveinbjorn.org/platypus
regards
Claus