Sign in to follow this  
Followers 0
dcolangelo38

When i make a button how do i make it open a file?

8 posts in this topic

I understand this is my bottom of my script and help?

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Button1

(what do i put here i want to open like a folder like my documents...) :)

EndSelect

Wend

Share this post


Link to post
Share on other sites



Run() / ShellExecute()?


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Run() / ShellExecute()?

i am really newbie and i guess i will try shellExecute thanks...

Share this post


Link to post
Share on other sites

You have a few options, but it depends on what exactly you are trying to do? For a start try this.

Case $msg = $button1
  $file = FileOpenDialog("File to open",@WorkingDir,)
  msgbox(0,"You Chose",$file)

That's just off the top of my head. I don't have AutoIt on this computer. But there's an idea of how to get started with whatever you're trying to acheive.

Share this post


Link to post
Share on other sites

i am really newbie and i guess i will try shellExecute thanks...

wow, i am still confused i just want to open up a folder by pressing a button wtf? would i use it as a link with shellExecute? to like my documents

Share this post


Link to post
Share on other sites

wow, i am still confused i just want to open up a folder by pressing a button wtf? would i use it as a link with shellExecute? to like my documents

ShellExecute(@MyDocumentsDir)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

ShellExecute(@MyDocumentsDir)

i just tried that and it doesnt open up my docs here is my script... i am trying to make a program that opens up then you choose were you want to go around your cpu so i want to hit a button then go to that folder...

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Form1", 441, 166, 193, 125)

$Button1 = GUICtrlCreateButton("School", 320, 128, 105, 25, 0)

$Button2 = GUICtrlCreateButton("Music", 168, 128, 105, 25, 0)

$Button3 = GUICtrlCreateButton("Programs", 8, 128, 105, 25, 0)

$Label1 = GUICtrlCreateLabel("Desktop In A BoX...Chose What You Would Like To Do?", 8, 80, 419, 27)

GUICtrlSetFont(-1, 12, 400, 0, "Comic Sans MS")

$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\IBM\My Documents\My Pictures\BOX!.bmp", 0, 0, 76, 68, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

$Pic2 = GUICtrlCreatePic("C:\Documents and Settings\IBM\My Documents\My Pictures\BETA.bmp", 320, 8, 108, 60, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case $msg = $Button1

ShellExecute(@MyDocumentsDir)

EndSelect

Wend

Share this post


Link to post
Share on other sites

Works fine for me:

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 441, 166, 193, 125)
$Button1 = GUICtrlCreateButton("School", 320, 128, 105, 25, 0)
$Button2 = GUICtrlCreateButton("Music", 168, 128, 105, 25, 0)
$Button3 = GUICtrlCreateButton("Programs", 8, 128, 105, 25, 0)
$Label1 = GUICtrlCreateLabel("Desktop In A BoX...Chose What You Would Like To Do?", 8, 80, 419, 27)
GUICtrlSetFont(-1, 12, 400, 0, "Comic Sans MS")
$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\IBM\My Documents\My Pictures\BOX!.bmp", 0, 0, 76, 68, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
$Pic2 = GUICtrlCreatePic("C:\Documents and Settings\IBM\My Documents\My Pictures\BETA.bmp", 320, 8, 108, 60, BitOR($SS_NOTIFY, $WS_GROUP, $WS_CLIPSIBLINGS))
GUISetState(@SW_SHOW)
#EndRegion ### START Koda GUI section ### Form=

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button1
            ShellExecute(@MyDocumentsDir)
    EndSelect
WEnd
Be sure you are using the "School" button which is button 1 in your gui.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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