Sign in to follow this  
Followers 0
Gurutz

I've looked through topics and i don't understand.

13 posts in this topic

I don't understand how the runapp or run works propally because i want to make a few things run of a click of a button.. but can't think of how the runapp or run makes them work...

Heres my code.

#include <GUIConstants.au3>

; == GUI generated with Koda ==

$Form1 = GUICreate("Desktop", 589, 46, 192, 125)

$Pic1 = GUICtrlCreatePic("Desktop\msword.GIF", 8, 8, 34, 29)

$Button1 = GUICtrlCreateButton("MSW", 48, 8, 49, 25)

GUICtrlSetFont(-1, 10, 400, 0, "Verdana")

$Pic2 = GUICtrlCreatePic("Desktop\powerp.GIF", 112, 8, 33, 33)

$Button2 = GUICtrlCreateButton("MSPP", 152, 8, 49, 25)

GUICtrlSetFont(-1, 10, 400, 0, "Verdana")

$Pic3 = GUICtrlCreatePic("Desktop\mse.GIF", 216, 8, 33, 33)

$Button3 = GUICtrlCreateButton("MSE", 264, 8, 49, 25)

GUICtrlSetFont(-1, 10, 400, 0, "Verdana")

$Pic4 = GUICtrlCreatePic("Desktop\MSLive.GIF", 328, 8, 33, 33)

$Button4 = GUICtrlCreateButton("MSLive", 378, 8, 57, 25)

GUICtrlSetFont(-1, 10, 400, 0, "Verdana")

GUISetState(@SW_SHOW)

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case Else

;;;;;;;

EndSelect

WEnd

anyone able to get them to work?

Share this post


Link to post
Share on other sites



This ought to get you a little farther down the road:

#include <GUIConstants.au3>

$Form1 = GUICreate("Desktop", 589, 46, 192, 125)
$Pic1 = GUICtrlCreatePic("Desktop\msword.GIF", 8, 8, 34, 29)
$Button1 = GUICtrlCreateButton("MSW", 48, 8, 49, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
$Pic2 = GUICtrlCreatePic("Desktop\powerp.GIF", 112, 8, 33, 33)
$Button2 = GUICtrlCreateButton("MSPP", 152, 8, 49, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
$Pic3 = GUICtrlCreatePic("Desktop\mse.GIF", 216, 8, 33, 33)
$Button3 = GUICtrlCreateButton("MSE", 264, 8, 49, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
$Pic4 = GUICtrlCreatePic("Desktop\MSLive.GIF", 328, 8, 33, 33)
$Button4 = GUICtrlCreateButton("MSLive", 378, 8, 57, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
GUISetState(@SW_SHOW)

While 1
  $msg = GuiGetMsg()
  Select
    Case $msg = $GUI_EVENT_CLOSE
      ExitLoop
    case $msg = $Button1
      MsgBox(0, "Button", "You pressed button 1")
      ; Run("Myapp.exe")      
  EndSelect
WEnd

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites

This ought to get you a little farther down the road:

#include <GUIConstants.au3>

$Form1 = GUICreate("Desktop", 589, 46, 192, 125)
$Pic1 = GUICtrlCreatePic("Desktop\msword.GIF", 8, 8, 34, 29)
$Button1 = GUICtrlCreateButton("MSW", 48, 8, 49, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
$Pic2 = GUICtrlCreatePic("Desktop\powerp.GIF", 112, 8, 33, 33)
$Button2 = GUICtrlCreateButton("MSPP", 152, 8, 49, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
$Pic3 = GUICtrlCreatePic("Desktop\mse.GIF", 216, 8, 33, 33)
$Button3 = GUICtrlCreateButton("MSE", 264, 8, 49, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
$Pic4 = GUICtrlCreatePic("Desktop\MSLive.GIF", 328, 8, 33, 33)
$Button4 = GUICtrlCreateButton("MSLive", 378, 8, 57, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
GUISetState(@SW_SHOW)

While 1
  $msg = GuiGetMsg()
  Select
    Case $msg = $GUI_EVENT_CLOSE
      ExitLoop
    case $msg = $Button1
      MsgBox(0, "Button", "You pressed button 1")
      ; Run("Myapp.exe")      
  EndSelect
WEnd
Thanks. I shall see what to do from here ^.^

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Okay thanks, im not sure if this code would work in the program.. is it possable?

While 1
  $msg = GuiGetMsg()
  Select
    Case $msg = $GUI_EVENT_CLOSE
      ExitLoop
    case $msg = $Button1
      MsgBox(0, "Opening", "Opening Microsoft Word")
     ; Run("Myapp.exe")
      Run("Microsoft Word.exe", "C:\Documents and Settings\All Users\Desktop\")
      
  EndSelect
WEnd

would it work?

Edited by Gurutz

Share this post


Link to post
Share on other sites

If you try it you will see that it does not work. The exe for Microsoft Word is winword.exe and you would also need to supply the full path to it.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Okay thanks, im not sure if this code would work in the program.. is it possable?

While 1
  $msg = GuiGetMsg()
  Select
    Case $msg = $GUI_EVENT_CLOSE
      ExitLoop
    case $msg = $Button1
      MsgBox(0, "Opening", "Opening Microsoft Word")
    ; Run("Myapp.exe")
      Run("Microsoft Word.exe", "C:\Documents and Settings\All Users\Desktop\")
      
  EndSelect
WEnd

would it work?

The syntax is correct, but the executable for Word is wrong.

Run("WinWord.exe", "C:\Documents and Settings\All Users\Desktop\")

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites

The syntax is correct, but the executable for Word is wrong.

Run("WinWord.exe", "C:\Documents and Settings\All Users\Desktop\")
What would the one be for msnmsgr.exe? i've tried opening that and it doesn't work :whistle:

Share this post


Link to post
Share on other sites

What would the one be for msnmsgr.exe? i've tried opening that and it doesn't work

Uh.. :whistle:

How about running this from a command prompt:

Dir msnmsgr.exe /s

It will give you the path you need to the executable you already know. ;)

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites

Line 42

Run("WinWord.exe", "C:\Documents and Settings\All Users\Desktop\")

Error: Unable to execute the external program

The system cannot find the file specified

Even with this error it should open right?

Since the Address to the program is optionial.

Share this post


Link to post
Share on other sites

Since the Address to the program is optionial.

I'm fairly certain that you need to specify the path. It is not in the systems path. The Run function does not search the registry as compared to the Run box of the OS.

Share this post


Link to post
Share on other sites

Well it is going to be a tooltip for the desktop, and i need it to have it on so that its just like a quicklaunch, and only problem now is to get these things up and running :whistle:.

Anyone here able to edit the code i have now to get things to work.

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("Desktop", 589, 46, 192, 125)
$Pic1 = GUICtrlCreatePic("Desktop\msword.GIF", 8, 8, 34, 29)
$Button1 = GUICtrlCreateButton("MSW", 48, 8, 49, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
$Pic2 = GUICtrlCreatePic("Desktop\powerp.GIF", 112, 8, 33, 33)
$Button2 = GUICtrlCreateButton("MSPP", 152, 8, 49, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
$Pic3 = GUICtrlCreatePic("Desktop\mse.GIF", 216, 8, 33, 33)
$Button3 = GUICtrlCreateButton("MSE", 264, 8, 49, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
$Pic4 = GUICtrlCreatePic("Desktop\MSLive.GIF", 328, 8, 33, 33)
$Button4 = GUICtrlCreateButton("MSLive", 378, 8, 57, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
GUISetState(@SW_SHOW)


While 1
  $msg = GuiGetMsg()
  Select
    Case $msg = $GUI_EVENT_CLOSE
      ExitLoop
  Case $msg = $Button4
      MsgBox(0, "Opening", "Opening MSN Messenger", 2)
  Case $msg = $Button1
      MsgBox(0, "Opening", "Opening Word", 2)
  Case $Msg = $Button2
      MsgBox(0, "Opening", "Windows PowerPoint", 2)
  Case $Msg = $Button3
      MsgBox(0, "Opening", "Windows Excel", 2)
      
    
  EndSelect
WEnd

Share this post


Link to post
Share on other sites

Try this. I have guessed some of the key names as I do not have MS Office or MSN Msg... installed.

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("Desktop", 589, 46, 192, 125)
$Pic1 = GUICtrlCreatePic("Desktop\msword.GIF", 8, 8, 34, 29)
$Button1 = GUICtrlCreateButton("MSW", 48, 8, 49, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
$Pic2 = GUICtrlCreatePic("Desktop\powerp.GIF", 112, 8, 33, 33)
$Button2 = GUICtrlCreateButton("MSPP", 152, 8, 49, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
$Pic3 = GUICtrlCreatePic("Desktop\mse.GIF", 216, 8, 33, 33)
$Button3 = GUICtrlCreateButton("MSE", 264, 8, 49, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
$Pic4 = GUICtrlCreatePic("Desktop\MSLive.GIF", 328, 8, 33, 33)
$Button4 = GUICtrlCreateButton("MSLive", 378, 8, 57, 25)
GUICtrlSetFont(-1, 10, 400, 0, "Verdana")
GUISetState(@SW_SHOW)


While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button4
            MsgBox(0, "Opening", "Opening MSN Messenger", 2)
            $path = _AppPaths('msnmsgr.exe')
            If FileExists($path) Then
                Run($path)
            EndIf
        Case $msg = $Button1
            MsgBox(0, "Opening", "Opening Word", 2)
            $path = _AppPaths('winword.exe')
            If FileExists($path) Then
                Run($path)
            EndIf
        Case $msg = $Button2
            MsgBox(0, "Opening", "Windows PowerPoint", 2)
            $path = _AppPaths('pwrpoint.exe')
            If FileExists($path) Then
                Run($path)
            EndIf
        Case $msg = $Button3
            MsgBox(0, "Opening", "Windows Excel", 2)
            $path = _AppPaths('excel.exe')
            If FileExists($path) Then
                Run($path)
            EndIf
    EndSelect
WEnd

Func _AppPaths($key)
    Local $value
    $value = RegRead('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\' & $key, '')
    If Not @error Then
        Return $value
    EndIf
EndFunc

Share this post


Link to post
Share on other sites

Thanks that worked perfectly.

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