Hanukka

KB 3008923 error help

12 posts in this topic

#1 ·  Posted (edited)

Hi guys, 

I was trying to automate a webpage after getting input from excel. The script worked fine for like 5 iterations but then stopped all of a sudden, I dont have the exact error msg now, but it was pointing to this in the IE UDF:-

Return SetError($_IESTATUS_Success, $oTemp.GetElementsByTagName($sTagName).length,

When i looked up the forum there was a similar question which said that I have to fix KB 3008923 update by uninstalling it, but I am unable to do that. 

here is the link for download:- ( i guess )

https://support.microsoft.com/en-us/help/3024777/error-0x800706f7-occurs-after-you-install-kb-3004394-and-then-run-windows-update-in-windows-7-and-windows-server-2008-r2

Does anybody know the proper steps to solve this??

Plus I wont be able to send the code here because of privacy policy n all by the company.

Desperately looking for a reply.....

Edited by Hanukka

Share this post


Link to post
Share on other sites



#2 ·  Posted

Fellas, This was the error exactly :-

"C:\Program Files (x86)\AutoIt3\Include\IE.au3" (1811) : ==> The requested action with this object has failed.:
Return SetError($_IESTATUS_Success, $oTemp.GetElementsByTagName($sTagName).length, $oTemp.GetElementsByTagName($sTagName))
Return SetError($_IESTATUS_Success, $oTemp^ ERROR

plss helpp

Share this post


Link to post
Share on other sites

#3 ·  Posted

For another update, I dont and did not have KB 3008923 as yall can see in this picture......

 

IMG_20170623_164827.jpg

 

Guys please help or provide link to the right area if you know the answer_/\_

Share this post


Link to post
Share on other sites

#4 ·  Posted

So you don't know the exact error, you can't share the code, and you don't even link to the "similar question" you found on the forum. @Hanukka take a moment and really think about whether you would be able to help someone with this amount of information...


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

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

 

There I guess this thread matches mine but i havent found any conclusion

AND...Mr @JLogan3o13...listen

1) I know the EXACT error...i have mentioned in the 2nd post..I dont know the fix

2) Yes i am sorry, but i cant share the code. So please refer to the code in the attached post, else its ok

3) I forgot to put the link..there enjoy

and dude..why dont you focus on christmas a little bit, never have you helped with my error,  but only correct the format or taunt. 

Edited by Hanukka

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

It isn't a taunt. Forum members are here to help, but you have a history of expecting people to first guess at what you are doing and then try to troubleshoot for you. A little thought behind your posts will help others help you.

Edit: And the error states that it cannot access the object. So, without seeing any code, do you have error checking in place to validate that $oTemp is an object?

Edited by JLogan3o13

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

Share this post


Link to post
Share on other sites

#7 ·  Posted

alright mate, thanks...

the error as you can see is from the IE.au3 udf, I do not check the $oTemp variable of the UDF at any place..

Ill provide a little update of my code in a while

Share this post


Link to post
Share on other sites

#8 ·  Posted

11 minutes ago, Hanukka said:

and dude..why dont you focus on christmas a little bit, never have you helped with my error,  but only correct the format or taunt. 

mmm....  I am sure this will really help to make your life easier around here. ;)

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#9 ·  Posted

Shit...I got a little hyper...sorry @JLogan3o13....

Peeps, i cant provide the code since it is long and more, it is super specific to thhe webapp and excel..

so ill just provide a blueprint, hope yall wont mind

Its like there is a loop which runs until there are non null rows in excel

in that I use various functions like:

_IEFrameGetObjByName

_IETagNameGetCollection

_IEFormElementCheckBoxSelect

PixelSearch....and a lot more

the thing is it worked for like 7 excel rows, ie. took the excel data, navigated to the right webpage, made the edits.

it get effed after that.

I changed the data, it worked till 7 rows, tried another similar script, worked till 8 or so...I am 95% sure that the script is error free.

There was something regarding memory leak or something discussed in the thread i last attached...wasnt resolved

Im using IE11...

Thats all i can provide yall with guys, pls refer the previous posts too...

N sorry again @JLogan3o13...please help me here if you can.

Share this post


Link to post
Share on other sites

#10 ·  Posted

9 hours ago, Hanukka said:

Does anybody know the proper steps to solve this??

Did you look here:

How to use IE.au3  UDF with  AutoIt v3.3.14.x  

1 person likes this

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

#11 ·  Posted

1 hour ago, Hanukka said:

Thats all i can provide yall with guys

In my humble opinion this won't be enough to help you.  Why can't you make a simple reproducer script that opens  8 pages from hardcoded URL's to see if that works or errors out. In case it works, add the bit to open the excel and read the url's from there. Then you can post it back to show us to see if we can help debug it.

In case you are unable to do so you really need to stop expecting people to help as you only get wild stabs in the dark.

Jos  

1 person likes this

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#12 ·  Posted

@mLipok...I tried using _IEerrorhandlerregister, but now the code stopped even before it used to...Its getting too much fr me, I tried using excel data on a simple website without frames n it worked...I have no clue how to explain further...Anyways here, this is the code that i was working with...(edited a bit)

#include <IE.au3>
#include <Excel.au3>                                                                                
#include <StringConstants.au3>
#include <Array.au3>
#include <MsgBoxUDF.au3>
#include <File.au3>


_IEErrorHandlerRegister()  ;FUCKS UP...I DONT KNOW HOW TO HANDLE MESELF

;~ #Excel update check

_MsgBox_SetButtonText(4, "Ya", "Na")
$ret = _MsgBox(4 + 262144, '                                  (O_o)', 'Do you want to update your excel file?')
If $ret == 6 Then
   $useret = Run("Assngen.exe ")
   ProcessWaitClose($useret)
EndIf

;~ ;;;;;;;;;;;;;;;;;;;;;;;-------Some function space!!!!

Func assnid($i)
   $temp = "AF" & $i
  $fag = _Excel_RangeRead($NoteBook, Default, $temp)
   If $fag == "" Then
      return -1
   EndIf
   ;ConsoleWrite($flag & @CRLF)
   return $fag
EndFunc

Func name($i)
   $temp = "D" & $i
   $fag = _Excel_RangeRead($NoteBook, Default, $temp)
   If $fag == "" Then
      return -1
   EndIf
   ;ConsoleWrite($flag & @CRLF)
   return $fag
EndFunc


Func rowno($i)
   $temp = "AG" & $i
  $fag = _Excel_RangeRead($NoteBook, Default, $temp)
   If $fag == "" Then
      return -1
   EndIf
   ;ConsoleWrite($flag & @CRLF)
   return $fag
EndFunc

Func reminder()
   $rID = _IEAttach('THE URL', 'url')
   If $rID <> "" Then
      ;WinSetState($rID, "", @SW_MINIMIZE)
      $dismiss = _IEGetObjById($rID, 'dismissAllBtn')
      _IEAction($dismiss, 'click')
      Sleep(2000)
      Return 0
   Else
      Return 0
   EndIf
EndFunc

Func datext($i)
   Local $array[4]
  $temp = "W" & $i
  $fag = _Excel_RangeRead($NoteBook, Default, $temp)
   If $fag == "" Then
      return -1
   EndIf
   $temp1 = StringTrimRight($fag, 4)
   $array = StringSplit($fag, '/')
   $yr = StringTrimLeft($array[3], 2)
   $fag = $temp1 & $yr
   return $fag
EndFunc

Func reason($i)
   $temp = "AH" & $i
  $fag = _Excel_RangeRead($NoteBook, Default, $temp)
   If $fag == "" Then
      return -1
   EndIf
   ;ConsoleWrite($flag & @CRLF)
   return $fag
EndFunc

Func morechk($x)
   Sleep(1500)
   $ret1 =  WinActive('AutoIt Error')
   $ret2 = WinActive('Message from webpage')
   ;ConsoleWrite($ret1)
   ;ConsoleWrite($ret2)
   If $ret1 <> 0 Or $ret2 <> 0 Then
      Sleep(1000)
      Send('{Enter}')
      _IEQuit($x)
      MsgBox(0, 'ERROR', 'Please update excel sheet')
      Exit
   EndIf
EndFunc

Func failogin($x)
  $tags = _IETagNameGetCollection($oIE1, 'span', 0)
   If $tags.innertext = 'Login failed, check username and password.' Then
      MsgBox(0, "ERROR", 'Wrong username / password')
      _IEQuit($x)
      Exit
   EndIf
EndFunc

Func colorfail($x)
    MsgBox(0, 'ERROR', 'RETRY')
   Sleep(3000)
   Send('{Enter}')
   _IEQuit($x)
EndFunc


$file = @ScriptDir & "\lolfile.txt"
FileOpen($file, 2)

;;;;;;;;;;;;Open Active Excel
$var = @ScriptDir & "\EXCEL.xlsx"
$oExcel = _Excel_Open()
$NoteBook = _Excel_BookOpen($oExcel, $var)
WinSetState("EXCEL", "", @SW_MINIMIZE)

;~ ;;;;;;;;;;;;;Opens the main login after GUI

$oIE1 = _IECreate('THE URL')
Sleep(2000)
;$name1 = $CmdLine[1]
;$psw1 = $CmdLine[2]
$name = _IEGetObjById($oIE1, 'loginID')
$psw = _IEGetObjById($oIE1, 'password')
_IEFormElementSetValue($name, 'test');$name1)
_IEFormElementSetValue($psw, 'test');$psw1)
Sleep(500)
$tags = _IETagNameGetCollection($oIE1, 'input')
For $tag In $tags
   $class_value = $tag.GetAttribute("value")
   If $class_value = "Continue" Then
      _IEAction($tag, 'click')
   EndIf
Next
Sleep(2000)
failogin($oIE1)
;;;;;;;;;;;;;;;;;;;;-Addn pg
$timer = 1
$temp = 0
While ($timer <> 60)
   $oIEX = _IEAttach('THE URL', 'url')
   $oIE2 = _IEAttach('THE URL', 'url')
   If $oIEX <> "" Or $oIE2 <> "" Then
      If $oIE2 <> "" Then
         $x = $oIEX
         ExitLoop
      Else
         $x = $oIE2
      EndIf
      $tags = _IETagNameGetCollection($oIEX, 'input')
      For $tag In $tags
       $class_value = $tag.GetAttribute("value")
       If $class_value = "Continue" Then
           _IEAction($tag, 'click')
           $temp = 1
           ExitLoop
       EndIf
      Next
      If $temp == 1 Then
         ExitLoop
      EndIf
   EndIf
   Sleep(1000)
   $timer+=1
WEnd

If $timer == 60 Then
   WinClose('[ACTIVE]')
EndIf

;;;;;;;;;;;;;;;;-main pg
;---open & maximize
$timer = 1
While ($timer <> 60)
   $oIE2 = _IEAttach('THE URL', 'url')
   If $oIEX <> "" Then
      $oIE2 = _IEAttach('THE URL', 'url')
   EndIf
   If $oIE2 <> "" Then
      ExitLoop
   EndIf
   Sleep(1000)
   $timer+=1
WEnd

If $timer == 60 Then
   WinClose('[ACTIVE]')
EndIf

Sleep(1500)
WinSetState("THE TITLE", "", @SW_MAXIMIZE)
Sleep(1500);
;---defined at #
$i = 2
$j = 0
$disflag = 0
$dheight = @DeskTopHeight
$dwidth = @DeskTopWidth
While(assnid($i)<>-1)
   Sleep(500)
   If assnid($i) == "" Then
      ContinueLoop
   EndIf
   $main_div = _IEGetObjById($oIE2, 'SOMETHING')
   $tags = _IETagNameGetCollection($main_div, 'div')
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
   For $tag In $tags
      If $tag.id = "SOMETHING" Then ;# Click the home in the dropdown of Jobs
         _IEAction($tag, 'click')
      EndIf
   Next
   Sleep(2000)
   If $j == 0 Then
      $main_frame = _IEFrameGetObjByName($oIE2, 'SOMETHING')
   Else
      $main_frame = _IEFrameGetObjByName($oIE2, 'MAINFRAME');# Changes after first iteration
   EndIf
   $sub_frame = _IEFrameGetObjByName($main_frame, 'roleSearchFrame')
   $form = _IEGetObjById($sub_frame, 'attributeForm')
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
   $check = _IEFormElementCheckBoxSelect($form, '6920558') ;# Select contact checkbox
   Sleep(2000)
   $tags = _IETagNameGetCollection($sub_frame, 'input')
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
   For $tag In $tags
      $class_value = $tag.GetAttribute("id")
      If $class_value = "11461$" Then
         _IEAction($tag, 'click')
         If rowno($i) = 9999 Then
            ContinueLoop
         EndIf
         _IEFormElementSetValue($tag, assnid($i))
      EndIf
   Next
   Sleep(3000)
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
   For $tag In $tags
      $class_value = $tag.GetAttribute("id")
      If $class_value = "find" Then
         _IEAction($tag, 'click')
      EndIf
   Next
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
   MouseClick("primary", 1092, 174, 1, Default);# First Random Click
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
   Send('^f')
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
   Send(assnid($i))
   Sleep(3000)
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
   MouseClick("primary", 1092, 174, 1, Default)
   Sleep(1000)
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
   $Array = PixelSearch (0, 89, $dwidth, $dheight, 0xFFFF00);#######################
   If @error == 1 Then
     colorfail($oIE2)
  EndIf
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
   MouseClick('primary', $Array[0], $Array[1], 1)
   Sleep(5000)
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
   Send('^f')
   Sleep(1000)
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
   Send('End Assignment')
   Sleep(2500)
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
   MouseClick("primary", 1092, 174, 1, Default)
   Sleep(2000)
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
   $Array = PixelSearch (0, 89, $dwidth, $dheight, 0xFFFF00)
   Sleep(2000)
   If @error == 1 Then
     colorfail($oIE2)
   EndIf
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
   MouseClick('primary', $Array[0], $Array[1], 1)   ;# Get the new window to change date
   morechk($oIE2)
   Sleep(4000)
   If $i = 8 Then
      MsgBox(0, "", 'now')
      Sleep(10000)
   EndIf
;
   $oIE3 = _IEAttach('THE URL', 'url')
;~    ConsoleWrite('wreck1' & @CRLF)
   $frame = _IEFrameGetObjByName($oIE3, '_IFRAMEID')
;~    ConsoleWrite('wreck2' & @CRLF)
   $ip = _IEGetObjById($frame, 'SOMETHING')
;~    ConsoleWrite('wreck3' & @CRLF)
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
   _IEAction($ip, 'click')
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
;~    ConsoleWrite('wreck4' & @CRLF)
   _IEFormElementSetValue($ip, datext($i))
   Sleep(2000)
;~    ConsoleWrite('wreck5' & @CRLF)
   $ip2 = _IEGetObjById($frame, 'SOMETHING')
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
;~    ConsoleWrite('wreck6' & @CRLF)
   _IEFormElementSetValue($ip2, reason($i))
   Sleep(2000)
   $oButtons = _IETagnameGetCollection($frame, "button")
   ;;;;---rem check
   If $disflag == 0 Then
      $disflag = reminder()
   EndIf
   For $oButton in $oButtons
      If String($oButton.innertext) = "Confirm" Then
         _IEAction($oButton, "click")
      EndIf
   Next
   Sleep(2000)
   FileWrite($file, name($i) & ", "& assnid($i) & @CRLF)
;~    ConsoleWrite(@error)
   $i+=1
;~    $j = 1
WEnd
MsgBox(0, 'Status', 'Completed')
_MsgBox_SetButtonText(0, "OK...Bye")
_MsgBox(0 + 262144, '        "\(^_^)', 'Bye')
Sleep(2000)
WinClose('Assignment Record')
Sleep(2000)
_IEQuit($oIE2)

  Works for 8 or so records n then gets effed

If yall have any recommendations n all pls do tell...else, its ok, i am currently using another script to run it for 5 iterations each time :P

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

    • anusha
      By anusha
      Hi I have jus started using auto-it . Please correct me if I'm wrong.
      I need to read data from an input in text box and search in excel file and return value in next column of matched cell on GUI.
      I have written below code but i cannot use variable which has data stored. it works only when search string is hard coded.
      Please help out.
       
      Example()
      Func Example()
      Local $GuiMain = GUICreate("EXCEL TEST", 399, 180) ;creates main GUI
      ;~ Local $idOK = GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
      Local $iWidthCell = 70
      Local $idLabel = GUICtrlCreateLabel("PART NUMBER", 10, 30, $iWidthCell,50)
      Local $RUN_1 = GUICtrlCreateButton("OK", 70, 70, 85, 25)
      Local $Input_1 = GUICtrlCreateInput("PART NUMBER", 100, 20, 120, 20)
      Local $sMenutext = GUICtrlRead($Input_1, 1)
      GUISetState(@SW_SHOW, $GuiMain)

          While 1
          $MSG = GUIGetMsg()
          Select
              Case $MSG = $GUI_EVENT_CLOSE
                  Exit
              Case $MSG = $RUN_1
                  Local $oAppl = _Excel_Open()

      Local $sFilePath1 = "D:\Anu_WorkFolder\Components.xlsx"
      Local $oWorkbook = _Excel_BookOpen($oAppl, $sFilePath1, Default, Default, True)
      Local $aResult = _Excel_RangeFind($oWorkbook, $sMenutext , Default, Default, $xlWhole)
    • Nareshm
      By Nareshm
      How to Activate Opened Excel Windows Using Class not Tittle, Because Some time opened defferent excel that have different name.
      I Tried with
      Winactivate ("[CLASS:XLMAIN]") but not working
    • willichan
      By willichan
      Here is another one from my archives that filled a specific need.
       
      Here is the back story if you are interested.
       
      Keep in mind that I wrote this script over 3 years ago, so it may not compile or run directly without some minor tweaks.  It also requires the use of GraphViz to build the graph.
      #cs ---------------------------------------------------------------------------- Project Name: ExcelLinksMapper Description: Analyse an Excel file's links and map them out. Creation Date: 9/26/2014 AutoIt Version: Author: willichan Requires: Graphviz (http://graphviz.org/) #ce ---------------------------------------------------------------------------- Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declare Opt("TrayAutoPause", 0) ;0=no pause, 1=Pause Opt("TrayMenuMode", 0) ;0=append, 1=no default menu, 2=no automatic check, 4=menuitemID not return Opt("TrayIconHide", 0) ;0=show, 1=hide tray icon Global Const $MyName=StringLeft(@ScriptName, StringInStr(@ScriptName,".", 0, -1)-1) ;get just the name portion of the script/exe name Global Const $MyMutex=$MyName & "-82243BEBC30533A3" ;name the mutex for this app Global $SQLloaded = False Global $sDbName = @ScriptDir & "\db2gv.db" ConsoleWrite($sDbName & @crlf) If _MutexExists($MyMutex) Then Exit #include <SQLite.au3> #include <SQLite.dll.au3> #include <file.au3> #include <array.au3> #include <excel.au3> _ConfigInitialize() _Main() Func _ConfigInitialize() OnAutoItExitRegister("_ConfigDestroy") ;initializers here Global $sSQliteDll = _SQLite_Startup() If @error Then MsgBox(0, "SQLite Error", "could not load the DLL") Global $sSQLiteDB = _SQLite_Open($sDbName) If $sSQLiteDB = 0 Then MsgBox(0, "SQLite Error", "could not open the database") $SQLloaded =True __CreateTables() EndFunc ;==>_ConfigInitialize Func _ConfigDestroy() ;destructors here If $SQLloaded Then _SQLite_Close() _SQLite_Shutdown() EndIf EndFunc ;==>_ConfigDestroy Func _MutexExists($sOccurenceName) Local $ERROR_ALREADY_EXISTS = 183, $handle, $lastError $sOccurenceName = StringReplace($sOccurenceName, "\", "") $handle = DllCall("kernel32.dll", "int", "CreateMutex", "int", 0, "long", 1, "str", $sOccurenceName) $lastError = DllCall("kernel32.dll", "int", "GetLastError") Return $lastError[0] = $ERROR_ALREADY_EXISTS EndFunc ;==>_MutexExists Func __CreateTables() _SQLite_Exec($sSQLiteDB, "DROP TABLE IF EXISTS nodes;") _SQLite_Exec($sSQLiteDB, "CREATE TABLE IF NOT EXISTS nodes( name TEXT PRIMARY KEY, fileexists INTEGER);") _SQLite_Exec($sSQLiteDB, "DROP TABLE IF EXISTS links;") _SQLite_Exec($sSQLiteDB, "CREATE TABLE IF NOT EXISTS links( id INTEGER PRIMARY KEY, name1 TEXT, name2 TEXT, weight INTEGER);") EndFunc Func _Main() Local $sInfile, $vResult, $iErrLoop $sInfile = FileOpenDialog("Source File", @WorkingDir, "Excel files (*.xl*)", 1 + 2) If Not FileExists($sInfile) Then MsgBox(0, "Excel Links Mapper Error", "Unable to locate source file") Exit EndIf $vResult = $SQLITE_IOERR $iErrLoop = 5 While $vResult = $SQLITE_IOERR $vResult = _SQLite_Exec($sSQLiteDB, "INSERT OR IGNORE INTO nodes ('name', 'fileexists') VALUES (" & _SQLite_FastEscape($sInfile) & ", 1);") If Not $vResult = $SQLITE_OK Then Sleep(100) $iErrLoop -= 1 If $iErrLoop = 0 Then ConsoleWrite($iErrLoop & " tries" & @CRLF & $sInfile & @CRLF) $vResult = $SQLITE_OK EndIf WEnd _GetExcelLinks($sInfile) Global $hOutfile = FileOpen(@ScriptDir & "\" & $MyName & ".gv", 2) If $hOutfile = -1 Then MsgBox(0, $MyName & " ERROR", "Unable to upen file for output") Exit EndIf _WriteHeader() _WriteNodes() _WriteLinks() _WriteFooter() FileClose($hOutfile) _GenerateGraph() ShellExecute(@ScriptDir & '\ExcelLinksMapper.png') EndFunc ;==>_Main Func _GetExcelLinks($strFileName) Local $hQuery, $aCount, $iErrLoop, $vResult ConsoleWrite($strFileName & @CRLF) Local $iLoop, $iExists Local $aLinks Local Const $xlExcelLinks = 1 Local $oExcel = _Excel_Open() Local $ret = _Excel_BookOpen_NoUpdate($oExcel, $strFileName, True, True) Local $err = @error If $err Then If Not IsObj($oExcel) Then ConsoleWrite($ret & " - " & $err & @CRLF) Exit EndIf EndIf $aLinks = $oExcel.ActiveWorkbook.LinkSources($xlExcelLinks) _Excel_BookClose($oExcel, False) _Excel_Close($oExcel, False, True) If IsArray($aLinks) Then If UBound($aLinks) > 0 Then For $iLoop = 0 To UBound($aLinks) - 1 If $aLinks[$iLoop] <> $strFileName Then $iExists = FileExists($aLinks[$iLoop]) ConsoleWrite("DEBUG - Calling WriteNode()") __WriteNode($aLinks[$iLoop], $iExists) ConsoleWrite("DEBUG - Calling WriteLink()") __WriteLink($strFileName, $aLinks[$iLoop]) If $iExists And ($aLinks[$iLoop] <> $strFileName) Then _GetExcelLinks($aLinks[$iLoop]) EndIf Next EndIf EndIf EndFunc ;==>_GetExcelLinks Func __WriteNode($sName, $iExists) Local $iErrLoop = 5 ;Number of attempts to make Local $vResult Do ConsoleWrite("DEBUG - WriteNode()" & @CRLF & " _SQLite_Exec(INSERT OR IGNORE INTO nodes ('name', 'fileexists') VALUES (" & _SQLite_FastEscape($sName) & ", " & $iExists & ");) - create node entry" & @CRLF) $vResult = _SQLite_Exec($sSQLiteDB, "INSERT OR IGNORE INTO nodes ('name', 'fileexists') VALUES (" & _SQLite_FastEscape($sName) & ", " & $iExists & ");") If Not $vResult = $SQLITE_OK Then Sleep(100) $iErrLoop -= 1 If $iErrLoop = 0 Then $vResult = $SQLITE_OK ;Used up all our attempts, so simulate a success Until $vResult = $SQLITE_OK EndFunc ;==>__WriteNode Func __WriteLink($sName1, $sName2) Local $iErrLoop = 5 ;Number of attempts to make Local $vResult, $hQuery, $vCount ConsoleWrite("DEBUG - WriteNode()" & @CRLF & " _SQLite_Query(SELECT weight FROM links WHERE 'name1'=" & _SQLite_FastEscape($sName1) & " AND 'name2'=" & _SQLite_FastEscape($sName2) & ";) - lookup link entry" & @CRLF) _SQLite_Query($sSQLiteDB, "SELECT weight FROM links WHERE 'name1'=" & _SQLite_FastEscape($sName1) & " AND 'name2'=" & _SQLite_FastEscape($sName2) & ";", $hQuery) ConsoleWrite("DEBUG - _SQLite_FetchData()" & @CRLF) _SQLite_FetchData($hQuery, $vCount) If UBound($vCount) > 1 Then _ArrayDisplay($vCount) If $SQLITE_OK And UBound($vCount) > 1 Then $vCount = $vCount[1] + 1 Else $vCount = 1 EndIf Do If $vCount = 1 Then ConsoleWrite("DEBUG - _SQLite_Exec() - create link entry" & @CRLF) $vResult = _SQLite_Exec($sSQLiteDB, "INSERT INTO links ('name1', 'name2', 'weight') VALUES (" & _SQLite_FastEscape($sName1) & ", " & _SQLite_FastEscape($sName2) & ", " & $vCount & ");") Else ConsoleWrite("DEBUG - _SQLite_Exec() - update link entry" & @CRLF) $vResult = _SQLite_Exec($sSQLiteDB, "UPDATE links SET 'weight'=" & $vCount & " WHERE 'name1'=" & _SQLite_FastEscape($sName1) & " AND 'name2=" & _SQLite_FastEscape($sName2) & ";") EndIf If Not $vResult = $SQLITE_OK Then Sleep(100) $iErrLoop -= 1 If $iErrLoop = 0 Then $vResult = $SQLITE_OK ;Used up all our attempts, so simulate a success Until $vResult = $SQLITE_OK EndFunc ;==>__WriteLink ; #FUNCTION# ==================================================================================================================== ; Author ........: SEO <locodarwin at yahoo dot com> ; Modified.......: litlmike, water, GMK, willichan ; =============================================================================================================================== Func _Excel_BookOpen_NoUpdate($oExcel, $sFilePath, $bReadOnly = Default, $bVisible = Default, $sPassword = Default, $sWritePassword = Default) If Not IsObj($oExcel) Or ObjName($oExcel, 1) <> "_Application" Then Return SetError(1, @error, 0) If Not FileExists($sFilePath) Then Return SetError(2, 0, 0) If $bReadOnly = Default Then $bReadOnly = False If $bVisible = Default Then $bVisible = True ;; changing the second parameter on the following line to a 0 tells Excel not to update any links. Local $oWorkbook = $oExcel.Workbooks.Open($sFilePath, 0, $bReadOnly, Default, $sPassword, $sWritePassword) If @error Then Return SetError(3, @error, 0) $oExcel.Windows($oWorkbook.Name).Visible = $bVisible ; If a read-write workbook was opened read-only then return an error If $bReadOnly = False And $oWorkbook.Readonly = True Then Return SetError(4, 0, $oWorkbook) Return $oWorkbook EndFunc ;==>_Excel_BookOpen_NoUpdate Func _GenerateGraph() RunWait(@ScriptDir & '\GraphViz238\bin\dot.exe -Tpng "' & @ScriptDir & '\' & $MyName & '.gv" -o "' & @ScriptDir & '\ExcelLinksMapper.png"') EndFunc ;==>_GenerateGraph Func _WriteHeader() __OutLine(0, "digraph main {") EndFunc ;==>_WriteHeader Func _WriteNodes() Local $aResult, $iRows, $iColumns, $iRval Local $iLoop, $sStyle __OutLine(1, "// Nodes") $iRval = _SQLite_GetTable($sSQLiteDB, "SELECT name, fileexists FROM nodes;", $aResult, $iRows, $iColumns) If @error Then ConsoleWrite("_WriteNodes()" & @CRLF & "_SQLite_GetTable") If $iRval = $SQLITE_OK Then For $iLoop = 1 To $iRows If $aResult[($iLoop * 2) + 2] > 0 Then $sStyle = "normal" Else $sStyle = "missing" EndIf __OutNode($aResult[1 + (2 * $iLoop)], $sStyle) ;; Next Else MsgBox($MB_SYSTEMMODAL, "SQLite Error: " & $iRval, _SQLite_ErrMsg() & @CRLF & "in _WriteNotes() calling _SQLite_GetTable()") Exit EndIf EndFunc ;==>_WriteNodes Func __OutNode($sName, $sStyle = Default) If $sStyle = Default Then $sStyle = "Normal" Switch StringLower($sStyle) Case "missing" __OutLine(1, __MakeName($sName) & ' [label="' & StringReplace($sName, "\", "\\") & '",color=red,fontcolor=red,shape=octagon];') Case Else ;"normal", Default __OutLine(1, __MakeName($sName) & ' [label="' & StringReplace($sName, "\", "\\") & '",color=black,fontcolor=black,shape=box];') EndSwitch EndFunc ;==>__OutNode Func _WriteLinks() Local $aResult, $iRows, $iColumns, $iRval Local $iLoop, $sStyle, $aCount __OutLine(1, "// Links") $iRval = _SQLite_GetTable($sSQLiteDB, "SELECT name1, name2 FROM links ORDER BY name1 ASC, name2 ASC;", $aResult, $iRows, $iColumns) If $iRval = $SQLITE_OK Then For $iLoop = 1 To $iRows __OutLink($aResult[1 + (2 * $iLoop)], $aResult[2 + (2 * $iLoop)]) Next Else MsgBox($MB_SYSTEMMODAL, "SQLite Error: " & $iRval, _SQLite_ErrMsg()) Exit EndIf EndFunc ;==>_WriteLinks Func __OutLink($sName1, $sName2, $iWeight = 1) __OutLine(1, __MakeName($sName1) & ' -> ' & __MakeName($sName2) & ';') EndFunc ;==>__OutLink Func _WriteFooter() __OutLine(0, "}") EndFunc ;==>_WriteFooter Func __OutLine($iTabs, $sText) Local $iLoop If $iTabs > 0 Then For $iLoop = 1 To $iTabs FileWrite($hOutfile, " ") ;ConsoleWrite(" ") Next EndIf FileWriteLine($hOutfile, $sText) EndFunc ;==>__OutLine Func __MakeName($sText) Local $sNewName = StringReplace($sText, "\", " ") $sNewName = StringReplace($sNewName, "/", " ") $sNewName = StringReplace($sNewName, "'", " ") $sNewName = StringReplace($sNewName, '"', " ") $sNewName = StringReplace($sNewName, ':', " ") $sNewName = StringReplace($sNewName, '.', " ") $sNewName = StringReplace($sNewName, '-', " ") $sNewName = StringReplace($sNewName, '$', " ") $sNewName = StringStripWS($sNewName, 8) Return StringLower($sNewName) EndFunc ;==>__MakeName  
    • Dimmae
      By Dimmae
      Hello,
      at first: i'm new here, so please forgive me my mistakes, and show them to me, just that i can learn to do better in the future.
      Now to my Problem: i have an excel sheet, where i just need some columns for further actions, but i have no idea how to add single columns to a new array.
      I found the following code(the one i just added as a file) from 'water' in this forum, but i wont get how i could add multiple columns into a new array.
      The biggest problem in my situation is that i dont know the count of the rows i need for the array, i just got a fix number of rows, which is 4.
       
      Hope you can help me, and sry again for this 'unlucky illustration'.
       
      btw: how can i add code shown as code here, instead of posting it as a attached file?.
       
       
       
      autoit-select-column.au3
      defects.xlsx
    • LoneWolf_2106
      By LoneWolf_2106
      Hi,
      i have an error:
      ==> The requested action with this object has failed.: $iRowCount = .Range(.Cells(1, 1), .Cells($oRangeLast.Row, $oRangeLast.Column)).Rows.Count $iRowCount = .Range(^ ERROR  
      My code is:
      $oRangeLast = .UsedRange.SpecialCells($xlCellTypeLastCell) Sleep(1000) $iRowCount = .Range(.Cells(1, 1), .Cells($oRangeLast.Row, $oRangeLast.Column)).Rows.Count Sleep(1000) _Excel_RangeWrite($oWorkbook_1, $oWorkbook_1.ActiveSheet,$aFileList[$i][2] , "AB3:AB"&$iRowCount) I have added some sleep because the application was crashing more often before, so i thought to slow down the code execution.
      But i didn't solve the issue.
      Has anyone an idea of what the problem might be?
      Thanks in advance.