ZECK Posted December 7, 2010 Share Posted December 7, 2010 Hi! I made a circuit to control some relais with the parallel port, but I can't control relay correctly with autoit (it works only in batch (.BAT file)) If I write #Include <Constants.au3> Opt("TrayMenuMode", 1) $DLLFileAndPath = @ScriptDir & "/inpout32.dll"; remove the @ScriptDir & leading backslash if you prefer to keep the DLL in your system directory $PortAddress = "0x378"; the default LPT1 on most machines HotKeySet("{ESC}", "esci") While 1 DllCall($DLLFileAndPath, "int", "Out32", "int", $PortAddress, "int", "1000000") //---> I have only 7 relais (i don't know if it is correct) WEnd Func esci() DllCall($DLLFileAndPath, "int", "Out32", "int", $PortAddress, "int", "0000000") Exit EndFunc It works (It turn on the first relay), but If I try to turn on the fourth relay it turn on the first, the second and the fourth. The same happen when i try to turn on the fifth relay and with sixth too, but the other ones works! Thanks, ZECK P.S. Sorry for my English XDXDXD Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 7, 2010 Share Posted December 7, 2010 (edited) You might try it this way: $PortAddress = 0x378 DllCall($DLLFileAndPath, "int", "Out32", "short", $PortAddress, "short", 0x80) Note that actual hex numbers are used instead of strings. For example, 0x378 vice "0x378", and to set bit 7 you want 0x80 vice "10000000". And some Googling around seemed to show those were "short" (16-bit) parameters vice "int" (32-bit). Edited December 7, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
ZECK Posted December 7, 2010 Author Share Posted December 7, 2010 (edited) oooh!!! thanks !! I understand now, i tryed to put binary but it goes hex ahhahahah thank you! I wish you a Good Evening Edited December 7, 2010 by ZECK Link to comment Share on other sites More sharing options...
Ascend4nt Posted December 7, 2010 Share Posted December 7, 2010 You'll want to keep the DLL loaded while working will DLLCalls. I created a UDF based on Phillip Gibbons inpout* DLL+drivers. It includes byte, word, and dword output functions also.See my My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code) 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