Search found 79 matches

by aircooled
28 Jan 2020, 03:50
Forum: Ask For Help
Topic: Function in external file with try/catch/Com Interface MUCH SLOWER
Replies: 22
Views: 1114

Re: Function in external file with try/catch/Com Interface MUCH SLOWER

Thanks swagfag for your time. I understand your point. Conclusion: it is easier to have the try/catch blocks inside the code. Regarding the contradiction would appreciate if you develop. At the moment the code exit if call ok ok and repeat if necessary. Have logged in file the (error) and (!error) s...
by aircooled
27 Jan 2020, 14:39
Forum: Ask For Help
Topic: Function in external file with try/catch/Com Interface MUCH SLOWER
Replies: 22
Views: 1114

Re: Function in external file with try/catch/Com Interface MUCH SLOWER

The param is the result (return value) of a COM interface call. UpdateCell(X1) would pass the interface pointer. It performs the COM Interface calls without ByRef but nothing changes. Still the sleep are necessary or it fails. This is the least amount of sleep it succeeded all the way through other...
by aircooled
27 Jan 2020, 06:24
Forum: Ask For Help
Topic: Function in external file with try/catch/Com Interface MUCH SLOWER
Replies: 22
Views: 1114

Re: Function in external file with try/catch/Com Interface MUCH SLOWER

UpdateCell(X1.Sheets("Sheet2").Range("C" My_Index).Select) Again, this will perform the COM interface call an pass the result to the function UpdateCell() . No. Since the parameter is passed byRef the parameter is a reference or pointer to the COM Interface call that is executed inside the function...
by aircooled
27 Jan 2020, 06:02
Forum: Ask For Help
Topic: Function in external file with try/catch/Com Interface MUCH SLOWER
Replies: 22
Views: 1114

Re: Function in external file with try/catch/Com Interface MUCH SLOWER

I expect the function to perform the COM Interface call sent as parameter. This COM Interface call will just highlight the cell: UpdateCell(X1.Sheets("Sheet2").Range("C" My_Index).Select) [Don't care about the function name. I've been reducing the script more and more to circle in the issue, the nam...
by aircooled
27 Jan 2020, 02:54
Forum: Ask For Help
Topic: Function in external file with try/catch/Com Interface MUCH SLOWER
Replies: 22
Views: 1114

Re: Function in external file with try/catch/Com Interface MUCH SLOWER

Yes, sure, no problem. This script executes in a few sec never fails, have now tested 20 times. X1 := ComObjCreate(("Excel.Application")) X1.Workbooks.Open("C:\Users\aircooled\Private\My_Book.xlsx") X1.Visible:=True My_Index := 1 Loop, 1000 { loop { try (X1.Sheets("Sheet2").Range("C" My_Index).Selec...
by aircooled
26 Jan 2020, 16:36
Forum: Ask For Help
Topic: Function in external file with try/catch/Com Interface MUCH SLOWER
Replies: 22
Views: 1114

Re: Function in external file with try/catch/Com Interface MUCH SLOWER

Thanks for your response. At this point when we don't know what version of Excel you and I are using, or AHK version, or OS or other parameters I find a little too early to agree with your conclusion. I appreciate your effort, thank you for your time. Now I would gladly like to hear a third opinion ...
by aircooled
26 Jan 2020, 10:53
Forum: Ask For Help
Topic: Function in external file with try/catch/Com Interface MUCH SLOWER
Replies: 22
Views: 1114

Re: Function in external file with try/catch/Com Interface MUCH SLOWER

If this exact code: Xl := ComObjActive("Excel.Application") Loop, 70 { Random, VAR1, 1, 100 Random, VAR2, 1, 100 TTL := Add(VAR1, VAR2) xl.range("A" a_index).value := Var1 xl.range("B" a_index).value := Var2 xl.range("C" a_index).value := TTL } return Add(x, y){ return x + y ; "Return" expects an e...
by aircooled
25 Jan 2020, 16:25
Forum: Ask For Help
Topic: Function in external file with try/catch/Com Interface MUCH SLOWER
Replies: 22
Views: 1114

Re: Function in external file with try/catch/Com Interface MUCH SLOWER

Here are my findings. First I implement a very simple function in an external file and perform a simple addition. It executes fast and without errors so that rules out external function per se as the culprit in the errors I get: External function: Add(x, y) { return x + y ; "Return" expects an expre...
by aircooled
25 Jan 2020, 06:15
Forum: Ask For Help
Topic: Extracting data from Multiple line clipboard
Replies: 4
Views: 257

Re: Extracting data from Multiple line clipboard

FileAppend, %Clipboard%, %My_Temp_File% FileReadLine, LINE1, %My_Temp_File%, 1 FileReadLine, LINE2, %My_Temp_File%, 2 LINE2 := Mid(%LINE2%,2,4) FileReadLine, LINE12, %My_Temp_File%, 12 FileDelete, %My_Temp_File% FileAppend creates My_Temp_File if it is not already created. Not sure if you need %. Pr...
by aircooled
25 Jan 2020, 06:09
Forum: Ask For Help
Topic: Function in external file with try/catch/Com Interface MUCH SLOWER
Replies: 22
Views: 1114

Re: Function in external file with try/catch/Com Interface MUCH SLOWER

Yes I have tried to remove the sleeps and then the error is trigged. The error pops up when too many COM Interface calls are done in too short period of time. Also it doesn't matter if I have sleep in the code AND in the external file. What counts is the total amount of sleep before a transaction or...
by aircooled
25 Jan 2020, 04:28
Forum: Ask For Help
Topic: Function in external file with try/catch/Com Interface MUCH SLOWER
Replies: 22
Views: 1114

Re: Function in external file with try/catch/Com Interface MUCH SLOWER

Hi Xeo786 nad thanks for your proposal. At the moment I am testing with a fresh Excel sheet with no formulas on it only one sheet with a manually inserted index 1....50 in A1:A50 and some random numbers B1:B50 This is just to prove that the issue is not from the Excel being heavy. I will study and t...
by aircooled
24 Jan 2020, 11:45
Forum: Ask For Help
Topic: Function in external file with try/catch/Com Interface MUCH SLOWER
Replies: 22
Views: 1114

Function in external file with try/catch/Com Interface MUCH SLOWER

I had problems with a series of COM Interface calls. They trigged an error: "Error: 0x80010001 - Call was rejected by callee" which I worked around by inserting ridiculously large delays between transactions, up to 1200-1500ms. So try/catch for each and every Excel COM Interface was implemented in t...
by aircooled
24 Jan 2020, 10:19
Forum: Ask For Help
Topic: Writing a try/catch statement in ONE (1) line
Replies: 10
Views: 517

Re: Writing a try/catch statement in ONE (1) line

TLM wrote:
23 Jan 2020, 09:01
aircooled wrote:
22 Jan 2020, 11:13
Is it possible to write this statement in a single line?
The short answer is no.
Ok, thanks.

One last question. Observing at the try block above:

Code: Select all

try (X1.Range("A1").Value := "=ROW()", error:=0)
can the 2 statements inside the parenthesis be considered 2 different statements in 1 line?
by aircooled
23 Jan 2020, 02:43
Forum: Ask For Help
Topic: Writing a try/catch statement in ONE (1) line
Replies: 10
Views: 517

Re: Writing a try/catch statement in ONE (1) line

Can anyone On Topic tip on how to write a series of commands in one (1) line like it can be done in other programming languages. It's important (don't know if it makes a difference) that it includes a try/catch of a COM Interface call, for example: loop { try (X1.Range("A1").Value := "=ROW()", error...
by aircooled
22 Jan 2020, 18:11
Forum: Ask For Help
Topic: Writing a try/catch statement in ONE (1) line
Replies: 10
Views: 517

Re: Writing a try/catch statement in ONE (1) line

u can chain functions with a comma a(), b(), c() (not recommended) u can chain some commands, legacy IfEqual (super not recommended) u cant chain keywords also i dont understand ur construct, ure misusing the concept of try/catch: loop { try (X1.Range("A1").Value := "=ROW()", error:=0) catch error ...
by aircooled
22 Jan 2020, 12:37
Forum: Ask For Help
Topic: Writing a try/catch statement in ONE (1) line
Replies: 10
Views: 517

Re: Writing a try/catch statement in ONE (1) line

https://www.autohotkey.com/docs/commands/Try.htm I think closest you could do is a function that does a try/catch inside. OK, yeah, that could be an option. But the question I wish to anwer now is can the above or any group of commands be written in one line, semicolon separated or whatever? This c...
by aircooled
22 Jan 2020, 11:13
Forum: Ask For Help
Topic: Writing a try/catch statement in ONE (1) line
Replies: 10
Views: 517

Writing a try/catch statement in ONE (1) line

Is it possible to write this statement in a single line? Don't ask me why, I just want to do it. I am thinking of semi colon separated, or colon, or comma or something else. Everything in a single line: loop { try (X1.Range("A1").Value := "=ROW()", error:=0) catch error sleep 10 if (!error) break }
by aircooled
21 Jan 2020, 09:58
Forum: Pulovers Macro Creator
Topic: try/catch in COM Interface calls not working in PMC (workaround)
Replies: 0
Views: 133

try/catch in COM Interface calls not working in PMC (workaround)

This scenario involves several COM Interface Excel calls that were a little tricky to solve. I have solved it and it works but the solution is not so straight forward. I would like to know if the COM Interface editor in Pulover Macro Creator can be setup to avoid this situation. I have a loop that c...
by aircooled
19 Jan 2020, 12:57
Forum: Ask For Help
Topic: COM Interface calls to Excel fail randomly. Try?
Replies: 7
Views: 430

Re: COM Interface calls to Excel fail randomly. Try?

Problem solved. Was a little tricky. Autohotkey can in the normal case handle outer A_Index and inner A_Index, for example: loop { X1.Sheets("Sheet 1").Range( "A" . A_Index ).Copy loop { X1.Sheets("Sheet 1").Range( "B" . A_Index ).Select } } This worked beatifully in my old code without try catch. A...
by aircooled
19 Jan 2020, 03:43
Forum: Ask For Help
Topic: COM Interface calls to Excel fail randomly. Try?
Replies: 7
Views: 430

Re: COM Interface calls to Excel fail randomly. Try?

Thanks a lot aifritz and TLM your suggestions are working just fine. A great plus is that I have decreased the delays from 1200ms to 10ms and it works! I can see how it hacks a little in some cells where it fails and makes a couple of loops until it succeeds. A minor detail is that the loop's own A_...

Go to advanced search