Jump to content
sswcharlie

Multiple USB Devices - GUI

Recommended Posts

sswcharlie

For a model railway project only.  Using multiple  rfid readers. These readers have no PID or VID or serial numbers.
Only difference is the hub/port number allocated.

Using Win7  32 bit.

The only information I need to obtain from the HID devices is:

hub/port number
last string transmitted.  (14 character string of the rfid tag number)
timestamp of the latest reading.

The tag data will be moved to excel immediately after received by usb ready for the next read.  Timestamp and data would be overwritten by next set of data.

the GUI would have single line for each reader (by hub/port #) with 3 headings.  Timestamp, 14 character data, and hub/port # .

Is it possible for Autoitscript to have a GUI to do this ?

Thankyou

Charles Harris
 

Share this post


Link to post
Share on other sites
iamtheky

Where is this data being read to currently, Excel?


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
spudw2k

A listview control will suit your GUI needs nicely.    Interacting with the GUI will be the fun/challenge part. ;)
 

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>

Example()

Func Example()
    GUICreate("listview items", 300, 170, 100, 200, -1, $WS_EX_ACCEPTFILES)
    GUISetBkColor(0x00E0FFFF) ; will change background color

    Local $idListview = GUICtrlCreateListView("Timestamp|Data|Hub/Port#  ", 10, 10, 280, 150) ;,$LVS_SORTDESCENDING)
    Local $idItem1 = GUICtrlCreateListViewItem("Timestamp|0123456789ABCD|0/0", $idListview)

    GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
    WEnd
EndFunc   ;==>Example

You could also use an Edit control to create a console-like operation.
 

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>


GUICreate("listview items", 300, 170, 100, 200, -1, $WS_EX_ACCEPTFILES)
GUISetBkColor(0x00E0FFFF) ; will change background color

Local $idEdit = GUICtrlCreateEdit("Timestamp | RFID TAG Data | Hub/Port#" & @CRLF, 10, 10, 280, 150, BitOr($ES_READONLY, $WS_VSCROLL))

GUISetState(@SW_SHOW)
AdlibRegister("_UpdateConsole",1000)

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            AdlibUnRegister("_UpdateConsole")
            ExitLoop
    EndSwitch
WEnd

Func _UpdateConsole()
    _GUICtrlEdit_AppendText($idEdit, "Newest timestamp | 0123456789ABCD | 0/0" & @CRLF)
EndFunc

Depends on what you are looking for.  I assume you want a list of all of the RFID reader and the last TAG they read.  If that is the case I think a listview would work just fine.

Edited by spudw2k

Share this post


Link to post
Share on other sites
sswcharlie

Hi

Thanks for quick responses.

 

Yes, they currently read into Excel.    Can the list view be set up in Excel ?

Yes,    "a list of all of the RFID reader and the last TAG they read"   is correct.

 

I will use the code above and get it working and get back to the forum in a day or two and let you know how it goes.

 

Any thoughts of using Excel for the list view ?

 

Thanks

 

Charles

 

 

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

  • Similar Content

    • smud
      By smud
      Currently, I'm working on a program that will display Dialog boxes with either Yes or No.
      For each dialog, I reward the user with X amount of Credits.
      I'm hoping to output the amount of credits to a cell in a column (there will be 20 different columns).
      It will only post to a row that is equal to today's date (first column). If no row exists yet with the current date, it will start a new row.
      Any suggestions?
      Thank you
    • BigMac121263
      By BigMac121263
      I know that this theme was discussed several times but I read all These threats with no helping result.
      I have two pieces of TEMPer1F USB Thermometer.
      It is a Standard Windows HID device with no add. Driver needed.
      With the device I got an App reading from it and showing Graphs and much more and which can handle several devices.
      With the Software came also a RDingUSB.dll file handling the communication with the device.
      I can call the dll without any error. But the Problem is how to Access the device using the DLL and Access more than one of same VID/PID
      by Serial or anything else useful.
      I have also sources in c# doing the Job, but no experience in C# to successfuly port it to AutoIT.
       
      So my question: Can anyone help me to realize the simple pull of the temperature value from the devices based on C# source?
      The rest to write it to MySQL DB and repeat it etc. is no Problem for me.
      ***************************************
      The C# part with the DLL functions class:
      ***************************************
      using System;
      using System.Runtime.InteropServices;
      namespace TEMPer
      {
        internal class RDing
        {
          [DllImport("RDingUSB.dll")]
          public static extern IntPtr OpenUSBDevice(int VID, int PID);
          [DllImport("RDingUSB.dll")]
          public static extern IntPtr CloseUSBDevice(IntPtr hDevice);
          [DllImport("RDingUSB.dll")]
          public static extern bool WriteUSB(IntPtr hDevice, byte[] pBuffer, uint dwBytesToWrite, ref ulong lpNumberOfBytesWritten);
          [DllImport("RDingUSB.dll")]
          public static extern bool ReadUSB(IntPtr hDevice, byte[] pBuffer, uint dwBytesToRead, ref ulong lpNumberOfBytesRead);
          [DllImport("RDingUSB.dll")]
          public static extern ushort GetInputLength(IntPtr hDevice);
          [DllImport("RDingUSB.dll")]
          public static extern ushort GetOutputLength(IntPtr hDevice);
          [DllImport("RDingUSB.dll")]
          public static extern uint GetErrorMsg(ref string[] lpErrorMsg, uint dwErrorMsgSize);
        }
      }
      *********************************
      The C# code snippet working with the functions of the class above is in the attachment
      this is the interesting part where the data is sent and pulled which I
      do not understand to transcode to AutoIT
      Important my devices are the type2 (TEMPer1F) :
      *********************************
      So in the end I Need: Call DLL, read all devices in array
      Loop the Array until ubound(Array) and for each device in Array read the temperature value and prepare the data to
      decimal 6,1 (SQL Format) and °C
      So how to pull the value from the devices?
      Maybe somwbody finds the important part in the C#  (the code above is for different models, mine is TEMPer1F
      Or maybe someone has solved this and has maybe a uDF for this
       
       
      MainForm.cs
    • Jefrey
      By Jefrey
      Needed a way to store global temporary & permanent information and came up with this.
      This is inspired by NodeJS's store and store2 packages, as well as W3 specs' localStorage and sessionStorage, offering multiple ways of usage.
      This is not related to any browser's storage, nor will allow you to access or modify browsers storage - although this is possible and not a hard task, this is not what this UDF is intended to do.
      This UDF offers functions for temporary storage (that gets cleaned up once the application is shutdown) that is kept on memory using ScriptingDictionary, as well as for permanent storage, that is saved on the harddisk as an encrypted file.
      sessionStorage (temporary storage)
      It's useful to keep application state and temporary settings accessible by any part of your script (although it could also be done with a global variable, I still prefer this method).
      You have multiple ways, at your choice, to:
      ; add or modify a key sessionStorage("foo", "bar") store("foo", "bar") sessionStorage_set("foo", "bar") sessionStorage_setItem("foo", "bar") ; read a key (returns false if key does not exist) $read = sessionStorage("foo") $read = store("foo") $read = sessionStorage_get("foo") $read = sessionStorage_getItem("foo") ; delete a key sessionStorage_remove("foo") ; delete all keys sessionStorage_clear() sessionStorage_clearAll() localStorage (permanent storage)
      It's useful to store user-defined settings.
      ; initialize ; this is optional, but allows you to control ; how things are going to be saved localStorage_startup([file where you want the settings to be saved], [crypt password]) ; by default, if not supplied, if supplied the "Default" keyword (or if you dont initialize), ; the file will be a random-named file (based on @ScriptFullPath) at user's %APPDATA% ; and the password will also be based on @ScriptFullPath ; you can set only the crypt password if you want: ; localStorage_startup(Default, "mypassword") ; the usage is the same as sessionStorage ; add or modify a key localStorage("foo", "bar") store2("foo", "bar") ; notice the '2' localStorage_set("foo", "bar") localStorage_setItem("foo", "bar") ; read a key (returns false if key does not exist) $read = localStorage("foo") $read = store2("foo") $read = localStorage_get("foo") $read = localStorage_getItem("foo") ; delete a key localStorage_remove("foo") ; delete all keys localStorage_clear() localStorage_clearAll() Download
    • Shirdish_chakravarthi
      By Shirdish_chakravarthi

      in need the path/text present int above shown input box to be copied or retrieved into a variable .. how can i do that?
       
      Thanks
       
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good morning
      I'm working on a little project, and I was wondering if there's a way ( sure there is ) to insert data to a ComboBox control everytime the user insert some text in the ComboBox which is not in the ComboBox data. I'll try to explain with an example:
      - Form with some data ( ComboBox is empty );
      - User prompt something in the ComboBox: if what the user prompts is not in the ComboBox values ( at the moment empty ), then insert the value in the ComboBox values, in order to have, next time the user prompts the form, the value that he entered.
      More pratical example:
      - First call of the form, ComboBox empty;
      - I prompt "A" in the ComboBox;
      - Second call, in the ComboBox I should see "A";
      - I prompt "B" in the ComboBox;
      - Third call, I should see "A"
                                                 "B";
      - And so on...
      Everytime the form is called, I re-create it, so I think I can't use _GUICtrlComboBox_AddStrings().
      I tried with
      Global $strCboStrings = "" ; When the user prompt the form, the code below is executed. ; I.E. : User prompt "A", after the if I should have "A"; ; In the second call, If I write "B", I should see "A" ; "B"; ; If I write "A" again, in the combobox values should not be any changes. If Not StringInStr($strCboStrings, GUICtrlRead($cboVoiceCategory)) <> 0 Then $strCboStrings &= $strCboStrings & "|" & GUICtrlRead($cboVoiceCategory) EndIf Any suggestion?
      Thanks
×