Jump to content

Syntax for multiple parameters in object calls


Recommended Posts

hi,

As this was not working when I wrote the ExcelCOM UDF, I used scripting object and vbscript.

There was a note that it had been fixed, but I cannot find syntax that works, as empty parameters are apparently NOT accepted.

Can this be fixed, or is there alternative syntax in AutoIt syntax?

Thanks, Randallc

1. Sort (examples with xls in zip)

2. Import.

3. Charts.

etc

Link to comment
Share on other sites

eg; in above zipped examples

>Running:(3.1.1.127):C:\Program Files\AutoIt3\beta\autoit3.exe "C:\Programs\SearchEngine\XLSort2.au3"    
C:\Programs\SearchEngine\XLSort2.au3 (18) : ==> The requested action with this object has failed.: 
.Application.Selection.Sort ($objrange1, $i_Direction1,$objRange2,False,$i_Direction2,False,False,False,2, False,1) 
.Application.Selection.Sort ($objrange1, $i_Direction1,$objRange2,False,$i_Direction2,False,False,False,2, False,1)^ ERROR
+>AutoIT3.exe ended.rc:0
>Exit code: 0    Time: 2.360
oÝ÷ Ù©Ýjëh×6.Application.Selection.Sort ($objrange1, $i_Direction1,$objRange2,,$i_Direction2,,,0,2, ,1)
gives syntax error at the empty parameters.

Thanks, Randall

Link to comment
Share on other sites

Try:

.Application.Selection.Sort ($objrange1, $i_Direction1,$objRange2,Default,$i_Direction2,Default,Default,0,2,Default,1)

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Hi,

No luck here; did you try it?

>Running:(3.1.1.127):C:\Program Files\AutoIt3\beta\autoit3.exe "C:\Programs\SearchEngine\XLSort2.au3"    
C:\Programs\SearchEngine\XLSort2.au3 (19) : ==> The requested action with this object has failed.: 
.Application.Selection.Sort ($objrange1, $i_Direction1,$objRange2,Default,$i_Direction2,Default,Default,0,2, Default,1) 
.Application.Selection.Sort ($objrange1, $i_Direction1,$objRange2,Default,$i_Direction2,Default,Default,0,2, Default,1)^ ERROR
+>AutoIT3.exe ended.rc:0
>Exit code: 0    Time: 2.440
Best, Randallc

PS - Is there any documentation of this which I am not seeing in the Help File?

PPS - vbs works with; [as in zipped vbs]

.Application.Selection.Sort objrange1, Direction1,objRange2,,Direction2,,,0,2, False,1

Edited by randallc
Link to comment
Share on other sites

Hi,

No luck here; did you try it?

No, but this was added in beta 60 for COM functions... see the changelog:

Added : Usage of 'Default' keyword instead of empty arguments to COM functions (only valid if COM function supports it). (By SvenP)

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Perhaps "not supported";

I was about to do the "Import" to Excel as scripting object, but hoping to use autoIt instad...

Oh well..

Randallc

Hello Randallc,

The problem is not in the 'Default' argument, but it's about the Order3 argument in de Sort method. Somehow this argument does not seem to be optional in other languages.

It is a known issue, see a previous bug report: http://www.autoitscript.com/forum/index.php?showtopic=16157

(Hmm, seemed to be submitted by yourself a year ago?)

Your script will work when you replace the Order3 argument with the value 1:

.Application.Selection.Sort ($objrange1, $i_Direction1,$objRange2,Default,$i_Direction2,Default,1,Default,2, False,1)

Regards,

-Sven

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...