Jump to content

set a button to open dir and overwrite default autorun, forcing the running of my program?


Recommended Posts

title says it all

how do i set a button to open a directory?

and how do i stop the autorun menu from showing up without disabling autorun?

i made a GUI which makes it easier for me to access the programs that i use the most on my USB device

i want it to autorun but i dont want the default autorun menu to show up i only want my autorun menu to show up

heres the code:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Autorun Menu", 233, 243, 192, 124)
$Icon1 = GUICtrlCreateIcon("PasswordGenerator.exe", -1, 8, 8, 33, 33, BitOR($SS_NOTIFY, $WS_GROUP))
$Button1 = GUICtrlCreateButton("Password Generator", 48, 8, 177, 33, $WS_GROUP)
$Icon2 = GUICtrlCreateIcon("PasswordGenerator.exe", -1, 8, 56, 33, 33, BitOR($SS_NOTIFY, $WS_GROUP))
$Button2 = GUICtrlCreateButton("Password Storer and finder", 48, 56, 177, 33, $WS_GROUP)
$Icon3 = GUICtrlCreateIcon("CarryitEasy.exe", -1, 8, 104, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP))
$Button3 = GUICtrlCreateButton("Synchronize your data", 48, 104, 177, 33, $WS_GROUP)
$Button4 = GUICtrlCreateButton("Sort your files", 48, 152, 177, 33, $WS_GROUP)
$Icon4 = GUICtrlCreateIcon("File sorter v2.1.exe", -1, 8, 152, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP))
$Icon5 = GUICtrlCreateIcon("File sorter v2.1.exe", -1, 8, 200, 32, 32, BitOR($SS_NOTIFY, $WS_GROUP))
$Button5 = GUICtrlCreateButton("Misc Tools", 48, 200, 177, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            Run("PasswordGenerator.exe")
        Case $Button2
            Run("passwordstorerfinder.exe")
        Case $Button3
            Run("CarryitEasy.exe")
        Case $Button4
            Run("File sorter v2.1.exe")
        Case $Button5
            Run("Utils.exe")
    EndSwitch
WEnd

GUI works perfectly, i just want only that to show up when i plug the usb into my comp

Edited by snowman533

Intermediate AutoIt/Autohotkey User

Link to comment
Share on other sites

Something like this may work, but keep in mind the security of the computer will affect its operation. Basically your USB won't disable the Autorun, windows will.

;Autorun.inf file

[autorun]
icon=_system\Icon.ico
action="Open the MP3 Organizer"
Open="MP3Organizer.exe"
label="My MP3 player"
UseAutoPlay=1
shellexecute="MP3Organizer.exe"

Search the forums though. Other examples are in ample supply.

Cheers,

Brett

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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