Sign in to follow this  
Followers 0
ctl

Need help opening a program

5 posts in this topic

#1 ·  Posted (edited)

Hello, i need your help guys, i have creat a program that when i hit click on a button to open me a program, the problem is that when i hit that button the only program i could run is notepad....i dont know why but i cant run any program beside notepad, i want to open a program like photoshop, so when i run my program and click the button to run Photoshop, could someone help me with this? here is the code

#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)
Global $ExitID
_Main()
Func _Main()
Local $Ctl, $NoID
GUICreate("CWelcome",600, 600)
GUICtrlCreateLabel("Click pe numele tau pentru a putea accesa conturile", 200, 10)
$Ctl = GUICtrlCreateButton("Ctl", 10, 50, 50, 20)
GUICtrlSetOnEvent($Ctl, "OnCtl")
$ExitID = GUICtrlCreateButton("Exit", 150, 50, 50, 20)
GUICtrlSetOnEvent($ExitID, "OnExit")
GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit")
GUISetState() ; display the GUI
While 1
  Sleep(1000)
WEnd
EndFunc   ;==>_Main
;--------------- Functions ---------------
Func OnCtl()
Run("notepad.exe")
EndFunc  
Func OnExit()
If @GUI_CtrlId = $ExitID Then
  MsgBox(0, "You clicked on", "Exit")
Else
  MsgBox(0, "You clicked on", "Close")
EndIf
Exit
EndFunc
Edited by ctl

Share this post


Link to post
Share on other sites



Hello, i need your help guys, i have creat a program that when i hit click on a button to open me a program, the problem is that when i hit that button the only program i could run is notepad....i dont know why but i cant run any program beside notepad, i want to open a program like photoshop, so when i run my program and click the button to run Photoshop, could someone help me with this? here is the code

#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)
Global $ExitID
_Main()
Func _Main()
Local $Ctl, $NoID
GUICreate("CWelcome",600, 600)
GUICtrlCreateLabel("Click pe numele tau pentru a putea accesa conturile", 200, 10)
$Ctl = GUICtrlCreateButton("Ctl", 10, 50, 50, 20)
GUICtrlSetOnEvent($Ctl, "OnCtl")
$ExitID = GUICtrlCreateButton("Exit", 150, 50, 50, 20)
GUICtrlSetOnEvent($ExitID, "OnExit")
GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit")
GUISetState() ; display the GUI
While 1
  Sleep(1000)
WEnd
EndFunc   ;==>_Main
;--------------- Functions ---------------
Func OnCtl()
Run("notepad.exe")
EndFunc   ;==>OnYes
Func OnExit()
If @GUI_CtrlId = $ExitID Then
  MsgBox(0, "You clicked on", "Exit")
Else
  MsgBox(0, "You clicked on", "Close")
EndIf
Exit
EndFunc

search the help file on how to use the run command...

Using it the way you are now, the run command will only look for anyfile named notepad.exe in the windows directory, home drive base and current script directory, try including the full path to the file.


Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

Ohh you mean like Run("photoshop.exe" C:/program files/Adobe) ?

Share this post


Link to post
Share on other sites

Ohh you mean like Run("photoshop.exe" C:/program files/Adobe) ?

close, more like Run(filegetshortname("C:/program files/Adobe/photoshop.exe"))


Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

That works, thanks a lot man.

Edited by ctl

Share this post


Link to post
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
Sign in to follow this  
Followers 0