|
有一段脚本:
'Just an example for getting a Java array from some object
set comps = JavaWindow("SwingSet").JavaInternalFrame("Internal Frame Generator").Object.getComponents()
'getComponents()有这个方法么,我在JAVA插件的帮助文件里没看到有这个方法。
'This is the actual workaround - notice the special undocumented command mic_arr_get
set currComp = comps.mic_arr_get(0)
'Now that we have the item we want from the array, let’s print it
msgbox currComp.toString()
下面说的这些方法是从那里来的。。。
According to Tsachi there are two such methods:
mic_arr_get – Receives an index and returns the item at that index in the array. The returned item will always be an object (so we have to use .ToString).
mic_arr_set – Receives an index and an object and sets the appropriate item in the array.
There’re also more sophisticated versions for mic_arr_get: instead of returning an object and then turning it into a sting (or an integer, etc), you can perform both actions in a single action by using these specialized methods:
mic_arr_get_int : will return the data as an integer
mic_arr_get_char : will return the data as a single char
mic_arr_get_double : will return the data as a double (real) number
mic_arr_get_long : will return the data as a long number
mic_arr_get_short : will return the data as a short number
mic_arr_get_byte : will return the data as a byte number
mic_arr_get_boolean : will return the data as a boolean
Similarly, you can use the specialized methods for inserting specific data-types into an array:
mic_arr_set_int
mic_arr_set_char
mic_arr_set_double
mic_arr_set_long
mic_arr_set_short
mic_arr_set_byte
mic_arr_set_boolean |
|