Jump to content

Run Command Wont work


Recommended Posts

Okay... here is my problem. I am tring to write a gui for my flash drive that will act as a clickable interface to launch certin programs that I use very often. I have got every thing to where it will work, except for one program.

[sql]#region --- GuiBuilder code Start ---; Script generated by AutoBuilder 0.6 Prototype#include <GuiConstants.au3>#NoTrayIconOpt("GUIOnEventMode",1)GuiCreate("Pocket Launch", 410, 68, (@DesktopWidth-405)/2, 0 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)[/sql]

$Button_1 = GuiCtrlCreateButton("1", 10, 10, 40, 40,$BS_ICON)

GUICtrlSetImage ($Button_1, ".\Pocket Launch\trilliian.ico")

GUICtrlSetOnEvent(3, "trillian")

[sql]$Button_2 = GuiCtrlCreateButton("2", 60, 10, 40, 40,$BS_ICON)
GUICtrlSetImage ($Button_2, ".\Pocket Launch\fox.ico")
GuiCtrlSetOnEvent(4, "fox")
$Button_3 = GuiCtrlCreateButton("3", 110, 10, 40, 40,$BS_ICON)
GUICtrlSetImage ($Button_3, ".\Pocket Launch\office.ico")
GuiCtrlSetOnEvent(5, "office")
$Button_4 = GuiCtrlCreateButton("4", 160, 10, 40, 40,$BS_ICON)
GUICtrlSetImage ($Button_4, ".\Pocket Launch\tools.ico")
GuiCtrlSetOnEvent(6, "tools")
$Button_5 = GuiCtrlCreateButton("5", 210, 10, 40, 40,$BS_ICON)
GUICtrlSetImage ($Button_5, ".\Pocket Launch\ccity.ico")
$Button_6 = GuiCtrlCreateButton("6", 260, 10, 40, 40,$BS_ICON)
GUICtrlSetImage ($Button_6, ".\Pocket Launch\misc.ico")
GuiCtrlSetOnEvent(8, "misc")
$Button_7 = GuiCtrlCreateButton("7", 310, 10, 40, 40,$BS_ICON)
GUICtrlSetImage ($Button_7, ".\Pocket Launch\game.ico")
GuiCtrlSetOnEvent(9, "games")
$Button_8 = GuiCtrlCreateButton("8", 360, 10, 40, 40,$BS_ICON)
GUICtrlSetImage ($Button_8, ".\Pocket Launch\school.ico")
GuiCtrlSetOnEvent(10, "school")
$Label_9 = GuiCtrlCreateLabel("Trillian", 10, 50, 40, 20, $SS_CENTER)
$Label_10 = GuiCtrlCreateLabel("Fox", 60, 50, 40, 20, $SS_CENTER)
$Label_11 = GuiCtrlCreateLabel("Office", 110, 50, 40, 20, $SS_CENTER)
$Label_12 = GuiCtrlCreateLabel("Tools", 160, 50, 40, 20, $SS_CENTER)
$Label_13 = GuiCtrlCreateLabel("CCity", 210, 50, 40, 20, $SS_CENTER)
$Label_14 = GuiCtrlCreateLabel("Misc", 260, 50, 40, 20, $SS_CENTER)
$Label_15 = GuiCtrlCreateLabel("Games", 310, 50, 40, 20, $SS_CENTER)
$Label_16 = GuiCtrlCreateLabel("School", 360, 50, 40, 20, $SS_CENTER)

GUISetOnEvent($GUI_EVENT_CLOSE, "ExitPressed")

GuiSetState()
While 1
sleep(80)
$msg = GuiGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;
EndSelect
WEnd
Exit[/sql]

func trillian()

Run(".\1.) Trillian IM\trillian.exe")

Exit

EndFunc

[sql]Func fox()
Run(".\2.) Pocket Fox\PortableFirefox.exe")
Exit
EndFunc

Func office()
Run(".\3.) Pocket Office\PortableOpenOffice.exe")
Exit
EndFunc

Func tools()
run("explorer.exe .\4.) Tools")
Exit
EndFunc

Func ccity()
Run("explorer.exe .\5.) Circuit City")
Exit
EndFunc

Func misc()
Run("explorer.exe .\6.) Misc Programs")
Exit
EndFunc

Func games()
Run("explorer.exe .\7.) Games & Stuff")
Exit
EndFunc

func school()
Run("explorer.exe .\8.) School Work")
Exit
EndFunc

Func ExitPressed()
Exit
EndFunc

#endregion --- GuiBuilder generated code End ---[/sql]

Edited by The Darkness
Link to comment
Share on other sites

try putting the working directory in Run(".\1.) Trillian IM\trillian.exe", "c:\Full path to working directory")

MAN YOU ARE FREAKIN AWESOME!

That worked!. :o Now if you have the time could you tell me why it worked and should I do it to my other program shortcuts?

Edited by The Darkness
Link to comment
Share on other sites

MAN YOU ARE FREAKIN AWESOME!

That worked!. :o Now if you have the time could you tell me why it worked and should I do it to my other program shortcuts?

Specifying the working directory meant that the ini files were loaded from that specified directory rather than the directory that your original program was running from

Link to comment
Share on other sites

One more thing... is there a way to change the maximize button to do another functon, such as run a program?

If using gui get msg method this works, Just trying to figure out how you do it with onevent

Case $msg = $GUI_EVENT_MAXIMIZE
        MsgBox (0,"Max","You have maximised the window")
Link to comment
Share on other sites

One more thing... is there a way to change the maximize button to do another functon, such as run a program?

This will do it with onEvent

GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "SpecialEvents")

Func SpecialEvents()
    

    Select
        Case @GUI_CTRLID = $GUI_EVENT_CLOSE
            MsgBox(0, "Close Pressed", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE)
            Exit
            
        Case @GUI_CTRLID = $GUI_EVENT_MINIMIZE
            MsgBox(0, "Window Minimized", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE)
            
        Case @GUI_CTRLID = $GUI_EVENT_RESTORE
            MsgBox(0, "Window Restored", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE)
        
        Case @GUI_CTRLID = $GUI_EVENT_MAXIMIZE 
            MsgBox(0, "Window Maximized", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE)
    EndSelect
    
EndFunc
Link to comment
Share on other sites

This will do it with onEvent

GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "SpecialEvents")

Func SpecialEvents()
    

    Select
        Case @GUI_CTRLID = $GUI_EVENT_CLOSE
            MsgBox(0, "Close Pressed", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE)
            Exit
            
        Case @GUI_CTRLID = $GUI_EVENT_MINIMIZE
            MsgBox(0, "Window Minimized", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE)
            
        Case @GUI_CTRLID = $GUI_EVENT_RESTORE
            MsgBox(0, "Window Restored", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE)
        
        Case @GUI_CTRLID = $GUI_EVENT_MAXIMIZE 
            MsgBox(0, "Window Maximized", "ID=" & @GUI_CTRLID & " WinHandle=" & @GUI_WINHANDLE)
    EndSelect
    
EndFunc

thanx for taking the time to help... I'm such a noob at this.

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