473,763 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Python scripts in Windows Explorer

I'd like to be able to drag a file onto a Python script in Windows
Explorer, or send that file to the script via the Send To context-menu
option, so I can then process that file via sys.argc.

Unfortunately, I can't drag items onto the Python script, because
Windows doesn't recognise that the script is executable (unless I
double-click it, upon which it runs as usual, without the command line
parameter of course) and won't set it as a drop target. And it won't
even appear in the Send To menu after the usual steps are taken to get
it there.

I then tried to wrap it in a batch file, but encounter a problem, where
that batch file is able to execute the Python file if I double-click
the batch file, but if I drag a file onto it it says it can no longer
find the Python script.

Are there any simple and workable solutions for this sort of thing?

--
Ben Sizer

Oct 20 '06 #1
8 4070

Ben Sizer wrote:
I'd like to be able to drag a file onto a Python script in Windows
Explorer, or send that file to the script via the Send To context-menu
option, so I can then process that file via sys.argc.

Unfortunately, I can't drag items onto the Python script, because
Windows doesn't recognise that the script is executable (unless I
double-click it, upon which it runs as usual, without the command line
parameter of course) and won't set it as a drop target. And it won't
even appear in the Send To menu after the usual steps are taken to get
it there.

I then tried to wrap it in a batch file, but encounter a problem, where
that batch file is able to execute the Python file if I double-click
the batch file, but if I drag a file onto it it says it can no longer
find the Python script.

Are there any simple and workable solutions for this sort of thing?

--
Ben Sizer
I didn't even know you could do that at all, but my suggestiong would
be compile the python script into an executable and try that.
If you get it working, update here as I am interested in your solution.

Oct 20 '06 #2
MC
Hi!

I use this little batch:

@echo off
cd \dev\python
viewarg.py %*

I copy/paste the batch-file on the desktop, like icon.
Then, from Win-explorer, drag_and_drop & copy_and_paste run OK.

--
@-salutations

Michel Claveau
Oct 20 '06 #3
Ben Sizer schrieb:
I'd like to be able to drag a file onto a Python script in Windows
Explorer, or send that file to the script via the Send To context-menu
option, so I can then process that file via sys.argc.

Unfortunately, I can't drag items onto the Python script, because
Windows doesn't recognise that the script is executable (unless I
double-click it, upon which it runs as usual, without the command line
parameter of course) and won't set it as a drop target. And it won't
even appear in the Send To menu after the usual steps are taken to get
it there.

I then tried to wrap it in a batch file, but encounter a problem, where
that batch file is able to execute the Python file if I double-click
the batch file, but if I drag a file onto it it says it can no longer
find the Python script.

Are there any simple and workable solutions for this sort of thing?
I think you can create a shortcut to the Python script, and then drag files on it.

Thomas

Oct 20 '06 #4
At Friday 20/10/2006 12:20, Ben Sizer wrote:
>I'd like to be able to drag a file onto a Python script in Windows
Explorer, or send that file to the script via the Send To context-menu
option, so I can then process that file via sys.argc.

Unfortunatel y, I can't drag items onto the Python script, because
Windows doesn't recognise that the script is executable (unless I
double-click it, upon which it runs as usual, without the command line
parameter of course)
Create a shortcut and drop the file over it.
>and won't set it as a drop target. And it won't
even appear in the Send To menu after the usual steps are taken to get
it there.
Same here: put a shortcut to the script on your SendTo folder
(wherever it resides)
--
Gabriel Genellina
Softlab SRL

_______________ _______________ _______________ _____
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
Oct 20 '06 #5
MC wrote:
I use this little batch:

@echo off
cd \dev\python
viewarg.py %*
I try that (with viewarg.py renamed, obviously), and get this error:

"'defines.p y' is not recognized as an internal or external command,
operable program or batch file."

defines.py is in the same directory as the batch file, but cannot be
executed like this. Double-clicking on it works, as expected.

--
Ben Sizer

Oct 23 '06 #6
Gabriel Genellina wrote:
At Friday 20/10/2006 12:20, Ben Sizer wrote:
I'd like to be able to drag a file onto a Python script in Windows
Explorer, or send that file to the script via the Send To context-menu
option, so I can then process that file via sys.argc.

Unfortunately, I can't drag items onto the Python script, because
Windows doesn't recognise that the script is executable (unless I
double-click it, upon which it runs as usual, without the command line
parameter of course)

Create a shortcut and drop the file over it.
Doesn't work; the mouse cursor changes to the "not permitted" sign and
when you release the mouse, nothing happens.
and won't set it as a drop target. And it won't
even appear in the Send To menu after the usual steps are taken to get
it there.

Same here: put a shortcut to the script on your SendTo folder
(wherever it resides)
That is what I meant by 'the usual steps'. :) It doesn't work.

--
Ben Sizer

Oct 23 '06 #7
Ant
Ben Sizer wrote:
Create a shortcut and drop the file over it.
....
That is what I meant by 'the usual steps'. :) It doesn't work.
Alter the target of the shortcut to something like:

C:\Python25\pyt hon.exe C:\0\sort_test. py

and drag and drop should work, with the filename of the dragged file
being sent as a script argument.

Oct 23 '06 #8
At Monday 23/10/2006 07:53, Ben Sizer wrote:
>I'd like to be able to drag a file onto a Python script in Windows
>Explorer, or send that file to the script via the Send To context-menu
>option, so I can then process that file via sys.argc.
>
>Unfortunatel y, I can't drag items onto the Python script, because
>Windows doesn't recognise that the script is executable (unless I
>double-click it, upon which it runs as usual, without the command line
>parameter of course)
Create a shortcut and drop the file over it.

Doesn't work; the mouse cursor changes to the "not permitted" sign and
when you release the mouse, nothing happens.
@WorksForMe (on XPSP2 with local administrator rights)
(but I've used such shortcuts even on Windows 98)
Perhaps it's some configuration, or you don't have enough permission
to do that.
>and won't set it as a drop target. And it won't
>even appear in the Send To menu after the usual steps are taken to get
>it there.
Same here: put a shortcut to the script on your SendTo folder
(wherever it resides)

That is what I meant by 'the usual steps'. :) It doesn't work.
Same as above! I think you should ask on a Windows newsgroup.
--
Gabriel Genellina
Softlab SRL

_______________ _______________ _______________ _____
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
Oct 23 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2427
by: Sam | last post by:
Only 2 weeks messing around with it ( thanks to programs like SYNCHRONEX and BITORRENT ), and already trying to create windows ( the paths are just too long for me to want to type them ). After much trial and error I finaly got the following code to open the 'get dir' dialog , but I am getting another blank window titled 'tk' and "NOT RESPONDING" When I kill it (end task), I get reiniit/restart (CTRL+F6) in my shell window What am I doing...
1
1896
by: Chris Cottee | last post by:
Hi, I am trying to extend PAMIE (sourceforge project to functionally test web sites using com and python) and I wondered if anyone had done this sort of thing before and had any pointers. My main reason for doing this is that the website I want to test is so full of frames and javascript that it seems painful to try to fix httpunit to be able to cope with it. The difficulties I am having are in getting IE to behave repeatably, handling...
35
3102
by: Michael Kearns | last post by:
I've been using python to write a simple 'launcher' for one of our Java applications for quite a while now. I recently updated it to use python 2.4, and all seemed well. Today, one of my colleagues noted that on her machine the launcher would complain it was missing a DLL - msvcr71.dll However, there's a very grey area concerning the redistribution of said DLL. If you've been keeping up with the dev list, and some other web
23
2565
by: anton.vredegoor | last post by:
Here's my situation: I'm typing this in a public library on a computer with OS windows 2000 server. I can run Internet explorer, word, excel and powerpoint, that's it. Maybe java, but it seems to be flaky. I want to run python scripts from this computer. At home I have a multi-computer network (from better times) but no internet access anymore, I could use this to try out solutions. I also have access to a friends computer which has...
12
2360
by: rurpy | last post by:
Is there an effcient way (more so than cgi) of using Python with Microsoft IIS? Something equivalent to Perl-ISAPI?
1
4034
by: DropIn | last post by:
Sheesh! I was doing research on using batch files as drop targets when I came across a python discussion thread on this site with the same topic. I thought I would share what I had learned (the hard way), but I could find no way to reply to that thread (even after registering!). Anyway, wrapping the python script in a batch file is a good idea, but I believe the problem the python programmer was encountering was how Windows automatically...
34
3965
by: Ben Sizer | last post by:
I've installed several different versions of Python across several different versions of MS Windows, and not a single time was the Python directory or the Scripts subdirectory added to the PATH environment variable. Every time, I've had to go through and add this by hand, to have something resembling a usable Python installation. No such problems on Linux, whether it be Mandrake/Mandriva, Fedora Core, or Kubuntu. So why is the Windows...
18
2035
by: W. Watson | last post by:
What do I download to use Python with MX XP Pro on an ASUS 4 year old motherboard? I would guess a good book source for starters would be the O'Reilly book. Wayne T. Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet ""I do not fear death. I had been dead for billions and billions of years before I was born, and had
9
2449
by: korean_dave | last post by:
From command Prompt, i type in a script, "tryme.py". This, instead, brings up PythonWin editor and Interactive Window. Path variable is "C:\Python24". (I need Python 2.4 installed, not 2.5) How do I make it so that the script runs?
0
9563
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9998
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9938
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9822
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6642
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.