accessrichard / autoitx4java

Automatically exported from code.google.com/p/autoitx4java
40 stars 24 forks source link

java.lang.IllegalStateException: getInt() only legal on Variants of type VariantInt, not 8 #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
hi,
I am using Win7 64bit.

x=new AutoItX();
x.controlListViewGetItemCount("", "", "[CLASS:SysTreeView32; INSTANCE:1]");

i am getting :
java.lang.IllegalStateException: getInt() only legal on Variants of type 
VariantInt, not 8
    at com.jacob.com.Variant.getInt(Variant.java:650)
    at demo.winstarter.AutoItX.controlListViewInt(AutoItX.java:1650)
    at demo.winstarter.AutoItX.controlListViewGetItemCount(AutoItX.java:1678)
    at demo.winstarter.Base.main(Base.java:61)

For every function of that return void, i don't have any problem to run ,
Other functions that return String / int the above error is appear.

Original issue reported on code.google.com by erez...@gmail.com on 23 Jul 2014 at 1:10

neha23vish commented 7 years ago

I am also getting same issue java.lang.IllegalStateException: getInt() only legal on Variants of type VariantInt, not 8 while calling controlListViewGetItemCount Any one found solution for this?

garimamathur16 commented 7 years ago

Hi, Any luck on the above issue? I just encountered similar issue. Please share if you have a resolution. Thanks.

nuntachaiaree commented 6 years ago

Change code AutoItX.java line 672 to

return Integer.parseInt( this.controlView( title, text, control, command, option, option2, "ControlListView").getString() );

nongdonghui commented 6 years ago

This is my code, it works

private Variant errorCode = new Variant(1, true);
public Variant getErrorCode() {
    return errorCode;
}

int errorCode = Integer.parseInt(getErrorCode().toString());