Jump to content

Windows 7 and commMG?


jimg
 Share

Recommended Posts

I haven't used commMG for awhile. When I run the snippet shown, I get the dreaded "This program has stopped running" popup from Windows 7 which offers to look online for a solution (which it doesn't find).

I'm running the very latest AutoIt3 and commMG (updated just before posting this message).

The failure occurs immediately upon executing the _CommGetLine instruction (as opposed to waiting until the timeout passes).

--------------------------

#include <GUIConstants.au3>

#include <CommMG.au3>

#include <GuiEdit.au3>

#include <GuiComboBox.au3>

Opt("WinTitleMatchMode", 2)

$value = "COM4"

;$value=inputbox("RFID","Comm Port?")

$result=""

$port = _CommSetport($value,$result,9600,8,0,1,0)

$Main1 = GUICreate("8086 SDK Board Programmer", 400, 400)

$listIN = GUICtrlCreateList("", 25, 50, 250, 250)

$txtOut = GUICtrlCreateInput("", 25, 315, 200, 25)

$btnSend = GUICtrlCreateButton("Send", 225, 315, 50, 25)

$lblBaud = GUICtrlCreateLabel("", 75, 10, 50, 25)

$lblPort = GUICtrlCreateLabel("", 25, 10, 50, 25)

GUISetState(@SW_SHOW, $Main1)

Sleep(50)

$instr = _CommGetline(@CR, 200, 2000)

msgbox(0,"",@error)

_CommClosePort()

-----------------------------

Link to comment
Share on other sites

I haven't used commMG for awhile. When I run the snippet shown, I get the dreaded "This program has stopped running" popup from Windows 7 which offers to look online for a solution (which it doesn't find).

I'm running the very latest AutoIt3 and commMG (updated just before posting this message).

The failure occurs immediately upon executing the _CommGetLine instruction (as opposed to waiting until the timeout passes).

--------------------------

#include <GUIConstants.au3>

#include <CommMG.au3>

#include <GuiEdit.au3>

#include <GuiComboBox.au3>

Opt("WinTitleMatchMode", 2)

$value = "COM4"

;$value=inputbox("RFID","Comm Port?")

$result=""

$port = _CommSetport($value,$result,9600,8,0,1,0)

$Main1 = GUICreate("8086 SDK Board Programmer", 400, 400)

$listIN = GUICtrlCreateList("", 25, 50, 250, 250)

$txtOut = GUICtrlCreateInput("", 25, 315, 200, 25)

$btnSend = GUICtrlCreateButton("Send", 225, 315, 50, 25)

$lblBaud = GUICtrlCreateLabel("", 75, 10, 50, 25)

$lblPort = GUICtrlCreateLabel("", 25, 10, 50, 25)

GUISetState(@SW_SHOW, $Main1)

Sleep(50)

$instr = _CommGetline(@CR, 200, 2000)

msgbox(0,"",@error)

_CommClosePort()

-----------------------------

The port parameter in _CommSetport is an integer not a string. (Read the comments fo rthe function in the UDF)

For COM4 use

_CommSetport(4,....

and not

_CommSetport("COM4",...

That might be all that is wrong.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Good catch, but drat. I made that change and it still fails the same way (with or without quotes on the 4).

--------------------------

#include <GUIConstants.au3>

#include <CommMG.au3>

#include <GuiEdit.au3>

#include <GuiComboBox.au3>

Opt("WinTitleMatchMode", 2)

$result=""

$port = _CommSetport(4,$result,9600,8,0,1,0)

$Main1 = GUICreate("8086 SDK Board Programmer", 400, 400)

$listIN = GUICtrlCreateList("", 25, 50, 250, 250)

$txtOut = GUICtrlCreateInput("", 25, 315, 200, 25)

$btnSend = GUICtrlCreateButton("Send", 225, 315, 50, 25)

$lblBaud = GUICtrlCreateLabel("", 75, 10, 50, 25)

$lblPort = GUICtrlCreateLabel("", 25, 10, 50, 25)

GUISetState(@SW_SHOW, $Main1)

Sleep(50)

$instr = _CommGetline(@CR, 200, 2000)

msgbox(0,"",@error)

_CommClosePort()

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