I want to open a file with my program, but I don't know how.
Here's what I mean:
I searched on internet and I found nothing (only the "Open with" method and that's not what I want).
Is it possible to make something like that?
This is done through the "Windows Registry":
Create a new .reg file with the following content:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Python Script\command]
#="py -3 my_script.py %1"
Replace my_script.py with the full path to your python script.
%1 will be replaced with the path of the file you have clicked.
Then run the script and it should add your program to the context menu.
Related
I use Pyinstaller in pop os for a python script but it creates a x-sharedlib file that I can only open through terminal. I tried to rename it to exe and run it but nothing happens. How I can make it open by double click? Thank you!
Found the solution. I renamed it to .sh changed nautilus preferences to run executable text files and runs normally now.
I just recently started using Komodo Edit 10 and used an existing Django project which uses Python 3.6.x. I created a Komodo project (.komodoproject file) for it and updated the Projects > Project Preferences > Languages > Python 3 > Use this interpreter to point to my conda virtual environment. I've also added the site-packages directory to the "Additional Python 3 Import Directories" and so I was expecting code completion to work.
Now, when I open a .py file, like models.py, and start typing from dj, no code completion is done (I was expecting to get django drop-down). Then I noticed that in the open file, there's a drop-down to change the file type of the file (upper-right corner of editor). I changed it to "Python 3" and now completion works (yey!). So then I proceed to open the views.py file expecting code completion to work but it wouldn't, and I had to set the file type to "Python 3" before it worked.
Now, my question is if there's a way to batch change the file type for all .py files inside the project from "Python 2" to "Python 3"? Or do I have to tediously change the file type for each .py file manually?
You just need to update the file association under Preferences > File Associations.
I am installing 7-ZIP using NSIS and then looking in the registry to see where it has been installed. Having detected the install location I am taking the path and creating a system variable named 7-ZIP using the NSIS command below.
${EnvVarUpdate} $0 "7-ZIP" "A" "HKLM" "<Install Path>"
I then append the 7-ZIP var to the PATH var.
After the install has finished I can see the new System var in the System Variables list.
The new 7-ZIP variable has also been amended to the PATH variable as the image below shows.
Now the issue I have is that when I start a cmd window and type 7z I would expext it to run the 7z.exe located in the C:\Program Files\7-Zip directory, but it does not and complains it cannot find it. If I then close the CMD window and edit the 7-ZIP variable, but don't actually chang anything. The same command then works when i try again with a new CMD window.
I just wonder whether anyone else has experienced this issue and if they found a work around?
I have recently shifted from Linux to Mac OS. I have installed vmd in this new machine. The vmd just load without any molecule when I type the following:
vmd protein.gro
This *.gro file contains a protein molecule. I want to open this file like in Linux:
*applicationname filename*
But it doensnt work. Launching the molecule via vmd just simply doesnt work. I have tried to google this problem but I couldnt find the right answer. Is there anybody who had the same problem and was able to tackle it ?
Probably a little late but anyway. You only need to add a line to your bash_profile file.
The bash_profile file is located in:
/Users/user-name/.bash_profile
(remember to change user-name to your real username and note the dot at the beginning of the file's name)
inside the .bash_profile (or .profile) file add:
alias vmd='csh /Applications/VMD\ 1.9.3.app/Contents/MacOS/startup.command.csh'
(for a different version of VMD you will need to change the number (1.9.3) in the path to your actual VMD version). Save and close.
After this just source your .bash_profile (or .profile) file again so the changes are incorporated to your shell or just open a new terminal window.
Now you can type:
vmd my-gro-file.gro
just like in Linux.
Is vmd a native Mac app? If so, you should be able to use open -a /path/to/vmd.app filename.
I think it depends on the application itself, but maybe try this. First, find where the application is installed using the Terminal like this:
which vmd
and you should get the path to it. Then use the path like this:
open -a /path/to/vmd --args someMolecule.gro
I am trying to run a .run file in cygwin, but I always seem to get this error:
Unable to start '~.run': There is no application associated with the given file name extension.
I needed to be a superuser, so I tried using the command: cygstart --action=runas "$#"
I read somewhere that cygstart is for invoking registered Windows handler, so this may be the problem, but I am unsure. Is there any way that I can run my .run file as a superuser using cygwin?
Well, as has been said, no application is associated with .run files on your
system. So you can do that one of two ways
Call the file with the program, example
cygstart notepad.exe ~.run
Tell the registry what to do with unknown extensions
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Unknown]
#=""
[HKEY_CLASSES_ROOT\Unknown\shell\Open\command]
#="notepad.exe \"%1\""
This question is not related to Cygwin but rather to Windows. cygstart works the same as Windows' start. That means, if you use [cyg]start file.extension it works very similarly as if you double-click on that file in Windows Explorer.
Therefore if you configure Windows to do what you need when you double-click on your *.run file, cygstart will work fine too.
I think that easier is to use appropriate extension which Windows already knows. It depends on what you have inside your *.run file. If it's executable, use exe extension, if it's batch script, use cmd or bat, if it's JavaScript, use js etc.
If you use Linux or some derivation, you need to execute the .run file with an absolute path, even if you have already navigated to the appropriate directory containing the file. See here:
http://the-chronicon.blogspot.com/2011/08/execute-run-file-in-current-folder-from.html