beqa Posted July 9, 2014 Share Posted July 9, 2014 hello all. please help. i am trying to write a wrapper for nvda controller client in autoit. it is a first attempt of working with dlls within autoit, nad without success. so, i created one function which check if nvda is running, and then function with check if it is running display a msg. so, here is my code: if @OSArch = "X64" Then Local Const $nvdaControllerClient64 = DllOpen ("nvdaControllerClient64.dll") else Local Const $nvdaControllerClient32 = DllOpen ("nvdaControllerClient32.dll") endif Func IsRunning() if @OSArch = "X64" then Return DllCall($nvdaControllerClient64, "testIfRunning")[0] else Return DllCall($nvdaControllerClient32, "testIfRunning")[0] endif Return False EndFunc Func test() if IsRunning = True then msgbox(0, 'hi', 'hello') endif EndFunc and here is c# code for accessing this function: /* [comm_status][fault_status] error_status_t __stdcall nvdaController_testIfRunning(void); */ [DllImport("nvdaControllerClient32.dll", EntryPoint = "nvdaController_testIfRunning")] extern static uint nvdaController32_testIfRunning(); [DllImport("nvdaControllerClient64.dll", EntryPoint = "nvdaController_testIfRunning")] extern static uint nvdaController64_testIfRunning(); public static bool IsRunning() { if (Is64bit()) { return nvdaController64_testIfRunning() == 0; } return nvdaController32_testIfRunning() == 0; } thanks. Link to comment Share on other sites More sharing options...
beqa Posted July 10, 2014 Author Share Posted July 10, 2014 hello, are there someone? Link to comment Share on other sites More sharing options...
beqa Posted July 11, 2014 Author Share Posted July 11, 2014 hello. i've researched more about dllCalls in autoit and here is again non working script. if @OSArch = "X64" Then Local Const $nvdaControllerClient64 = DllOpen ("nvdaControllerClient64.dll") else Local Const $nvdaControllerClient32 = DllOpen ("nvdaControllerClient32.dll") endif test() Func IsRunning() if @OSArch = "X64" then Return DllCall($nvdaControllerClient64, "VOID", "testIfRunning", 0) else Return DllCall($nvdaControllerClient32, "VOID", "testIfRunning", 0) endif Return False EndFunc Func test() if IsRunning() then msgbox(0, 'nvda is running', 'success') endif EndFunc so, first param is dll which should be opened, there return type, which is Void, then function testIfRunning and then what it should return there is 0 however, when i am running script it doesn't display a messageBox. please help me what i am doing wrong. Link to comment Share on other sites More sharing options...
BrewManNH Posted July 11, 2014 Share Posted July 11, 2014 There is no VOID return type in DLLCall, use NONE as the help file says. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
beqa Posted July 11, 2014 Author Share Posted July 11, 2014 ok, i changed without any success. Link to comment Share on other sites More sharing options...
BrewManNH Posted July 11, 2014 Share Posted July 11, 2014 What type is type 0? Read the help file, I don't do much with DLLCall, but even I can see your parameters are wrong. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
beqa Posted July 11, 2014 Author Share Posted July 11, 2014 i really can't understand how it should be written in autoit. so, dllcall("dll", "NONE", "testIfrunning", this is a function which must return 0 on success Link to comment Share on other sites More sharing options...
beqa Posted July 11, 2014 Author Share Posted July 11, 2014 ok, maybe this is correct. if @OSArch = "X64" Then Local Const $nvdaControllerClient64 = DllOpen ("nvdaControllerClient64.dll") else Local Const $nvdaControllerClient32 = DllOpen ("nvdaControllerClient32.dll") endif test() Func IsRunning() if @OSArch = "X64" then Return DllCall($nvdaControllerClient64, "NONE", "testIfRunning") else Return DllCall($nvdaControllerClient32, "NONE", "testIfRunning") endif Return False EndFunc Func test() if IsRunning() then msgbox(0, 'nvda is running', 'success') endif EndFunc but how to check if it returns 0, this means that nvda is running, display a msgbox. Link to comment Share on other sites More sharing options...
beqa Posted August 3, 2014 Author Share Posted August 3, 2014 hi, is someone here who can help? Link to comment Share on other sites More sharing options...
Tekk Posted August 3, 2014 Share Posted August 3, 2014 (edited) I don't have the library to play with but I believe this is correct. Func nvdaController_testIfRunning() Local $aResult If (@OSArch == "X64") Then $aResult = DllCall("nvdaControllerClient64.dll", "UINT", "nvdaController_testIfRunning") Else $aResult = DllCall("nvdaControllerClient32.dll", "UINT", "nvdaController_testIfRunning") EndIf If (@error <> 0) Then Return SetError(@error, @extended, 0); Return ($aResult[0] = 0) EndFunc Edited August 3, 2014 by Tekk Link to comment Share on other sites More sharing options...
junkew Posted August 4, 2014 Share Posted August 4, 2014 Why do you want to control NVDA from AutoIT? AutoIT can do most things like recognizing controls. All it cannot do is automatic speach synthesis. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now