Sign in to follow this  
Followers 0
rharwood

Can this be done,Difficulty level??

5 posts in this topic

Hey all, this probably can be done but, I guess the better question is how hard will it be to accomplish.

I have a excel spread sheet that contains 3 fields a text description a second text field and a numeric address and a blank field

that is usually filled with a check mark when the record is confirmed.

I am also parsing a serial data port that will send in a stream that contains the same type of information.

What I am looking to do is parse this serial stream and if the data matches or contains the numeric address, update

the excel spread sheet with a confirmation field.

loosely written: check the serial stream and get the address, compare it to the address column and if there is a match update the confirmation field for that record.

I currently have a script that is parsing the data and logging it to a text file but it is the excel stuff I am questioning

Share this post


Link to post
Share on other sites



Have you looked at the Excel.au3 UDF and the _Excel* functions in the help file?

:D


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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

yes that why I stated that I was asking not so much if it was possible but what skill level would I need, Would it be fairly simple job to do (I just started with AutoIt and am not a very strong coder.(been told numerous times i write "ugly code" )) or is it something beyond my skill level. if it is going to be fairly easy job I will try to do it on my own, but if not I will put it off till my skill level improves.

Edited by rharwood

Share this post


Link to post
Share on other sites

The phrase "simple job to do" is relative to the skill level of the doer. Try the example scripts in the help file for the _Excel* functions and see if they make sense to you. If not, a more specific question or two may be all it takes to get you going.

I find them pretty simple, but I wrote/modified some of them myself.

:D


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

Share this post


Link to post
Share on other sites

Think I got it but again its probably a ugly way of doing it, Ill post what I came up with and you can give me a few tips

;******************************************START EXCEL UPDATE **************************************
;***************************************************************************************************
if GUICtrlRead($Checkbox4) = $GUI_CHECKED Then 
$address=StringMid ( $instr, 1 , 7); pluck the address field

$FileName="C:\fireutils\est3labelfile.csv"      ; Change this to the path/name of your Excel sheet

if not FileExists($FileName) then   ; Just a check to be sure..
    Msgbox (0,"Excel Data Test","Error: Can't find file " & $FileName)
    Exit
endif

$oExcelDoc = ObjGet($FileName)  ; Get an Excel Object from an existing filename

If (not @error) and IsObj($oExcelDoc) then          ; Check again if everything went well
                                                    ; NOTE: $oExcelDoc is a "Workbook Object", not Excel itself!    
    $oDocument=$oExcelDoc.Worksheets(1) 
    ; We use the 'Default' worksheet
    $counter = 1
    while(_ExcelReadCell($oExcelDoc, $counter, 4) <> "")
        $counter = $counter + 1
    wend
    ;MsgBox(0, "", "The Cell Value is: " & @CRLF & $counter - 1, 2)
    For $i = 1 To $counter - 1 ;Loop
    $sCellValue = _ExcelReadCell($oExcelDoc, $i, 4)
    if $sCellValue == $address Then
    _ExcelWriteCell($oExcelDoc, "P", $i, 5)
    $oExcelDoc.Windows(1).Visible = True
    $oExcelDoc.saved=1              ; Prevent questions from excel to save the file
    ;$oExcelDoc.close       
    MsgBox(0, "", "update complete", 2)
    EndIf
Next

    
Else
    Msgbox (0,"Excel Data Test","Error: Could not open "& $FileName & " as an Excel Object.")
Endif
endif
;********************************************* End Excel  ****************************************************
;*************************************************************************************************************

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
Sign in to follow this  
Followers 0