Jump to content

Open file command?


Skyclaw
 Share

Recommended Posts

I'm abit new here, so hello everyone :o

I'm new to autoit aswell, so I'd like to know if there's any command that opens a file. I looked in the help file but I didn't find any answers.

Would be glad to get help : )

Ciao

Oh and I'm sorry if this have been posted before.

Edited by Skyclaw
Link to comment
Share on other sites

What did you look for in the helpfile? Did you use the search function in the helpfile?

There are definitely functions to open files, you just must not have been looking for the right thing.

The function you're looking for is FileOpen.

I found FileOpen but what i could read it said "Opens a text file for reading or writing." I dont want to open a text file, I want to open a .exe file.

Thanks for the fast answer btw

Ciao

Link to comment
Share on other sites

  • Moderators

Dayum... looks like it can drive itself to where ever you need to do... the Knight Industries Two Thousand (for those that are at least as old as me) of the mouse world!!

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.

Link to comment
Share on other sites

I'm working on it...

I looked up some stuff on msdn.microsoft.com, and found some things, but not exactly what you're looking for.

The following table shows the symbolic constant names, hexadecimal values, and mouse or keyboard equivalents for the virtual-key codes used by the system. The codes are listed in numeric order.

Constants

VK_LBUTTON (01)

Left mouse button

VK_RBUTTON (02)

Right mouse button

VK_CANCEL (03)

Control-break processing

VK_MBUTTON (04)

Middle mouse button (three-button mouse)

VK_XBUTTON1 (05)

Windows 2000/XP: X1 mouse button

VK_XBUTTON2 (06)

Windows 2000/XP: X2 mouse button

- (07)

Undefined

VK_BACK (08)

BACKSPACE key

VK_TAB (09)

TAB key

....

That's a table of virtual key codes, of which primary, secondary, and mousewheel are a part (and I'm guess mouse x1 and x2 are your fourth and fifth buttons...?). So, I want you to try this:

#include <misc.au3>
HotKeySet ("{ESC}", "quitme")
While 1
    For $i = 1 To 255
        If _IsPressed (Hex ($i)) Then
            MsgBox (0, "pressed", $i & @CRLF & Hex ($i, 2))
        EndIf
    Next
    Sleep (100)
WEnd

Func quitme()
    Exit
EndFunc

You need beta for that. But once you can test it, click each of the buttons and tell me what (if anything) shows up in the msgbox when you click them.

Link to comment
Share on other sites

greenmachine,

Great code...

Hmm, it's hard to tell if that's a compliment or a sarcastic statement... it was something I threw together a while back because I needed to test something (or give it to someone else to test something). It gets the job done, but (as Larry said when I posted it) it's not the most efficient way.

Link to comment
Share on other sites

#include <misc.au3>
HotKeySet ("{ESC}", "quitme")
While 1
    For $i = 1 To 255
        If _IsPressed (Hex ($i)) Then
            MsgBox (0, "pressed", $i & @CRLF & Hex ($i, 2))
        EndIf
    Next
    Sleep (100)
WEnd

Func quitme()
    Exit
EndFunc

Sorry, I'm abit newb on autoit but what is supposed to happen when using this script?

Skyclaw,

Read thru these:

http://www.autoitscript.com/forum/index.ph...ghlite=%2Bmouse

I don't think that there is a native function for that at this time...

greenmachine,

Great code...

Dont seems like it :o

Link to comment
Share on other sites

Like the function says, it tests which keys are pressed.

_IsPressed is a beta function that takes in a hex value of a key (such as those found in the quote from msdn), checks the function GetAsyncKeyState in the dll user32.dll to see whether the given key is being pressed (1) or not (0). If it is pressed, the msgbox will display which number $i was on, and the hex value of $i. This helps for testing purposes (among other things).

Press ESC to exit the script.

Link to comment
Share on other sites

mabbe you should explain clearer, greenmachine.

The code which he provided does this:

When you press a button (keyboard or mouse or whatever), it pops up a message box containing the keycode of that button.

Useful for finding the keycode of a button then putting it into Send or _IsPressed or Whatever.

Link to comment
Share on other sites

...compliment or a sarcastic statement...

It was/is a compliment.

I knew that this idea was posted to the idea lab.

I created a search link for the OP.

I posted it... then I saw your post ahead of mine.

I edited my post to put less emphasis on my link as it would not lead the OP to any code better than the route that you are taking... at least not that I saw. (and I know that the idea lab is not the ideal place to look for code - but I remembered some work arounds in those posts)

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

It was/is a compliment.

I knew that this idea was posted to the idea lab.

I created a search link for the OP.

I posted it... then I saw your post ahead of mine.

I edited my post to put less emphasis on my link as it would not lead the OP to any code better than the route that you are taking... at least not that I saw. (and I know that the idea lab is not the ideal place to look for code - but I remembered some work arounds in those posts)

Ok, I see. Thanks for the compliment (in that case). It's just too hard to tell with text....

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...