Win95(9x/NT?) file extension / association tricks
Isidor
rodisi01 at my-deja.com
Wed Jul 21 09:48:42 EDT 1999
More information about the Python-list mailing list
Wed Jul 21 09:48:42 EDT 1999
- Previous message (by thread): Tool for Newbz (& beyond?): ModuleWriter
- Next message (by thread): where is gfplus?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello Pythologists- Here are some things I've done on my win95 boxito. They may or may not work for win98 and NT, I have no idea. When I right click on a .py file, I now have the following options: 1) run (same as installed "open", but I edited its "name" in the registry) 2) open in IDLE 3) open in notepad 4) run w dos 5) run w.o console One of these may be of particular interest to you: "Run w DOS". I made this one because I got really frustrated with buggy modules running, printing out their error messages in the console, and then the console disappearing moments later. I tried fiddling with pifs and such, but had no luck. This file extension seems to solve that problem. It runs a dos shell first, then python, then your selected module. The dos shell remains open after the module finishes running so you can see the error messages. To make any of these additional actions, open a directory window, and View --> Options --> File Types. Scroll down the file types until you get to Python File. Double click on it. In the "Edit File Type" dialog, click the "new" button. In the text box titled: "Action", type the name of the action you want, e.g., "open in IDLE", w/o the quotation marks. Put an ampersand (&) in front of the letter that you want underlined in the popup menu. Be sort of careful here because you won't be able to edit this field in the future without going into the registry. (Can you say "annoying"?) Here is a list of action and "application used to perform action" pairs: 1) Open w &IDLE "C:\your python directory name here\pythonw.exe" "C:\your python directory name here\Tools\idle\idle.pyw" "%1" %* on my machine: "C:\Program Files\Python152\pythonw.exe" "C:\Program Files\Python152\Tools\idle\idle.pyw" "%1" %* This one opens an IDLE python shell and opens the module you selected as a separate window. NOTE: if IDLE is already open, this action will start from scratch and open yet *another* python shell etc. If anyone knows how to avoid this, I would be very happy to learn about it! (See below for more details on things I've tried.) 2) Open w &Notepad Notepad.exe 3) Run w &DOS C:\WINDOWS\command.com /k python.exe "%1" I like this one a lot for the reasons explained above. NOTE: you need to have your python directory on your system's "path" in order for this one to work. Putting or not putting python on that path has been a big subject of debate on this list. I'm not going to get into it here though. If you don't want to put python on your path, try this instead: C:\WINDOWS\command.com /k "C:\your python directory name here\python.exe" "%1" It works on my machine as well. 4) Run w/o &console "C:\your python directory name here\pythonw.exe" "%1" %* NOTE: some of your files may not be stored in the same places as mine. I have no idea whether command.com still exists in win98 or where it exists if it does, and where it exists on NT. Most of this kind of trickery I figured out for myself, but I found the following site somewhat helpful as well: ( http://cpcug.org/user/clemenzi/technical/ go to the pages about win explorer and win registry...good stuff!) It has info for different win versions, too. IDLE hack: Ok, you idle, ahem, I mean, IDLE hackers, how do I do the following?: a pop-up menu action item that (a) checks whether IDLE is running. (b1) If it is, open the file in the already running session (as a separate window, of course). (b2) If it isn't, do what my other IDLE extension does: open an IDLE python shell and the selected module. What I tried: After bungling my way through the various modules of IDLE, following calls from one place to another (for more details on that adventure, see a forthcoming post to this list), I discovered: FileList.py. The test function for that module looked like it might do the trick. "What an easy solution!" I thought. I made the following extension action thing-a-ma-bob: "C:\Program Files\Python152\pythonw.exe" "C:\Program Files\Python152\Tools\idle\FileList.py" "%1" When I ran it, up popped my module in an IDLE window without an accompanying IDLE python shell. Yay. But....wait...it did this *whether or not* IDLE was already open. No good. It *looked* like I solved the problem, but I hadn't. The lone module window was running in its own session of IDLE. If IDLE is already open, none of the other existing IDLE windows appear in the "window list" of the new module window. (Did that sentence make sense?) (Does IDLE do DDE? Is that a *really* dumb question?) Why do I want to do this? you ask. It probably seems pretty stupid to you. Well, I like having a folder for each python project. I don't want to have to open the registry to add a new path to the python path every time I add a new project.) Also, I tend to have a lot of directory windows open. If I am looking at a directory with a module in it that I want to run, I don't want to have to go to the IDLE window, go to "open file", and browse all over kingdom come just to get back to the directory I was just looking at. ;) It would also be fun to do drag and drop...oooh...(not very useful, but intriguing) Anybody got any ideas about that? Ok, I hope this is of some use to someone. Take care- Isidor
- Previous message (by thread): Tool for Newbz (& beyond?): ModuleWriter
- Next message (by thread): where is gfplus?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list