Jump to content

Recommended Posts

Posted (edited)

This allows you to create an unlimited amount of profiles that you can store a list of programs/websites on each profile to quickly launch a slew of programs/websites at the click of a button.

 

YouTube/Github Links

 

https://github.com/Tf2Prophete/Quick-Launch-List

Source

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=Imgs\Icon2.ico
#AutoIt3Wrapper_Compression=0
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=R.S.S.
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;~ #RequireAdmin
;~ #AutoIt3Wrapper_Icon=Imgs\Icon.ico

#include <TrayConstants.au3>
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <Array.au3>


#include "ProfileEditModule.au3"


#include ".\Skins\Axis.au3"
#include "_UskinLibrary.au3"

Opt("TrayMenuMode", 3)
Opt("TrayOnEventMode", 1)
Opt("GUIOnEventMode", 1)

_Uskin_LoadDLL()
_USkin_Init(_Axis(True))

Global $Gui, $CheckName = "", $LoadedProfile = "", $CurrentGui, $NameProgram, $CheckNewWebsite, $GetDir

$SettingsData = IniReadSection(@ScriptDir & "\Data\Settings.ini", "Settings")




$TrayMenuExit = TrayCreateItem("Exit...")
TrayItemSetOnEvent(-1, "_Exit")
$TrayRun = TrayCreateItem("Run Profile...")
TrayItemSetOnEvent(-1, "_RunPrograms")
$TrayMenuCurrentProfile = TrayCreateMenu("Current Profile...")
$TrayMenuSettings = TrayCreateMenu("Settings...")
$TrayMenuSettingsRunAsAdminItem = TrayCreateItem("Run as Admin", $TrayMenuSettings)
TrayItemSetOnEvent(-1, "_RunAsAdminCheck")
$TrayMenuSettingsProfileSelectionItem = TrayCreateItem("Profile Editing / Selection", $TrayMenuSettings)
TrayItemSetOnEvent(-1, "_ProfileGui")
$TrayCurrentProfileItem = TrayCreateItem("None", $TrayMenuCurrentProfile)

If $SettingsData[1][1] = "1" Then
    TrayItemSetState($TrayMenuSettingsRunAsAdminItem, $TRAY_CHECKED)
Else
    TrayItemSetState($TrayMenuSettingsRunAsAdminItem, $TRAY_UNCHECKED)
EndIf

If $SettingsData[2][1] > "" Then
    $CurrentProfile = $SettingsData[2][1]
    TrayItemSetText($TrayCurrentProfileItem, $CurrentProfile)
    $ProfileData = IniReadSection(@ScriptDir & "\Data\Profiles\" & $CurrentProfile & "\" & $CurrentProfile & ".ini", "Programs")
EndIf

Func _RunAsAdminCheck()
    $SettingsData = IniReadSection(@ScriptDir & "\Data\Settings.ini", "Settings")
    If $SettingsData[1][1] = "1" Then
        IniWrite(@ScriptDir & "\Data\Settings.ini", "Settings", "1", "0")
        ShellExecute(@ScriptName)
        Exit
    Else
        IniWrite(@ScriptDir & "\Data\Settings.ini", "Settings", "1", "1")
        ShellExecute(@ScriptName, "", "", "runas")
        Exit
    EndIf
EndFunc   ;==>_RunAsAdminCheck





Func _ProfileGui()

    $CurrentGui = "Profile"

    $Gui = GUICreate("Profile Editor", 600, 300)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseGui")

    GUICtrlCreateLabel("Current Profile", 225, 10, 200, 50)
    GUICtrlSetFont(-1, 15)

    $LoadedProfile = GUICtrlCreateInput($CurrentProfile, 140, 50, 300, 30, $ES_CENTER)
    GUICtrlSetFont(-1, 15)

    $CreateProfileButton = GUICtrlCreateButton("Create Profile", 20, 120, 160, 40)
    GUICtrlSetOnEvent($CreateProfileButton, "_CreateNewProfile")
    GUICtrlSetFont(-1, 15)

    $LoadProfileButton = GUICtrlCreateButton("Load Profile...", 425, 120, 160, 40)
    GUICtrlSetOnEvent($LoadProfileButton, "_LoadProfile")
    GUICtrlSetFont(-1, 15)

    $EditProfileButton = GUICtrlCreateButton("Edit Profile", 20, 210, 160, 40)
    GUICtrlSetOnEvent($EditProfileButton, "_EditProfile")
    GUICtrlSetFont(-1, 15)

    $RemoveProfileButton = GUICtrlCreateButton("Remove Profile", 425, 210, 160, 40)
    GUICtrlSetOnEvent($RemoveProfileButton, "_RemoveProfile")
    GUICtrlSetFont(-1, 15)

    $CloseButton = GUICtrlCreateButton("Close", 223, 165, 160, 40)
    GUICtrlSetOnEvent($CloseButton, "_CloseGui")
    GUICtrlSetFont(-1, 15)

    GUICtrlCreateLabel("© R.S.S Software", 523, 288)
    GUICtrlSetFont(-1, 7)

    GUISetState()
EndFunc   ;==>_ProfileGui

Func _RemoveProfile()
    $GetDir = ""
    $CheckCancel = MsgBox(4, "Remove Profile...", "Are you sure you want to remove a profile?")
    If $CheckCancel = 6 Then
        While $GetDir = ""
            $GetDir = FileSelectFolder("Remove Profile...", @ScriptDir & "\Data\Profiles")
            If $GetDir = "" Then
                MsgBox(64, "Error", "No profile selected!")
                $GetDir = 1
            Else
                $CheckCancel = MsgBox(4, "Remove Profile...", "Are you sure you wish to remove this profile?")
                If $CheckCancel = 6 Then
                    DirRemove($GetDir, 1)
                    MsgBox(0, "Remove Profile...", "Profile removed!")
                Else
                    Sleep(10)
                EndIf
            EndIf
        WEnd
    Else
        Sleep(10)
    EndIf
EndFunc   ;==>_RemoveProfile


Func _EditProfile()


    GUIDelete($Gui)

    $CurrentGui = "Edit"

    $Gui = GUICreate("Edit Profile", 600, 270)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_CloseGui")

    GUICtrlCreateLabel("Program List", 225, 10, 200, 50)
    GUICtrlSetFont(-1, 15)

    $ProgramListing = GUICtrlCreateCombo("", 20, 50, 560, 30)
    GUICtrlSetFont(-1, 15)

    $ProfileData = IniReadSection(@ScriptDir & "\Data\Profiles\" & $CurrentProfile & "\" & $CurrentProfile & ".ini", "Programs")
    If @error Then
        Sleep(10)
    Else

        For $i = 1 To $ProfileData[0][0]
            $StringSplit = StringSplit($ProfileData[$i][1], "|")
            GUICtrlSetData($ProgramListing, $StringSplit[1])
        Next

    EndIf

    $AddProgramButton = GUICtrlCreateButton("Add Program", 5, 140, 170, 50)
    GUICtrlSetOnEvent($AddProgramButton, "_AddProgram")
    GUICtrlSetFont(-1, 15)

    $AddWebsiteButton = GUICtrlCreateButton("Add Website", 215, 140, 170, 50)
    GUICtrlSetOnEvent($AddWebsiteButton, "_AddWebsite")
    GUICtrlSetFont(-1, 15)

    $CloseButton = GUICtrlCreateButton("Close", 215, 210, 170, 50)
    GUICtrlSetOnEvent($CloseButton, "_CloseGui")
    GUICtrlSetFont(-1, 15)

    $RemoveProgramButton = GUICtrlCreateButton("Remove Program", 425, 140, 170, 50)
    GUICtrlSetOnEvent($RemoveProgramButton, "_RemoveProgramFromList")
    GUICtrlSetFont(-1, 15)

    GUISetState()
EndFunc   ;==>_EditProfile


Func _LoadProfile()
    GUISetState(@SW_DISABLE, $Gui)

    $ProfileToLoad = FileOpenDialog("Load Profile...", @ScriptDir & "\Data\Profiles", "Ini Files (*.ini)")
    If $ProfileToLoad = "" Then
        MsgBox(48, "Error", "No profile loaded!")
        GUISetState(@SW_ENABLE, $Gui)
        WinActivate($Gui)
    Else
        $Split = StringSplit($ProfileToLoad, "\")
        $DataToPull = $Split[0]
        $ProfileLoaded = $Split[$DataToPull]
        $ProfileLoaded = StringTrimRight($ProfileLoaded, 4)
        $CurrentProfile = $ProfileLoaded
        GUICtrlSetData($LoadedProfile, $ProfileLoaded)
        MsgBox(0, "Load Profile...", "Profile loaded!")
        TrayItemSetText($TrayCurrentProfileItem, $ProfileLoaded)
        IniWrite(@ScriptDir & "\Data\Settings.ini", "Settings", "2", $ProfileLoaded)
        GUISetState(@SW_ENABLE, $Gui)
        WinActivate($Gui)
    EndIf
EndFunc   ;==>_LoadProfile


Func _CreateNewProfile()
    $CheckName = ""
    GUISetState(@SW_DISABLE, $Gui)

    $CheckCancel = MsgBox(4, "Create Profile...", "Are you ready to create a new profile?")
    If $CheckCancel = 6 Then
        While $CheckName = ""
            $CheckName = InputBox("New Profile...", "What would you like to name this new profile?")
            DirGetSize(@ScriptDir & "/Data/Profiles/" & $CheckName)
            If @error Then
                DirCreate(@ScriptDir & "/Data/Profiles/" & $CheckName)
                IniWrite(@ScriptDir & "/Data/Profiles/" & $CheckName & "/" & $CheckName & ".ini", "Profile", "Name", $CheckName)
                GUISetState(@SW_ENABLE, $Gui)
                WinActivate($Gui)
                MsgBox(0, "New Profile...", "Profile created!")
                GUICtrlSetData($LoadedProfile, $CheckName)
                TrayItemSetText($TrayCurrentProfileItem, $CheckName)
                IniWrite(@ScriptDir & "\Data\Settings.ini", "Settings", "2", $CheckName)
                $CurrentProfile = $CheckName
            Else
                MsgBox(48, "Error", "A profile already exists with this name!")
                $CheckCancel = MsgBox(4, "Create Profile...", "Would you like to try again?")
                If $CheckCancel = 6 Then
                    $CheckName = ""
                Else
                    GUISetState(@SW_ENABLE, $Gui)
                    WinActivate($Gui)
                EndIf
            EndIf
        WEnd
    Else
        Sleep(10)
        GUISetState(@SW_ENABLE, $Gui)
        WinActivate($Gui)
    EndIf

EndFunc   ;==>_CreateNewProfile

Func _RunPrograms()
    $ProfileData = IniReadSection(@ScriptDir & "\Data\Profiles\" & $CurrentProfile & "\" & $CurrentProfile & ".ini", "Programs")
    If @error Then
        MsgBox(48, "Error", "No programs found!")
    Else
        For $i = 1 To $ProfileData[0][0]
            $SplitData = StringSplit($ProfileData[$i][1], "|")
            If @error Then
                MsgBox(48, "Error", "No programs listed!")
                ExitLoop
            Else
                ShellExecute($SplitData[2])
            EndIf
        Next
    EndIf

EndFunc   ;==>_RunPrograms

Func _CloseGui()
    If $CurrentGui = "Profile" Then
        GUIDelete($Gui)
    ElseIf $CurrentGui = "Edit" Then
        GUIDelete($Gui)
        _ProfileGui()
    EndIf
EndFunc   ;==>_CloseGui


Func _Exit()
    Exit
EndFunc   ;==>_Exit


While 1
    Sleep(10)
WEnd

 

Profile Module (Needed for proper function)

Global $ProfileData, $CurrentProfile, $Gui, $ProgramListing

Func _AddProgram()
    GuiSetState(@SW_DISABLE, $Gui)
    $NameProgram = ""
    $Count = 1

        $ProfileData = IniReadSection(@ScriptDir & "\Data\Profiles\" & $CurrentProfile & "\" & $CurrentProfile & ".ini", "Programs")
    If @Error Then
        Sleep(10)
    Else
    For $i = 1 To $ProfileData[0][0]
        $Count += 1
    Next
    EndIf

    $CheckNewProgram = MsgBox(4, "Add Program", "Would you like to add a program?")
    If $CheckNewProgram = 6 Then
        While $NameProgram = ""
            $NameProgram = InputBox("Add Program", "What would you like to name the program?" & @CRLF & "Type 'Cancel' to cancel")
            If $NameProgram = "Cancel" Then
                Sleep(10)
                Else
        $ProgramToAdd = FileOpenDialog("Add Program", @DesktopDir, "All (*.*)")
        If $ProgramToAdd = "" Then
            MsgBox(48, "Error", "No program added!")
            GuiSetState(@SW_ENABLE, $Gui)
            WinActivate($Gui)
        Else
            IniWrite(@ScriptDir & "\Data\Profiles\" & $CurrentProfile & "\" & $CurrentProfile & ".ini", "Programs", $Count, $NameProgram & "|" & $ProgramToAdd)
            GUIDelete($Gui)
            _EditProfile()
        EndIf
                EndIf
        WEnd
        Else
        GuiSetState(@SW_ENABLE, $Gui)
        WinActivate($Gui)
        Sleep(10)
    EndIf
EndFunc   ;==>_AddProgram

Func _AddWebsite()
    GuiSetState(@SW_DISABLE, $Gui)
    $NameWebsite = ""
    $Count = 1
            $ProfileData = IniReadSection(@ScriptDir & "\Data\Profiles\" & $CurrentProfile & "\" & $CurrentProfile & ".ini", "Programs")
    If @Error Then
        Sleep(10)
    Else
    For $i = 1 To $ProfileData[0][0]
        $Count += 1
    Next
    EndIf
    $CheckNewWebsite = MsgBox(4, "Add Website", "Would you like to add a website?")
    If $CheckNewWebsite = 6 Then
        While $NameWebsite = ""
            $NameWebsite = InputBox("Add Website", "What would you like to name the website?" & @CRLF & "Type 'Cancel' to cancel")
            If $NameWebsite = "Cancel" Then
                Sleep(10)
                GuiSetState(@SW_ENABLE, $Gui)
                WinActivate($Gui)
                Else
        $WebsiteToAdd = InputBox("Add Website", "Enter the URL of the website.")
        If $WebsiteToAdd = "" Then
            MsgBox(48, "Error", "No website added!")
            GuiSetState(@SW_ENABLE, $Gui)
            WinActivate($Gui)
        Else
            IniWrite(@ScriptDir & "\Data\Profiles\" & $CurrentProfile & "\" & $CurrentProfile & ".ini", "Programs", $Count, $NameWebsite & "|" & $WebsiteToAdd)
            GUIDelete($Gui)
            _EditProfile()
        EndIf
                EndIf
        WEnd
        Else
        GuiSetState(@SW_ENABLE, $Gui)
        WinActivate($Gui)
        Sleep(10)
    EndIf
EndFunc   ;==>_AddWebsite

Func _RemoveProgramFromList()
    $ProgramToRemove = GUICtrlRead($ProgramListing)
    If $ProgramToRemove = "" Then
        Sleep(10)
        Else
    $Find = _ArraySearch($ProfileData, $ProgramToRemove, Default, Default, 1, 3)
    $Delete = _ArrayDelete($ProfileData, $Find)
    IniDelete(@ScriptDir & "\Data\Profiles\" & $CurrentProfile & "\" & $CurrentProfile & ".ini", "Programs")
    For $i = 1 To $ProfileData[0][0] - 1
        IniWrite(@ScriptDir & "\Data\Profiles\" & $CurrentProfile & "\" & $CurrentProfile & ".ini", "Programs", $i, $ProfileData[$i][1])
    Next
    $CheckIni = IniRead(@ScriptDir & "\Data\Profiles\" & $CurrentProfile & "\" & $CurrentProfile & ".ini", "Programs", "1", "")
    If $CheckIni = "" Then
        IniWriteSection(@ScriptDir & "\Data\Profiles\" & $CurrentProfile & "\" & $CurrentProfile & ".ini", "Programs", "")
    Else
        Sleep(10)
    EndIf
    GUIDelete($Gui)
    _EditProfile()
        EndIf

EndFunc   ;==>_RemoveCommentFromList

 

Edited by Damein

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

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...