Sign in to follow this  
Followers 0
Noviceatthis

DllCall confusion

10 posts in this topic

Hello all,

$open = DllOpen("Shell32.dll")
DllCall($open , "int" , "ShellExecuteW" , _
        "HWND" , "NONE" , _
        "wstr" , "open", _
        "wstr" , *filepath* , _
        "wstr" , "NONE" , _
        "wstr" , "NONE" , _
        "int" , "1")
DllClose($open)

So I've been tinkering with the code above, and for the most part it works, however, when the filepath leads to an au3 script, it doesnt run the script, it instead opens it in scite editor. Of course when I compile the script this is no longer a problem. 

I was just wondering why this happens when the script is not compiled.

Thanks in advance

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

It's because when you ran the SciTE installer you set it to edit scripts instead of run them. :)

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

You can modify that here:

C:Program Files (x86)AutoIt3SciTESciTEConfigSciteConfig.exe


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

@MikahS & @jdelaney

Thanks for the speedy replies

Yeah, thats what I thought, but the default action for .au3 files under Scite config is set to Run :

Edited by Noviceatthis

Share this post


Link to post
Share on other sites

Thanks JohnOne, i will look into it

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Use this:

Global $open = DllOpen("Shell32.dll")
DllCall($open , "int" , "ShellExecuteW" , _
        "HWND" , 0, _
        "ptr" , 0, _    ;use default verb
        "wstr" , "Test.au3" , _
        "ptr" , 0, _
        "ptr" , 0, _
        "int" , 1)
DllClose($open)
Edit: Or this:

Global $open = DllOpen("Shell32.dll")
DllCall($open , "int" , "ShellExecuteW" , _
        "HWND" , 0 , _
        "wstr" , "Run", _
        "wstr" , "Test.au3" , _
        "ptr" , 0, _
        "ptr" , 0, _
        "int" , 1)
DllClose($open)
Edited by funkey

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites

Thank you funkey, works perfectly

Share this post


Link to post
Share on other sites

Thank you funkey, works perfectly

You are welcome, but why not use inbuild ShellExecute() function?

1 person likes this

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites

@funkey

Well I was just practising the DllCall function, still trying to get to grips with these Dll functions.

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