Nomadic Posted June 6, 2012 Share Posted June 6, 2012 Wrote quick autorun, can to someone it is required. expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> If Not FileExists("autorun.inf") Then MsgBox(16,"Error!","File autorun.inf not found!") Exit EndIf $count = (UBound(IniReadSection("autorun.inf", "buttons"))-1)/2 If $count > 10 Then MsgBox(16,"Error!","Supports up to 10 buttons!") Exit EndIf If IsFloat($count) Then MsgBox(16,"Error!","Fractional number parameters of buttons!"&@CRLF&"Count = "&$count) Exit EndIf Dim $buttons[11] ; Maximum 10 buttons $space = 60 $Form1 = GUICreate(IniRead("autorun.inf", "config", "Title", "Autorun"), 307, ($space*$count)+20, -1, -1) For $i = 1 To $count $buttons[$i] = GUICtrlCreateButton(IniRead("autorun.inf", "buttons", "Button"&$i,""), 16, ($space*($i-1))+20, 275, 41) Next GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() If $nMsg = $GUI_EVENT_CLOSE Then Exit For $i = 1 To $count If $nMsg = $buttons[$i] Then $path = IniRead("autorun.inf", "buttons", "Path"&$i,"") If FileExists($path) Then Run($path) Else MsgBox(16,"Error!","Path '"&$path&"' not found!",60) EndIf ExitLoop EndIf Next WEnd The maximum is supported to 10 buttons, it will be already ugly more... Settings are stored in standard autorun.inf (additional sections): [autorun] Icon=AutoRun.exe Open=AutoRun.exe UseAutoPlay=1 [config] Title=Autorun Demo [buttons] Button1=Demo #1 Path1=demo1\setup.exe [...] Button10=Demo #10 Path10=demo10\setup.exe JScript 1 Link to comment Share on other sites More sharing options...
JScript Posted June 7, 2012 Share Posted June 7, 2012 I like! AutoIt is all good Regards,João Carlos. http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now