1.

Solve : Semi-Adv questions. HELP!!?

Answer»

How do i get the batch file to support the drag and drop feature? Like, i want to be able to drag a file on to the batch and then it executes something like this:
program.exe droppedfile
also, part of the first question, if a users double clicks on the batch instead of dragging the file over it, is it possible to make it do the "choice" command?


question2: Right now im using this:
FOR /F "tokens=1*" %%G IN ('dir /b *.smc') DO Set smc=%%G
If [%smc%]==[] goto filenotfound

If it finds more than one file, how can i make it so the user can choose which one to use??Drag and drop?

Do you mean that you want to import content data from say a data file and use it within your batch?Example of drag and drop
Code: [Select]echo off
set /p ren=Select new name:
ren %1 %ren%%~x1
echo. Renamed to %ren%%~x1
pause >nulsave it as dnd.bat on a desktop
now you can rename files using drag and dropI mean when I drag a file on to the batch, I want it to be set as %smc% so I can use it like
program.exe %smc%
(where %smc% is the infile) Quote from: kaiyoken on August 07, 2008, 01:31:23 PM

I mean when I drag a file on to the batch, I want it to be set as %smc% so I can use it like
program.exe %smc%
(where %smc% is the infile)

do you mean grab the file with you mouse and drop it onto the batch program. then no you CANT do that. Batch files are not capable of detecting mouse clicks or movement. Quote from: macdad- on August 07, 2008, 01:41:58 PM
do you mean grab the file with you mouse and drop it onto the batch program. then no you cant do that. Batch files are not capable of detecting mouse clicks or movement.

Macdad, do you ever check before you write? I really WISH you WOULD start doing that. It's not hard. The rest of us do it. If you don't, it's called "running your mouth", I think, in American English. It is not helpful on a forum like this.

Create a batch file with this code in it

Code: [Select]echo off
echo %1
pause
1. Save it to a folder.
2. In Windows Explorer, drop a file or a folder onto it.
3. Tell us what happens.
oh cool! it shows the file
thanks!! Quote from: kaiyoken on August 07, 2008, 02:29:51 PM
oh cool! it shows the file
thanks!!

There you go...

Dias 1 Macdad 0



ok, now I have a problem. when I drag the file over it works and all, but the directory is reset. meaning is no longer the current folder it set to "c:\documents and setting\user" instead
PLEASE show your code
Dias when i read this

Quote
How do i get the batch file to support the drag and drop feature? Like, i want to be able to drag a file on to the batch and then it executes something like this:
program.exe droppedfile
also, part of the first question, if a users double clicks on the batch instead of dragging the file over it, is it possible to make it do the "choice" command?

i thought he ment grabbing the file from a folder and drop it on the batch window while it was running.

so sorry for being a chatter box Quote from: macdad- on August 07, 2008, 04:17:16 PM
i thought he ment grabbing the file from a folder and drop it on the batch window while it was running.

Well, you're right there, you can't do that.
here is my old one that works:
echo off
FOR /F "tokens=1*" %%G IN ('dir /b *.smc') DO Set smc=%%G
If [%smc%]==[] goto filenotfound
bin\movlm.exe %smc%
bin\cutdrv.exe %smc%
bin\cutsnd.exe %smc%
pause
goto end

and here is the one im trying to make work >.>
set %1
If [%1]==[] goto autofind
goto process1

---other part of code removed---

:process1
cls
cd
echo ===== cutting =====
bin\makesnd.exe %1
bin\importsnd.exe %1
echo ===== ------- =====
ping localhost -n 2 >Nul
pause
goto complete
the line

set %1

does nothing. What are you trying to do?

You cannot "set" %1. It ALREADY has a value.
hey i've posted first the example of dnd   


Code: [Select]set var=%1
If [%var%]==[] goto autofind
goto process1


Discussion

No Comment Found