Jump to content

Recommended Posts

Posted

Hi I have been trying this for ages.

My USB drive has autorun.inf on it which contains:

CODE
[autorun]

label=Aaron's Memory Stick.

shell\runner = Open etc.

shell\runner\command = run.exe

shell=runner

which means that when I double click on the drive in my computer, it starts run.exe instead of opening the drive to view the files.

What I want is for it to do BOTH.

Right now the first line of my script run.exe contains

Send("{ALT}fo")
; when you double-click on the drive in My Computer, opens the drive by going File > Open.

and this gets around the problem, but is very messy and I don't like it. Is there another way of performing the same action? For instance, how do i find out what command windows executes when I click "File > Open"?

One major problem I have with this is that if you double click on run.exe directly it loops.

Eagles may soar, but weasels don't get sucked into jet engines.

Posted (edited)

ShellExecute?

Something like:

ShellExecute("explorer.exe")

EDIT: After reading your post again I get the feeling I might have misunderstood what you want?

Edited by Uten
Posted (edited)

yes i had tried

ShellExecute("explorer.exe","\")
but it opens the contents of the drive in a new window - fine, but a little annoying.

I wanted a way of making the drive open in the same explorer window.

Edited by Onepissedpenguin

Eagles may soar, but weasels don't get sucked into jet engines.

Posted (edited)

If you want it to open in the same window you will have to identify the window.. I dont know if its a script only for you, if so use the

;Change "Denne Computer" to whatever its named at your place (My Computer)
$MyComputer = "Denne computer"
$Dir = StringLeft(@AutoItExe, 2)
$handle = WinGetHandle($MyComputer)
If @error Then
    ShellExecute("explorer.exe",$Dir)
Else
    ControlSetText($handle, "", "Edit1", $Dir)
    ControlFocus($handle, "", "Edit1")
    ControlSend($handle, "", "Edit1", "{ENTER}")
EndIf

You might be able to do it via com objects, though i never tried

Edited by Shevilie

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...