Does anyone knows why this command doesn't work?
Run(@ComSpec & " /c " & "devcon.exe hwids * | findstr /R ""1050&PID_0114&REV_0340&MI_01"" || (rundll32.exe user32.dll, LockWorkStation)", "", "") This is the command in commandline:
devcon.exe hwids * | findstr /R "1050&PID_0114&REV_0340&MI_01" && (echo USB Device is connected) || (rundll32.exe user32.dll, LockWorkStation) This works, but i want to convert this to AutoIT, but it doesn't work.
In short what i am trying to accomplish is that a script checks every 1 sec. if there is an USB device plugged in and if not ( so it is removed ) it will lock Windows OS.
Can someone help me with this?
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.
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:
internal class RDing
public static extern IntPtr OpenUSBDevice(int VID, int PID);
public static extern IntPtr CloseUSBDevice(IntPtr hDevice);
public static extern bool WriteUSB(IntPtr hDevice, byte pBuffer, uint dwBytesToWrite, ref ulong lpNumberOfBytesWritten);
public static extern bool ReadUSB(IntPtr hDevice, byte pBuffer, uint dwBytesToRead, ref ulong lpNumberOfBytesRead);
public static extern ushort GetInputLength(IntPtr hDevice);
public static extern ushort GetOutputLength(IntPtr hDevice);
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
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
in need the path/text present int above shown input box to be copied or retrieved into a variable .. how can i do that?