Jump to content

Run Command - Short options


Recommended Posts

Hi,

I think that depends on the pathes you add to the system variable PATH.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

this script isn't ready, but it will show you in the combox which exe files you can start directly with the run command.

#include <GuiConstants.au3>
#include <GuiCombo.au3>
#Include <File.au3>
#Include <Array.au3>

Global $Combo, $Btn_Exit, $msg, $old_string = "", $befehl = "", $arrayText = ""
Global $pathes = StringSplit(EnvGet("PATH"), ';')
Global $fileLists_A[$pathes[0] + 1]

GUICreate("'which command by Mega", 320, 140, 10, 10)

$Combo = GUICtrlCreateCombo("", 10, 80, 300, 120)
$Btn_Refresh = GUICtrlCreateButton("Refresh Filter", 110, 40, 90, 30)
$Btn_Start = GUICtrlCreateButton("Start", 10, 40, 90, 30)
$Btn_Exit = GUICtrlCreateButton("Exit", 210, 40, 90, 30)
$filter_I = GUICtrlCreateInput("exe", 50, 10, 30, 20)
$filter_L = GUICtrlCreateLabel("Filter: ", 10, 10, 40, 20)

_fillCombo("*.exe")

GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
            ExitLoop
        Case $msg = $Btn_Start
            $befehl = GUICtrlRead($Combo)
            If $befehl = '' Then
                MsgBox(0, "Info", "Please choose one item in the combobox", 4)
            Else
                _with()
            EndIf
        Case $msg = $Btn_Refresh
            GUICtrlSetData($Combo, "")
            _fillCombo("*." & GUICtrlRead($filter_I))
        Case Else
            _GUICtrlComboAutoComplete($Combo, $old_string)
    EndSelect
WEnd
Exit

Func _fillCombo($filter = "*.exe")
    For $i = 1 To UBound($pathes) - 1
        $fileLists_A[$i] = _FileListToArray($pathes[$i], $filter, 1)
        If (Not IsArray($fileLists_A)) And (@error = 1) Then
            MsgBox(0, "Error", "No Files\Folders Found.")
            Exit
        EndIf
    Next

    For $i = 1 To UBound($fileLists_A) - 1
        $arrayText &= _ArrayToString($fileLists_A[$i], "|", 1)
    Next
    GUICtrlSetData($Combo, $arrayText)
    $arrayText = ""
EndFunc   ;==>_fillCombo


Func _with()
    For $i = 1 To UBound($fileLists_A[$i]) - 1
        If _ArraySearch($fileLists_A[$i], GUICtrlRead($Combo)) <> -1 Then
            MsgBox(64, "Info", "Der Befehl: " & @CRLF & @CRLF & GUICtrlRead($Combo) & @CRLF & @CRLF & " aus " & @CRLF & @CRLF & $pathes[$i] & @CRLF & @CRLF & " wird ausgeführt!", 5)
            If StringRight($pathes[$i], 1) <> "\" Then
                $pathes[$i] = $pathes[$i] & "\"
            EndIf
            Run($pathes[$i] & GUICtrlRead($Combo))
            Return 1
        EndIf
        ;ConsoleWrite("$i: " & $i & " $y: " & $y & " $fileLists_A: " & $fileLists_A[$i] & " " & $befehl & " " & " Path: " & $pathes[$i] & @LF)
    Next
    MsgBox(64, "Info", "Der Befehl: " & @CRLF & @CRLF & GUICtrlRead($Combo) & @CRLF & @CRLF & " wurde nicht gefunden!", 5)
EndFunc   ;==>_with

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

this script isn't ready, but it will show you in the combox which exe files you can start directly with the run command.

So long,

Mega

Ok, this is helpful but it still doesn't let me know if you add things onto the list. However I think I can because for example all the microsoft applications got added onto the path (the run command will recognize "winword"), but I still don't know how to add objects onto that path.
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

Hi,

have a look here http://www.wilsonmar.com/1envvars.htm

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Open up regedit and look under the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\

Create a new key with the name you want to run, and set its default value to the full path to the program.

Another way is to create shortcuts that exist in PATH. For example, LNK files in the @SystemDir and @UserProfileDir folders can be run the same way.

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

Open up regedit and look under the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\

Create a new key with the name you want to run, and set its default value to the full path to the program.

Another way is to create shortcuts that exist in PATH. For example, LNK files in the @SystemDir and @UserProfileDir folders can be run the same way.

Great, that worked (I used the regedit way because it seemed more professional), thanks!

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
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...