Jump to content
Mosses

Not able to read excel data from french system

Recommended Posts

Mosses

Hi,

I have a script which is running perfectly in Indian system, The same I am running in french system in which I am not able to read excel data.

Can anyone help me on this.

I have checked with keyboard language. changed to french to english and also changed excel language from french to english

 

Edited by Mosses

Share this post


Link to post
Share on other sites
JLogan3o13

@Mosses do you think, perhaps, that it would help us help you if you posted your script?

  • Like 1

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Mosses

Please find my complete script... Thank you in advance to help me.. 

#include <Excel.au3>
#include <MsgBoxConstants.au3>

$WINDOW_NAME="Test"

; Ask for  to be opened
AutoItSetOption ( "WinTitleMatchMode",2)
if not WinExists($WINDOW_NAME) then
    Msgbox (0,"",", de lancer , de se logguer, de lancer la fonction CICS1 et ENSUITE de relancer _DELETE.")
    exit
endif

; Open source EXCEL file
; $FileName=@ScriptDir & "\TSM ODT list to delete.xls"
$FileName=FileOpenDialog("Selectionner le fichier de suppression",@ScriptDir,"Suppr files (*.xlsx)",1)
if not FileExists($FileName) then
  Msgbox (0,"","Error, fichier manquant : "& $FileName)
  Exit
endif
$oExcelDoc = ObjGet($FileName)    ; Get an Excel Object from an existing filename
if not IsObj($oExcelDoc) then
    Msgbox (0,"","Could not open "& $FileName & " as an Excel Object.")
endif

Msgbox (0,"","Merci de cliquer sur l'entête de la fenêtre  ET DE NE PAS CLIQUER JUSQU'A LA FIN.")
if WinWaitActive($WINDOW_NAME) = 0 then
    Msgbox (0,"","Error : Impossible de trouver la fenêtre " & $WINDOW_NAME)
endif

; Iterate on each row
$OEvent=ObjEvent("AutoIt.Error","nothing")    ; Equal to VBscript's On Error Resume Next
dim $row
dim $column
$row=2

; Create application object
                $oExcel = _Excel_Open()
               If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookOpen Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

; *****************************************************************************
; Create a new workbook with only 1 worksheets
; *****************************************************************************
               $oWorkbook = _Excel_BookNew($oExcel,1)
               If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookNew ", "Error creating new workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
               MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_BookNew ", "Workbook has been created successfully with only 1 worksheets.")
               Wait()

              Global $k=3
              _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "a", "A2")
              _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "b", "B2")
              _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "c", "C2")
              _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "d", "D2")
              _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "e", "I2")
            _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "f", "J2")
do
     $a=$oExcelDoc.activesheet.cells($row,3).value


    if $a<>"" then
    Ensure()
     $b=$oExcelDoc.activesheet.cells($row,2).value
        $c=$oExcelDoc.activesheet.cells($row,1).value
        $d=$oExcelDoc.activesheet.cells($row,4).value
        $e=$oExcelDoc.activesheet.cells($row,9).value
        $f=$oExcelDoc.activesheet.cells($row,10).value

    ;Entering Screen Number and Aircraft code
      send("200")
      Wait()
      send($b)
      Wait()
      send("{enter}")
      Wait()

   ;Entering Screen Number, File Number , CSN And Item number.
    Ensure()
    Send("25u")
    Wait()
    send($d)
    Wait()
    send($a)
        if StringLen($b) = 8 Then
            send("{TAB}")
            Wait()
        elseif StringLen($b) = 9 Then
           Wait()
        endif
    send($c)
    Wait()
    send("{enter}")
    Wait()
     Wait()

    $f = StringLen($f)

    for $i=3 to $d

      ;Copy the Data
          Sleep(1000)
            send("{TAB}")
         if $row >= 3 Then

            for $j=1 to $f
               Send("{SHIFTDOWN}")
              send("{Right}")
           next

            Send("{SHIFTUP}")
            sleep(1000)
            Send("^c")
            Wait()
            Local $sData = ClipGet()

            Wait()


             Local $rowValueCF = "A"&$k
             Local $rowValueCA = "B"&$k
             Local $rowValueCSN = "C"&$k
             Local $rowValueItem = "D"&$k
             Local $rowValueCCS = "I"&$k
             Local $rowValueDT = "J"&$k

             Local $cfVAlue[$i] = [$a]
             Local $caVAlue[$i] = [$b]
             Local  $csnValue[$i] = [$c]
             Local  $itemValue[$i] = [$d]
             Local  $ccsValue[$i] = [$i]


            ;Paste the Copied Data to Excel
            $asResult = StringRegExp($sData,'([.]{1,40})', 1)
            If @error == 0 Then
               Else
               _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $cfVAlue, $rowValueCF)
               If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel Export ", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

             _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $caVAlue, $rowValueCA)
               If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel Excel Export", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

            _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $csnValue, $rowValueCSN)
               If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel Excel Export", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

             _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $itemValue, $rowValueItem)
               If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel Excel Export", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)


            _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $ccsValue, $rowValueCCS)
               If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel Excel Export", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)


            _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $sData, $rowValueDT)
               If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel Excel Export", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

               Wait()
                  $k = $k + 1
                  EndIf
         EndIf
      next


    EndIf

 $row=$row+1

   ; Enter F2 to comeback
     if $row >= 4 Then
         send("{F2}")
         Sleep(1000)
       EndIf

   until $a=""


   ; Close file
$oExcelDoc.Close
Exit


; Check that  is opened
func Ensure()
    if WinWaitActive($WINDOW_NAME,"",1)=0 then
        MsgBox(0,"","Vous avez cliqué hors de  (fenêtre " & $WINDOW_NAME & ") => arret des suppressions")
        exit
    endif
endfunc


; Wait between two commands
func Wait()
    sleep(350)
endfunc

 

Edited by JLogan3o13

Share this post


Link to post
Share on other sites
Mosses

From the above script it works fine till this line "    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, "f", "J2") " after that script stops...

Share this post


Link to post
Share on other sites
Mosses

hello,

 

can not anyone help me on the above issue ASAP..

 

Thank you in Advance.

Share this post


Link to post
Share on other sites
JLogan3o13

@Mosses in the future please use the <> symbol on the toolbar to put your code into a code box (I have done so for you above). Doing so makes the code much easier to read.

Also, please do not bump your posts without waiting 24 hours (3 times in an hour is a little excessive). This may be the most important thing in the world to you, but you need to give forum users a chance to assist. We have volunteers from all over the globe; the person best equipped to assist you may not be online yet.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
Mosses

@JLogon Sure I will not bump posts without waiting for 24hours.

Thanks for your quick response.

 

 

 

Share this post


Link to post
Share on other sites
water

You are mixing all possible ways to work with Excel. I think it would be sensible to limit it to the Excel UDF. This includes error handling etc.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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

    • SC0U7
      By SC0U7
      Hello i have a text file which contain over 600KB of BASE64 strings like :
      TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
      Now what i need is divide this long string as autoit variable each max lenght (4000characters per line) example:
      Local $var
      $var &=  TVqQAAMAAAAEAAA..
      $var &=  VbAmejwqqqAACEE..
      and then how to i add encrypt function on every line ? how to i can xor it? example final will be :
      $var &=  XorEnc(TVqQAAMAAAAEAAA..)
      $var &=  XorEncVbAmejwqqqAACEE..)
       
      Thanks for any help and ideas 
    • JuanFelipe
      By JuanFelipe
      Hello friends, I would like to know how to open a GUI from another GUI, I did it the way I leave the attached code, but when closing the second GUI they all close, they could help me to solve this problem without compiling another script. Thank you #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 173, 126, 192, 124) $Button1 = GUICtrlCreateButton("Button1", 16, 24, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _form2() EndSwitch WEnd ;================================================= GUI 2 Func _form2() $Form1 = GUICreate("Form2", 615, 437, 192, 124) GUISetState(@SW_SHOW) While 2 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc  
    • bowker
      By bowker
      Hi! Is there a way for me to set the value for my slider? I am getting the value for my slider with
       
      Local $strText = _UIA_getPropertyValue($oUIElement, $UIA_LegacyIAccessibleValuePropertyId) MsgBox(0,"",$strText)  
    • nacerbaaziz
      By nacerbaaziz
      Hello
      Can we pause and resume the download in the InetGet function?
      If is possible, what is the solution please?
      I used this code To manage the download

      #include <INet.au3> func _downloader($name, $linc, $filepath, $RTLF = false, $link = false) global $downloader = GUICreate("downloader", 400, 200, -1, -1, $WS_CLIPCHILDREn, $RTLF, $link) global $path = $filePath $labelTxt = GUICtrlCreateLabel("downloading " & $name, 50, 10, 200, 20) global $labelTxt0 = GUICtrlCreateLabel("downloaded size 0 MB " & "OF 0 MB", 50, 60, 300, 20) global $Progress = "" global $sText = ""     For $i = 1 To Random(5, 20, 1) ; Return an integer between 5 and 20 to determine the length of the string.         $sText &= Chr(Random(65, 122, 1)) ; Return an integer between 65 and 122 which represent the ASCII characters between a (lower-case) to Z (upper-case). next global $labelTxt2 = GUICtrlCreateInput("0%", 50, 80, 50, 20) _GUICtrlEdit_SetReadOnly(-1, true) GUIStartGroup("") global $beep = GUICtrlCreateCheckBox("use the progress beep notification", 150, 120, 200, 20) GUIStartGroup("") $button = GUICtrlCreateButton("Cancel', 130, 150, 180, 25, 0x01) $iIndex = 0 global $Target global $url GUIStartGroup("") global $Progress = GUICtrlCreateProgress(50, 90, 150, 20) global $Target = $filepath global $url = $linc global $path = $filepath global $hDownloadNo = _RSMWare_GetData($url, $Target) global $status = false AdlibRegister("SetProgress") global $onprogress = false, $curent = false GUISetState(@sw_Show) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $button $asc = MsgBox(4132,"exit download?","if you click yes the downloading will be cancel, do you want to cancel it ?") if $asc = 6 then AdlibUnRegister("SetProgress") GUIDelete() If $hDownloadNo <> 0 Then InetClose($hDownloadNo) exitLoop endIf EndSwitch if $status = -1 then $status = 0 $hDownloadNo = _RSMWare_GetData($url, $Target) $onprogress = false $curent = false elseIf $Status = 1 then $status = $path GUIDelete() AdlibUnRegister("SetProgress") exitLoop endIf WEnd return $status endFunc Func _RSMWare_GetData($url, $Target) Local $hDownload = InetGet($url, $Target, 1, 1) Return $hDownload EndFunc ;==>_RSMWare_GetData Func SetProgress() Local $state If $hDownloadNo <> 0 Then $state = InetGetInfo($hDownloadNo) If @error = 0 Then $infor = "downloaded size " & Round(Execute(InetGetInfo($hDownloadNo, $INET_DOWNLOADREAD) / 1048576), 2) & " MB of " & Round(Execute(InetGetInfo($hDownloadNo, $INET_DOWNLOADSIZE) / 1048576), 2) & " MB " $onprogress = Round(Ceiling(($state[0] / $state[1]) * 100)) if not (InetGetInfo($hDownloadNo, $INET_DOWNLOADSIZE) = 0) then if $onProgress <= 0 then $onProgress = 0 GUICtrlSetData($Progress, $onProgress) GUICtrlSetData($labelTxt0, $infor) GUICtrlSetData($labelTxt2, $onProgress & "%") if _isChecked($beep) then if $onprogress > $curent then beep((100 + $onprogress * 20), 100) $curent = $onprogress endIf endIf endIf If $state[2] Then If $state[3] Then InetClose($hDownloadNo) $status = 1 else InetClose($hDownloadNo) $status = -1 endIf endIf EndIf endIf EndFunc ;==>SetProgress
    • VollachR
      By VollachR
      Hi,
      I'm looking for a way to take a number value from a Row2 of a 2D array and according to this check if files that appear in rows 3-11 in the array exists.
      For example, if the number in Row2 is 5 I need to check for the files in Row 3-6 only, if it is 6 than rows 3-7 and so on.
      I thought on using a FOR loop but I have very little experience with those.
      Can you suggest the best way to do what I need?
      BTW, the files in Rows 3-11 will usually have blank value for any row above the number in Row2 (e.g. Row2 = 5 so Rows3-6 will have values but 8-11 be empty), The values I need are in Column 1 of the array, the name of the key from the INI file that the array was created from is in Column 0.
      Full Example:
      Row2 of Array:
      Col0 = Games# - Col1 = 5
      Rows3-6
      Col0 = Exe2 - Col1 = Path To File
      Col0 = Exe3 - Col1 = Path To File
      Col0 = Exe4 - Col1 = Path To File
      Col0 = Exe5 - Col1 = Path To File
      I need that if Row2 is 5 to check these above for rows if the file exists, if it was 6 then the next row as well and so on up until number 10 in Row2 as it can't go above 10.
      So basically for whatever number in Row2 from 2-10 need to check 1-9 rows from 3-11 to see if the files in Col1 exists and if any of them don't exist it should call a function that shows an error message.
      I'm pretty sure I have the first line of the for look correct:
      For $i = 1 To $aAIO[2][1] Just not sure how to continue from there, also not sure if $i should be equal 1 or 2.
      Help will be appreciated.
×