Sign in to follow this  
Followers 0
BuddyBoy

Opening a file?

16 posts in this topic

I'm a noob at AutoIt coding... I looked at the FileOpen, but its only for read and write text purposes... What if I want to open up mozilla firefox? Or MSN messenger? I tried replacing my direct path of my MSN with the same coding they gave in the AutoIt help and it wouldn't open... any ideas?

Thanks in advance.

Share this post


Link to post
Share on other sites



Run()


[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]

Share this post


Link to post
Share on other sites

Thanks, I got it to work, but I didn't

My current script is :

Run( *my mozilla firefox location* )

Theres no While 1 in there but it opens up firefox MANY times :P, causing my computer to crash -.-

How do i do it so it only opens up one time?

Share this post


Link to post
Share on other sites

show your source :P

Share this post


Link to post
Share on other sites

post some code and we'll see if we can help


[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]

Share this post


Link to post
Share on other sites

If BitAND(GUICtrlRead($Checkbox_1), $GUI_CHECKED) = $GUI_CHECKED Then
            
                
                Run("C:\Program Files\Mozilla Firefox\firefox.exe")
            
        EndIf

I do got all my checkbox stuff working good... thats all up in the script, didn't think it was too necesary to take up room here.

I don't see why it opens it like crazy with that right there :P

Share this post


Link to post
Share on other sites

that bit is probabl in a while loop reading the GUI messages. As far as I can tell, it's being called as long as the checkbox is checked.


[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]

Share this post


Link to post
Share on other sites

Is your If/EndIf loop in a While loop?

Share this post


Link to post
Share on other sites

Run ( "filename" [, "workingdir" [, flag[, standard_i/o_flag]]] )

Run("Notepad.exe", "", @SW_MAXIMIZE)

@help file

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

#include <GuiConstants.au3>
Opt("GUIOnEventMode",1)
HotKeySet("{F5}", "_Start")
HotKeySet("{F7}", "_NoClick")
HotKeySet("{ESC}","Terminate")
HotKeySet("^g", "_GetPos")
$ClickIt = 0
GUICreate("", 400, 300)
GUISetOnEvent($GUI_EVENT_CLOSE,"Terminate")
$Checkbox_1 = GUICtrlCreateCheckbox("", 20, 40, 150, 20)
$Checkbox_2 = GUICtrlCreateCheckbox("", 20, 80, 150, 20)
$Checkbox_3 = GUICtrlCreateCheckbox("F", 20, 120, 150, 20)
$Checkbox_4 = GUICtrlCreateCheckbox("Ri", 20, 160, 150, 20)
$Checkbox_5 = GUICtrlCreateCheckbox("Lcker", 20, 200, 150, 20)
$Checkbox_6 = GUICtrlCreateCheckbox("Sate", 20, 240, 200, 20)
$Checkbox_7 = GUICtrlCreateCheckbox("Ar", 180, 40, 300, 20)
$Checkbox_8 = GUICtrlCreateCheckbox("Ctn", 180, 80, 300, 20)
$Checkbox_9 = GUICtrlCreateCheckbox("Press CTRL+g For coordinates", 180, 120, 300, 20)
$Checkbox_10 = GUICtrlCreateCheckbox("A", 180, 160, 300, 20)
$Checkbox_11 = GUICtrlCreateCheckbox("ro", 180, 200, 300, 20)
GUISetState()
While 1
    Sleep( 10 )
WEnd
Exit
Func _Start ()
    $ClickIt = 1
    While $ClickIt = 1
        If BitAND(GUICtrlRead($Checkbox_1), $GUI_CHECKED) = $GUI_CHECKED Then
            
                
                Run("C:\Program Files\Mozilla Firefox\firefox.exe")
            
        EndIf
        If BitAND(GUICtrlRead($Checkbox_2), $GUI_CHECKED) = $GUI_CHECKED Then
            MouseClick("left", 429, 443)
            MouseClick("right", 503, 330)
            Sleep(120000)
        EndIf
        If BitAND(GUICtrlRead($Checkbox_3), $GUI_CHECKED) = $GUI_CHECKED Then
            MouseClick("right", 503, 330)
            Sleep(4500)
        EndIf
        If BitAND(GUICtrlRead($Checkbox_4), $GUI_CHECKED) = $GUI_CHECKED Then
            MouseClick("right")
        EndIf
        If BitAND(GUICtrlRead($Checkbox_5), $GUI_CHECKED) = $GUI_CHECKED Then
            MouseClick("left")
        EndIf
        If BitAND(GUICtrlRead($Checkbox_6), $GUI_CHECKED) = $GUI_CHECKED Then
            While 1
                Send('{F1}')
                Sleep(10500)
                Send('{F4}')
                Sleep(3500)
            WEnd
        EndIf
        If BitAND(GUICtrlRead($Checkbox_7), $GUI_CHECKED) = $GUI_CHECKED Then
            While 1
                WinWaitActive("Instruction")
                WinClose("Instruction")
                Sleep(360000)
                MouseClick("left", 943, 670, 1)
                Sleep(8000)
                MouseClick("right")
            WEnd
        EndIf
        If BitAND(GUICtrlRead($Checkbox_8), $GUI_CHECKED) = $GUI_CHECKED Then
            While 1
                Send('{CTRLDOWN}')
            WEnd
        EndIf
        If BitAND(GUICtrlRead($Checkbox_9), $GUI_CHECKED) = $GUI_CHECKED Then
            If BitAND(GUICtrlRead($Checkbox_7), $GUI_CHECKED) = $GUI_CHECKED Then
                _GetPos ()
                While 1
                    Sleep(10000)
                WEnd
            EndIf
        EndIf
        If BitAND(GUICtrlRead($Checkbox_10), $GUI_CHECKED) = $GUI_CHECKED Then  
            $color = 0xB50400
                While 1
                    $colorpos = PixelSearch(0+5, 0+5, @DesktopWidth-5, @DesktopHeight-5, $color, 10, 1)
                    If IsArray($colorpos) Then
                        $drop = 20
                        $buttonposx = $pos[0] = $drop
                        $buttonposy = $pos[1]
                        MouseClick("Right", $buttonposx , $buttonposy, 1, 0)
                    EndIf
                WEnd
        EndIf
        If BitAND(GUICtrlRead($Checkbox_11), $GUI_CHECKED) = $GUI_CHECKED Then  
            While 1
                MouseClick("left", 802, 624)
                Sleep(2500)
                MouseClick("left", 505, 365)
                Sleep(500)
                MouseClick("left", 707, 496)
                Sleep(26500)
            Wend
        EndIf
    WEnd
EndFunc;==>_Start
Func _GetPos ()
    Local $pos = MouseGetPos()
    MsgBox(0,'',$pos[0] & "<---X Coord | Y Coord --->" & $pos[1])
EndFunc;==>_GetPos
Func _NoClick ()
    ToolTip("")
    $ClickIt = 0
EndFunc;==>_NoClick
Func Terminate ()
    Exit
EndFunc;==>Terminate

Theres the whole script... My friend just gave me the checkbox things and got it all set up... I just filled in the blank between the checkboxes :P

So i hope you guys can figure it out ;)

I did see that in the help file... But how would that solve my problem of it opening continuously?

Edited by BuddyBoy

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Try This:

#include <GuiConstants.au3>
Opt("GUIOnEventMode",1)
HotKeySet("{F5}", "_Start")
HotKeySet("{F7}", "_NoClick")
HotKeySet("{ESC}","Terminate")
HotKeySet("^g", "_GetPos")
$ClickIt = 0
$VARIABLE = 0
GUICreate("", 400, 300)
GUISetOnEvent($GUI_EVENT_CLOSE,"Terminate")
$Checkbox_1 = GUICtrlCreateCheckbox("", 20, 40, 150, 20)
$Checkbox_2 = GUICtrlCreateCheckbox("", 20, 80, 150, 20)
$Checkbox_3 = GUICtrlCreateCheckbox("F", 20, 120, 150, 20)
$Checkbox_4 = GUICtrlCreateCheckbox("Ri", 20, 160, 150, 20)
$Checkbox_5 = GUICtrlCreateCheckbox("Lcker", 20, 200, 150, 20)
$Checkbox_6 = GUICtrlCreateCheckbox("Sate", 20, 240, 200, 20)
$Checkbox_7 = GUICtrlCreateCheckbox("Ar", 180, 40, 300, 20)
$Checkbox_8 = GUICtrlCreateCheckbox("Ctn", 180, 80, 300, 20)
$Checkbox_9 = GUICtrlCreateCheckbox("Press CTRL+g For coordinates", 180, 120, 300, 20)
$Checkbox_10 = GUICtrlCreateCheckbox("A", 180, 160, 300, 20)
$Checkbox_11 = GUICtrlCreateCheckbox("ro", 180, 200, 300, 20)
GUISetState()
While 1
    Sleep( 10 )
WEnd
Exit
Func _Start ()
    $ClickIt = 1
    While $ClickIt = 1
        If BitAND(GUICtrlRead($Checkbox_1), $GUI_CHECKED) = $GUI_CHECKED Then
           If $VARIABLE = 0 Then 
                Run("C:\Program Files\Mozilla Firefox\firefox.exe")
                $VARIABLE = 1
            Endif
        EndIf
        If BitAND(GUICtrlRead($Checkbox_2), $GUI_CHECKED) = $GUI_CHECKED Then
            MouseClick("left", 429, 443)
            MouseClick("right", 503, 330)
            Sleep(120000)
        EndIf
        If BitAND(GUICtrlRead($Checkbox_3), $GUI_CHECKED) = $GUI_CHECKED Then
            MouseClick("right", 503, 330)
            Sleep(4500)
        EndIf
        If BitAND(GUICtrlRead($Checkbox_4), $GUI_CHECKED) = $GUI_CHECKED Then
            MouseClick("right")
        EndIf
        If BitAND(GUICtrlRead($Checkbox_5), $GUI_CHECKED) = $GUI_CHECKED Then
            MouseClick("left")
        EndIf
        If BitAND(GUICtrlRead($Checkbox_6), $GUI_CHECKED) = $GUI_CHECKED Then
            While 1
                Send('{F1}')
                Sleep(10500)
                Send('{F4}')
                Sleep(3500)
            WEnd
        EndIf
        If BitAND(GUICtrlRead($Checkbox_7), $GUI_CHECKED) = $GUI_CHECKED Then
            While 1
                WinWaitActive("Instruction")
                WinClose("Instruction")
                Sleep(360000)
                MouseClick("left", 943, 670, 1)
                Sleep(8000)
                MouseClick("right")
            WEnd
        EndIf
        If BitAND(GUICtrlRead($Checkbox_8), $GUI_CHECKED) = $GUI_CHECKED Then
            While 1
                Send('{CTRLDOWN}')
            WEnd
        EndIf
        If BitAND(GUICtrlRead($Checkbox_9), $GUI_CHECKED) = $GUI_CHECKED Then
            If BitAND(GUICtrlRead($Checkbox_7), $GUI_CHECKED) = $GUI_CHECKED Then
                _GetPos ()
                While 1
                    Sleep(10000)
                WEnd
            EndIf
        EndIf
        If BitAND(GUICtrlRead($Checkbox_10), $GUI_CHECKED) = $GUI_CHECKED Then    
            $color = 0xB50400
                While 1
                    $colorpos = PixelSearch(0+5, 0+5, @DesktopWidth-5, @DesktopHeight-5, $color, 10, 1)
                    If IsArray($colorpos) Then
                        $drop = 20
                        $buttonposx = $pos[0] = $drop
                        $buttonposy = $pos[1]
                        MouseClick("Right", $buttonposx , $buttonposy, 1, 0)
                    EndIf
                WEnd
        EndIf
        If BitAND(GUICtrlRead($Checkbox_11), $GUI_CHECKED) = $GUI_CHECKED Then  
            While 1
                MouseClick("left", 802, 624)
                Sleep(2500)
                MouseClick("left", 505, 365)
                Sleep(500)
                MouseClick("left", 707, 496)
                Sleep(26500)
            Wend
        EndIf
    WEnd
EndFunc ;==>_Start
Func _GetPos ()
    Local $pos = MouseGetPos()
    MsgBox(0,'',$pos[0] & "<---X Coord | Y Coord --->" & $pos[1])
EndFunc ;==>_GetPos
Func _NoClick ()
    ToolTip("")
    $ClickIt = 0
EndFunc ;==>_NoClick
Func Terminate ()
    Exit
EndFunc ;==>Terminate
Edited by JustinReno

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

AWESOME, it worked. thank you all for your support in a nooby like me :P

Edited by BuddyBoy

Share this post


Link to post
Share on other sites

or a more accurate method:

#include <GuiConstants.au3>
Opt("GUIOnEventMode",1)
HotKeySet("{F5}", "_Start")
HotKeySet("{F7}", "_NoClick")
HotKeySet("{ESC}","Terminate")
HotKeySet("^g", "_GetPos")
$ClickIt = 0
$VARIABLE = 0
GUICreate("", 400, 300)
GUISetOnEvent($GUI_EVENT_CLOSE,"Terminate")
$Checkbox_1 = GUICtrlCreateCheckbox("", 20, 40, 150, 20)
$Checkbox_2 = GUICtrlCreateCheckbox("", 20, 80, 150, 20)
$Checkbox_3 = GUICtrlCreateCheckbox("F", 20, 120, 150, 20)
$Checkbox_4 = GUICtrlCreateCheckbox("Ri", 20, 160, 150, 20)
$Checkbox_5 = GUICtrlCreateCheckbox("Lcker", 20, 200, 150, 20)
$Checkbox_6 = GUICtrlCreateCheckbox("Sate", 20, 240, 200, 20)
$Checkbox_7 = GUICtrlCreateCheckbox("Ar", 180, 40, 300, 20)
$Checkbox_8 = GUICtrlCreateCheckbox("Ctn", 180, 80, 300, 20)
$Checkbox_9 = GUICtrlCreateCheckbox("Press CTRL+g For coordinates", 180, 120, 300, 20)
$Checkbox_10 = GUICtrlCreateCheckbox("A", 180, 160, 300, 20)
$Checkbox_11 = GUICtrlCreateCheckbox("ro", 180, 200, 300, 20)
GUISetState()
While 1
    Sleep( 10 )
WEnd
Exit
Func _Start ()
    $ClickIt = 1
    While $ClickIt = 1
        If BitAND(GUICtrlRead($Checkbox_1), $GUI_CHECKED) = $GUI_CHECKED Then
           If Not ProcessExists("firefox.exe") Then
                Run("C:\Program Files\Mozilla Firefox\firefox.exe")
            Endif
        EndIf
        If BitAND(GUICtrlRead($Checkbox_2), $GUI_CHECKED) = $GUI_CHECKED Then
            MouseClick("left", 429, 443)
            MouseClick("right", 503, 330)
            Sleep(120000)
        EndIf
        If BitAND(GUICtrlRead($Checkbox_3), $GUI_CHECKED) = $GUI_CHECKED Then
            MouseClick("right", 503, 330)
            Sleep(4500)
        EndIf
        If BitAND(GUICtrlRead($Checkbox_4), $GUI_CHECKED) = $GUI_CHECKED Then
            MouseClick("right")
        EndIf
        If BitAND(GUICtrlRead($Checkbox_5), $GUI_CHECKED) = $GUI_CHECKED Then
            MouseClick("left")
        EndIf
        If BitAND(GUICtrlRead($Checkbox_6), $GUI_CHECKED) = $GUI_CHECKED Then
            While 1
                Send('{F1}')
                Sleep(10500)
                Send('{F4}')
                Sleep(3500)
            WEnd
        EndIf
        If BitAND(GUICtrlRead($Checkbox_7), $GUI_CHECKED) = $GUI_CHECKED Then
            While 1
                WinWaitActive("Instruction")
                WinClose("Instruction")
                Sleep(360000)
                MouseClick("left", 943, 670, 1)
                Sleep(8000)
                MouseClick("right")
            WEnd
        EndIf
        If BitAND(GUICtrlRead($Checkbox_8), $GUI_CHECKED) = $GUI_CHECKED Then
            While 1
                Send('{CTRLDOWN}')
            WEnd
        EndIf
        If BitAND(GUICtrlRead($Checkbox_9), $GUI_CHECKED) = $GUI_CHECKED Then
            If BitAND(GUICtrlRead($Checkbox_7), $GUI_CHECKED) = $GUI_CHECKED Then
                _GetPos ()
                While 1
                    Sleep(10000)
                WEnd
            EndIf
        EndIf
        If BitAND(GUICtrlRead($Checkbox_10), $GUI_CHECKED) = $GUI_CHECKED Then   
            $color = 0xB50400
                While 1
                    $colorpos = PixelSearch(0+5, 0+5, @DesktopWidth-5, @DesktopHeight-5, $color, 10, 1)
                    If IsArray($colorpos) Then
                        $drop = 20
                        $buttonposx = $pos[0] = $drop
                        $buttonposy = $pos[1]
                        MouseClick("Right", $buttonposx , $buttonposy, 1, 0)
                    EndIf
                WEnd
        EndIf
        If BitAND(GUICtrlRead($Checkbox_11), $GUI_CHECKED) = $GUI_CHECKED Then 
            While 1
                MouseClick("left", 802, 624)
                Sleep(2500)
                MouseClick("left", 505, 365)
                Sleep(500)
                MouseClick("left", 707, 496)
                Sleep(26500)
            Wend
        EndIf
    WEnd
EndFunc ;==>_Start
Func _GetPos ()
    Local $pos = MouseGetPos()
    MsgBox(0,'',$pos[0] & "<---X Coord | Y Coord --->" & $pos[1])
EndFunc ;==>_GetPos
Func _NoClick ()
    ToolTip("")
    $ClickIt = 0
EndFunc ;==>_NoClick
Func Terminate ()
    Exit
EndFunc ;==>Terminate

[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]

Share this post


Link to post
Share on other sites

Is there a difference? :P

Share this post


Link to post
Share on other sites

not much, his script opens firefox once and never opens it again.

Mine checks to see if firefox is running and opens it if its not currently running.


[font="Impact"] I always thought dogs laid eggs, and I learned something today. [/font]

Share this post


Link to post
Share on other sites

Your welcome BuddyBoy. :P

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