Jump to content

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


Gurutz
 Share

Recommended Posts

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?

Link to comment
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
Link to comment
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 ^.^
Link to comment
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?

Edited by Gurutz
Link to comment
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.


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

Link to comment
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
Link to comment
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.

Link to comment
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
Link to comment
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
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...