
mrtweaver
Active Members-
Posts
35 -
Joined
-
Last visited
Content Type
Forums
Downloads
Forum Articles
Events
Everything posted by mrtweaver
-
Ok so i am using ExcelCOM_UDF.au3, which by the way is very nice UDF for excel. However I must be missing a step or something and was hoping that someone on here could lend a hand. I am using the following code in my program: _ExcelCellColorSet($oExcelDoc, "c4", 4, 4,4, 22) And here is what is written inside the UDF ;=============================================================================== ; ; Description: Set the cell interior color value of a range in an Excel object. ; Syntax: _ExcelCellColorSet($oExcel, $sRangeOrRowStart, $iColStart = 1, $iRowEnd = 1, $iColEnd = 1, _ ; $iColorIndex = 1, $hColor = 0x000000) ; Parameter(s): $oExcel - An Excel object opened by a preceding call to _ExcelBookOpen() or _ExcelBookNew() ; $sRangeOrRowStart - Either an A1 range, or an integer row number to start from if using R1C1 ; $iColStart - The starting column for the number format(left) (default=1) ; $iRowEnd - The ending row for the number format (bottom) (default=1) ; $iColEnd - The ending column for the number format (right) (default=1) ; $iColorIndex - The interior color index (default = 1, if > 254 then $hColor is used instead) ; $hColor - Hex value of color used when colorindex > 254 ; Requirement(s): None ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 and sets @error on errors: ; @error=1 - Specified object does not exist ; @error=2 - Starting row or column invalid ; @extended=0 - Starting row invalid ; @extended=1 - Starting column invalid ; @error=3 - Ending row or column invalid ; @extended=0 - Ending row invalid ; @extended=1 - Ending column invalid ; Author(s): SEO <locodarwin at yahoo dot com> ; Note(s): None ; ;=============================================================================== What i would like to do is to be able to take the same row in three different columns and change it to the same color. So like A4, B4, C4 or such. But not matter what i have tried I can only get 1 row and 1 column at a time to change color. SO what did i miss? What needs to be changed so that it would say start at A4 and go to C4? I have tried to adjust the number and no matter what numbers i change there does not seem to be any change on my screen. Thanks for your time and patience. Martin
-
HHmm I take it no further information on this topic?
-
Yes they actually have a very nice little viewer that is in their sample code that they supply. Just not sure how to get it into the GUI with autoit and if it is even possible to do so.
-
Ok let me start with the obvious, i am very much a beginner at just about any programming language. Be it .NET, VB, Python, Autoit, whatever So what i am doing is reaching out to community here to find out if this is even remotely possible. I am thinking not, but figured why not ask those who know much more than i do and see if this can be done or if i am just peeing up the proverbial rope. So off of ebay i purchased a DM200 vision camera which attaches to my PC via ethernet. And i have a small gui app that i have written. well out of the camera you can request via .NET the live image that is being seen by the camera, i want to be able to incorporate this live image into my autoit gui, Here is the link to the SDK for the camera https://support.cognex.com/en/downloads/detail/dataman/2628/1033 The file name for the SDK is DataMan DMCC.NET SDK v5.0.8.0 DataMan DMCC.NET SDK v5.6 Either one should have the same connection capabilities according to cognex So could someone tell me please if it is even possible and to help me along i would greatly appreciate it Thank you for your time and patience. Regards Martin
-
Good wed morning. Let me first say that i am fairly new to autoit so maybe this has already been answered, Anyway myself and another guy have taken and written a nice application, and it works quite well. What the application does is it uses a imager which takes a picture and decodes an IMB barcode then it checks the quality of the code and then the validity of the code before sorting it. All of that works quite well. The thing is we recently acquired a different manufacturer of imagers, got them for a bargain off ebay. And the new imagers have a live image that is possible to obtain, but it is only possible thru their SDK. Is it possible, using autoit, to access these features of the SDK so that say $pic1 would be tied to the live image and as the live image updated so would the image in the application? If so what would be the recommended ways? Looking for ideas to hopefully make a solution. By the way the imager is a Cognex and the SDK is avail free for download from http://www.cognex.com/Support/DataMan/Software.aspx The version that is most compatible with the imagers is the 5.5version Im assuming from what i have read it has something to do with COM but do not have enough understanding Thank you for any and all feedback and support you can provide.
-
Ok here is what i am attempting to do. I want to take the table phase3, read into an array any value from the column stored where the value complete = 0, then using this array write another Sql code where it will located in phase3 the stored number where it is equal to the first array then it will do something, then equal to the second array and do something, then equal to the third array and do something, and so on until the array has complete running. This is the code that i have written so far. Func Appendtrayinfo() $aOk = _EzMySql_GetTable2d("SELECT stored FROM phase3 WHERE complete = 0;") $error=@error If Not IsArray($aOk) Then MsgBox(0, $sMySqlStatement & " error", $error) ;_ArrayDisplay($aOk, "2d Array Names of certain eyecolour") For $i = 1 To _EzMySql_Rows() step 1 ConsoleWrite(" ID = " & $aOk[$i][0] & @CRLF) $id = $aOk[$i][0] runquery($id) Next ;ConsoleWrite("Tray = " & $tray & " Pallet = " & $pal & @CRLF) Exit EndFunc Func runquery($id) Local $sSql= "select a.stored, a.linking, b.trayact,b.traytype, IFNULL(b.pallet,a.backed) from ezmysqltest.phase3 a join ezmysqltest.cqt b on a.linking = b.trayid where a.stored = " & $id IF NOT _EzMySql_Query ($sSql & ";") Then $error = _EzMySql_ErrMsg() AddAppLogEntry(" Database Error Occurred " & $error ,"0xFFFF00") Else $aok = _EzMySql_FetchData() $tray = $aok[2] $ttype = $aok[3] $pal= $aok[4] ConsoleWrite("Tray = " & $tray & " Pallet = " & $pal & @CRLF) ;Sleep(1000) EndIf EndFunc The problem seems to be when i run the second query the one inside the function runquery it interferes with the query that created the array because when i add in the call to the function runquery it will run thru the look 1 time then come back with an array out of bounds type error. I thought maybe be seperating it and using the word local it would not interfere. So what part of the code do i have that is incorrect? I did initially try to do the query and the updates on phase3 from just a single query but it would take like 18 min or so to run and that is unacceptable. So in a nut shell i will have two tables, the first table is Phase3 in that table i will have two values they are stored and linking, stored is the key index field. Then i have another table called csm that contains linking, trayid, pallet, and traytype. I want to update the blank fields tray and pallet located in phase3 with the values from csm. The initial query i wrote was: Update phase3 as a join csm as b on a.linking = b.linking set a.tray=b.tray, a.pallet=b.pallet where complete = 0; But like i said to run this query took like 18 min so was trying to break it down by first loading the stored numbers where complete = 0 into an array then since this column is key index then run my query against it using the array values and update accordingly. With out the additional SQL query in the runquery if i write to console it does what it is suppose to. Its only when i add in the additonal query i get the array out of bounds error. Hope this is clear and someone can help. Thanks and have a great day.
-
There is a posting on here that i made where one can download my code that i am currently using, so i am not going to repost it. But i do have a question, i have the PC connected to that Arduino, and well out on the production floor where some of the units are, there is a chance, and it has happened where people have tripped over the USB cables that connect the Arduino to the PC, in some cases they also like to be trouble makers and disconnect the plug. If we catch them they get written up. Anyway my question of the day is as follows, is there an easy way using COMMMG and ARDUINO includes, that one can keep an eye on the port and if the communication stops have the application do some event? I have tried doing it with COMGETPORTS and COMPORTCONNECTION, and while both ways that i have come up with will detect when the USB Arduino is connected, it will not detect when the cable is unplugged. It seems once you use the connecta command in the Arduino include it does not release the port. But I could be wrong in my guessing. Still rather new to the programming. Any script help greatly appreciated.
-
Ok i needed to refresh this since the problem has cropped up again. The error is very random. Sometimes the application we have been writing which is shown above works fine for days or even weeks, and sometimes it is only hours. We have this application on 4 PC's and as stated the error just crops up and shows up for no known reason. When it does show up here are the symptoms: It will shut down the script that is running. When you try to reopen the script it will come up with the error message 'Can not open closed port'. And if you are running the script from inside the editor, when it run the COMMMG one of the first things that it does is does a write to console of available ports. When it shows COM3 it has shown after it -64 I have been trying to recreate this error on my work bench. If on the work bench i just unplug the arduino the error code is -16, but here as i stated the error code is -64 and i have no idea exactly what this means. So does anyone here on this site know exactly what the -64 commmg error means? As was stated earlier we now know of two ways to clear this problem, the first is if you go into Control panel, go under device manager, and in device manager take COM3 disable it and then re-enable it. The second way is to unplug the USB wire between the PC and Arduino and then plug it back in. Either one of these will reset the error and will allow things to work again. As to the previous posters idea, we did take and hard code the com port into each application just to see if that would work, the com port and speed and such are currently not variables, but the problem still persist and is very random.
-
Oh and you are right in that the arduino is on com3
-
What is unique about this error is that everything will be working fine, the application written in autoit has already connected to the arduino it has been running and talking to one another. Life is happy. Then all of a sudden the autoit application pops up with the usual Unexpected error has occured autoit will now close. So you press OK to close the application. Then when you attempt to reopen the application that is when you get the -64 error. So from what you are telling me something has shut down the port or has caused communcations to cease between the two devices (the PC and arduino) Kind of like unplugging the arduino. Is that what i am understanding? I know from talking with out IT dept they checked the event viewer and services and such of the PC and there was no error, so to me that seems to indicate that if something did drop the connection if was the arduino. But alas have to find out what is causing things and why.
-
Here is my script as it stands. I have been looking for the commg error codes but have not been having much success. As i have said here is what happens. If I run this script from autoit console and every thing is working correctly when it comes to opening the com port it first does a console write and list the avail com ports. And it list them as COM1 : COM3 Now if i run this script in the console and the com3 is not working properly then when it writes to the console and list the com port it looks like COM1 ; COM3 -64 And autoit displays the message 'CAN NOT OPEN CLOSED PORT' and it crashes. The two ways that i have found to fix this is either reboot the PC which of course takes to much time, or i go into device manager and i disable the re-enable COM3. As I have said i dont know what that -64 means and dont know what the error means that says can not open closed port. Sorry for the delay just have been busy doing more debugging and such. camera test 5 ver 4.au3
-
A coworker and i have been developing an application which communicates with and transfers data back and forth between an ardunio and a PC. For the most part it works fine. However at times it seems to drop the communications link. Not sure why. Here is what i see. Currently the application is uncompiled so we run it from autoit itself. We did this till we get it completely debugged. So when you run it and everything is working properly in the status window it will show COM1 and COM3 which is what it should show. But when the link goes down the application crashes and closes. And when you go to reopen the application It still shows COM1 and COM3 but after COM3 it shows -64 and then comes up with an error message about not being able to open a closed port. Does any of this make any sense? If so what could be causing this? In order to usually fix this you either need to reboot the PC or go into device manager disable COM3 then re-enable COM3 Thank you for taking the time to read this and respond.
-
Ok i know this thread is a bit old, 2013 to be exact but am hoping that one can direct me as to what i am doing wrong. I followed the link above, downloaded the file, put the arduino.au3 and comm files in the include folder of autoit. I then went and opened the arduino file in the associated software and loaded it onto the arduino. I opened the first file in autoit, blink, and changed the com port from 3 to 4 since my USB is on 4 Ran the file, nothing happened the only thing that happened was in the console of autoit i received the number 02 Other than that nothing. So what step did i miss?
-
Ok here is my question and i hope it is clear. I have been writing an application, one of the features is to take a text file, pull out the data i require, and put it in a SQL table Now the thing is these text files can vary in size from 40000 up to 8 million records. Right now due to the limitations of 5000 characters i have my write to SQL broken down where it writes 120 records per execution, however this slows down as the file size grows, when you get to 1.5 million records lets just say that takes about 15 min. So in a nutshell here is what i have: $one = (i, array[0]. array[1]) , (i +1, array[i+1][0], array[i+1][1]........ up to 59 $two = same as above but 60 through 119 $limit = ubound($array) for i = 0 to $limit step 120 Then in the SQL statement i just add the two like SQL_Query(insert into table (num, stored, linking) values $one, $two I am sorry this is not the actual code but i do hope it gives you an idea of what i am doing. I am hoping someone here might have a better or faster approach to dump an array down to an SQL table.
-
Ok in the GUI Section per the one post i found here on the form i added in the OPT('GuiOnEventMode',1) GuiOnEvent($Gui_Event_Close,"terminate") Now if I am right when i click on the windows close button it will now run the programs terminate function. In the terminate function I have some write to INI sections followed by closing the TCP port. When i execute this it always comes back with the error message that Operation is not allowed when object is closed. What object is not allowed? Is it the INI file writes or what?
-
I can use the following python code to control a USB relay module, i am trying to figure out which UDFs i would need in my include to do the same in autoit import serialimport time fd=serial.Serial("COM3",9600)time.sleep(1)fd.write('x50')time.sleep(0.5)fd.write('x51') def relay_1(): fd.write('x00') time.sleep(1)fd.write('x01') if __name__ == "__main__":relay_1()
-
List Box and MS SQL questions
mrtweaver replied to mrtweaver's topic in AutoIt General Help and Support
I would like to refresh this because i have a new question concerning Autoit and SQL. In this case Microsoft SQL Ok lets take the above example given by mLipok Lets say i do the following: $query = " update phase1 set stored = 1 ....." If _SQL_EXEC(-1,$query)= $SQL_ERROR then .... My question is what compromises an SQL Error? I mean lets say you send the command to a closed SQL link, that most likely would cause this error to be true. But lets say you send a select or an update or a insert, and the insert turns to be false, would that set the error to a true? For example if the end of the query was WHERE STORED = 12345 and no where in the database does stored = 12345, would this throw the SQL Error or is there a better way to test for a query that was not able to be executed? Hope this is clear, thanks for the feedback and have a great day -
Strip Spaces over certain limit
mrtweaver replied to mrtweaver's topic in AutoIt General Help and Support
I am fairly new to this Autoit so i am looking for some help and guidance on how to get started on the following. I know what i want to do but just can not figure out how to do it. I have this file which is created by the USPS, it has variable amounts of padded spaces, for example it might have 7 spaces between the first and second columns, 21 spaces between the second and third, 16 spaces between the third and fourth. etc... Originally i had thought of using the stringstripwc with a value of 3 to strip all spaces over 2 characters, however with two of the files this will not work as they usually pad certain areas with anywhere between 2 to 4 spaces. So I am wondering is how it would be done within autoit that 5 spaces and over would be replaced with a certain character, anything under that amount would be left alone, then i could use that character as a column delimiter in my array. Any help or guidance greatly appreciated. -
I am fairly new to this Autoit so i am looking for some help and guidance on how to get started on the following. I know what i want to do but just can not figure out how to do it. I have this file which is created by the USPS, it has variable amounts of padded spaces, for example it might have 7 spaces between the first and second columns, 21 spaces between the second and third, 16 spaces between the third and fourth. etc... Originally i had thought of using the stringstripwc with a value of 3 to strip all spaces over 2 characters, however with two of the files this will not work as they usually pad certain areas with anywhere between 2 to 4 spaces. So I am wondering is how it would be done within autoit that 5 spaces and over would be replaced with a certain character, anything under that amount would be left alone, then i could use that character as a column delimiter in my array. Any help or guidance greatly appreciated.
-
List Box and MS SQL questions
mrtweaver replied to mrtweaver's topic in AutoIt General Help and Support
Using GuiCtrlCreateList to create the box then populating data inside the box as events occur -
List Box and MS SQL questions
mrtweaver replied to mrtweaver's topic in AutoIt General Help and Support
mLipok can you possibly supply an example of how to use the UDF? I mean i know how to write the command when using something like the GUI front end for MS SQL and i could probably put that command into a Autoit line but what parameter is returned when using it? Would you use something like $aVal = _SQL_Exec(Update phase1 set success =1 output insertered.trayID where stored = $recv) granted i dont have all the quotes and such on it but would this return the value to $aVal or would i put the returned value in the line such as: _SQL_Exec(Update phase1 set success =1 output insertered.trayID where stored = $recv, $aVal) Just not sure how it would function so hoping you can answer that. And since it has not been addressed i am assuming that doing colored text in the list box is not an option? -
List Box and MS SQL questions
mrtweaver replied to mrtweaver's topic in AutoIt General Help and Support
mLipok is the udf you are using written for MySql, Microsoft Sql, SQLite, or generic and will do any? Right now i just have a demo code where i am attempting both a read and a write to a MySQL database. I know in MS SQL I can do the read and write in one command using the output inserted command in SQL. I am not sure if this command is avail for use in AutoIt. The reason being was i am not a database guru so i am not sure if doing a read and write seperately will take more time than if done at same time. The application i am writing has to be very fast fastest through put right now would be around 4 a second so each time the camera read it will send the data via tcp over to the application the application will compare it with the database if it is in the database it will check off the success value by changing it to a 1 and it will retrieve the value in trayID. Now I am sure each command in autoit takes time but in my demo program all i am doing is opening up the database, logging in, setting the instance, then reading and writing from same table, same row. According to autoit when it is done executing since i have it write things to the console it take 1.32 seconds approx If i just do a read or a write it takes 1.1 to 1.2 so the difference seems to be negligable So for now till i have a chance to run the appication tomorrow i wont know if it will be fast enough. So now on with the other part of the question and that would be having colored text inthe list box -
List Box and MS SQL questions
mrtweaver replied to mrtweaver's topic in AutoIt General Help and Support
Ok so what am i doing wrong with my select statement here is what i have: $sVal = '...........' $nSql = ('SELECT num from phase1 where stored = '" & $sVal &"' ;") $nData= _EzMySql_Exec($nSql) msgbox (0, "data", $nData) It constantly shows 1 Have also tried changing the $nSql to this: $nSql = _EzMySql_Query(.....) msgbox (0,"data", $nSql) Figured i would get the select query working before adding in the START TRANSACTION and COMMIT functions: I can easily get the update to work but the select so far has not been working well. -
List Box and MS SQL questions
mrtweaver replied to mrtweaver's topic in AutoIt General Help and Support
Ok here is where i am currently at in development of my application. First we have the camera which takes the pic and decodes the IMB barcode, it then passes this barcode out via tcp. Average time is 3 to 4 pieces per second, which translates to 250mS top speed as things are. The software will then receive this and will compare it to a database, this database can range in size from 25000 up to 2000000 records, each record will contain the IMB barcode as well as the success column and trayid column. So the camera takes the pic sends over the data the software will validate that that code is in the database which of course means that piece belongs, then it will show what tray that piece belongs in on the gui. eventually it will control a usb relay but that is farther away at this time. So that would mean if i do seperate write then read that would be 8 transacts per second. will the database be able to keep up? Unsure but just to make sure if i can i would rather do it in 4 transacts. So if i am understanding what you are saying then using that begin with the two commands such as you listed it will run both almost the same as 1? If so i might do it that way. So i would take what you wrote above and just put that in and _Exec? Or how would i code that in autoit? -
On my gui i have a list box, when something occurs in the project a message will appear, what i am wondering is if i can have like error messages appear in red text and general messages in black text and good connect messages appear in green text. Will the gui font color do this or is this not able to be done in a list box? Second part contains question concerning using MS SQL Express and Autoit. I know that MySql does not have the command output inserted. You see i want to run a query that not only updates a column in a table but also returns a value from that row. The following command if ran in MS SQL will update a column in a table and then return the value from trayID in that row Update phase1 set success = 1 output inserted.trayID where stored = 12345 So in the row that equals 12345 it will update success to 1 and return the value in trayID. I know from posting on MySQL forum that this is not a feature in that product. I do know this works on MS Sql but am unsure if the UDF will support this command when working with MS SQL If not then i will have to have two seperate transacts one to update the success column and one to return the value from trayID. So anyone out there have much success working with MS SQL and Autoit?