Code: Select all
try return comobjtype(xl, 'iid') == 'Excel' ? xl : xl := comobjactive('excel.application')
Any ideas? Is there something about the construction of this line that's no longer allowed?
Code: Select all
try return comobjtype(xl, 'iid') == 'Excel' ? xl : xl := comobjactive('excel.application')
I took this statement as fact and asked this to be moved to bug reports, perhaps that was premature because it seems it does depend on something, as I cannot reproduce the error you describe.I keep getting an error with the following line, which doesn't really depend on anything
Code: Select all
global xl := 0
SetTimer(() => ToolTip(IsObject(xl)), 10)
q::
xl(*) {
try return comobjtype(xl, 'iid') == 'Excel' ? xl : xl := comobjactive('excel.application')
}
w::xl := ''
no. classnames were turned into constants. bugs might have been introduced but we cant know that since u still havent shown the code that doesnt work. so please do, we can leave the baseless speculations for some other timeDid these namespaces get merged in the last few updates leading to a112?
Change the function name but not the variable name. I am sure you will still get the error, because it has nothing to do with the function. There is almost definitely a class named xl, and renaming your variable avoids the conflict with that class.sirksel wrote: The function is also named xl(). If I change the variable name to any other super-global name, it works.
Code: Select all
xl() { ;refresh global excel comobject
try return comobjtype(xl, 'iid') == 'Excel' ? xl : xl := comobjactive('excel.application') ;code fails at first pass HERE
;xmb('Excel application not running.') ;This functions exits thread with msgbox, but it's failing before it gets here.
}
Code: Select all
Error: Not allowed as an output variable.
Specifically: xl
Line#
1960: }
1963: {
1964: (msg != '') ? mbx(msg) :0
1965: exit(cod)
1966: }
1968: {
1969: Try
---> 1969: Return comobjtype(xl, 'iid') == 'Excel' ? xl : xl := comobjactive('excel.application')
1970: msgbox('Excel application not running.')
1971: exit()
1973: }
1975: {
1977: {
1977: Return send('^1<100>^{tab}a!h{esc}')
1977: }
The program will exit.
Code: Select all
global xl := 0
class xl{
}
xl(*) {
try return comobjtype(xl, 'iid') == 'Excel' ? xl : xl := comobjactive('excel.application')
}
msgbox('done')
Code: Select all
Error: Not allowed as an output variable.
Specifically: xl
Line#
001: xl := 0
002: {
000: }
004: {
005: Try
---> 005: Return comobjtype(xl, 'iid') == 'Excel' ? xl : xl := comobjactive('excel.application')
006: }
007: msgbox('done')
008: Exit
The program will exit.
Users browsing this forum: RaptorX and 38 guests