找回密码
 加入
搜索
查看: 3224|回复: 11

[AU3基础] 请高手看一下,为什么脚本运行会出错

 火.. [复制链接]
发表于 2011-10-4 13:11:08 | 显示全部楼层 |阅读模式
请高手看一下,为什么脚本运行会出错

Global $tab1_view[25],$treeview1


$tab1_view[1]=GUICtrlCreateTreeViewItem("a",$TreeView1)
  $tab1_view[2]=GUICtrlCreateTreeViewItem("b",$TreeView1)
  $tab1_view[3]=GUICtrlCreateTreeViewItem("c",$TreeView1)
  $tab1_view[4]=GUICtrlCreateTreeViewItem("d",$TreeView1)
  $tab1_view[5]=GUICtrlCreateTreeViewItem("e",$TreeView1)
  $tab1_view[6]=GUICtrlCreateTreeViewItem("f",$TreeView1)
  $tab1_view[7]=GUICtrlCreateTreeViewItem("g",$TreeView1)
  $tab1_view[8]=GUICtrlCreateTreeViewItem("h",$TreeView1)
  $tab1_view[9]=GUICtrlCreateTreeViewItem("i",$TreeView1)
  $tab1_view[10]=GUICtrlCreateTreeViewItem("j",$TreeView1)
  $tab1_view[11]=GUICtrlCreateTreeViewItem("k",$tab1_view[10])
  $tab1_view[12]=GUICtrlCreateTreeViewItem("l",$tab1_view[10])
  $tab1_view[13]=GUICtrlCreateTreeViewItem("m",$tab1_view[10])
  $tab1_view[14]=GUICtrlCreateTreeViewItem("n",$tab1_view[10])
  $tab1_view[15]=GUICtrlCreateTreeViewItem("o",$tab1_view[10])
  $tab1_view[16]=GUICtrlCreateTreeViewItem("p",$tab1_view[10])
  $tab1_view[17]=GUICtrlCreateTreeViewItem("q",$TreeView1)
  $tab1_view[18]=GUICtrlCreateTreeViewItem("r",$tab1_view[17])
  $tab1_view[19]=GUICtrlCreateTreeViewItem("s",$tab1_view[17])
  $tab1_view[20]=GUICtrlCreateTreeViewItem("t",$tab1_view[17])
  $tab1_view[21]=GUICtrlCreateTreeViewItem("u",$tab1_view[17])
  $tab1_view[22]=GUICtrlCreateTreeViewItem("v",$tab1_view[17])
$tab1_view[23]=GUICtrlCreateTreeViewItem("w",$tab1_view[17])
  $tab1_view[24]=GUICtrlCreateTreeViewItem("x",$tab1_view[17])
  $tab1_view[25]=GUICtrlCreateTreeViewItem("y",$tab1_view[17])

编译错误提示信息如下:
$tab1_view[25]=GUICtrlCreateTreeViewItem("y",$tab1_view[17])
^ ERROR


明明声明了25个变量,为什么提示最后一个出错
当把上面
Global $tab1_view[25] 改成
Global $tab1_view[26]
就不提示出错了
但这样我后面的很多功能都实现不了了
是不是数组维数有问题
帮助中哪边有数组的详细介绍。




还有一错误也是
If StringLeft($dir_number[$i],StringLen($dir_prefix))= $dir_prefix  Then
MsgBox(0,"提示",StringLeft($dir_number[$i],StringLen($dir_prefix)))
Endif

也提示错误
If StringLeft(^ ERROR


变量都声明了
 楼主| 发表于 2011-10-4 13:12:31 | 显示全部楼层
用ubound测试也是25,为什么编译就出错
发表于 2011-10-4 13:48:41 | 显示全部楼层
数组下标是从0开始的
25个,代表:$tab1_view[0],$tab1_view[1],.....,$tab1_view[24]
发表于 2011-10-4 13:50:48 | 显示全部楼层
哎~~~~这个偶不懂   帮顶
 楼主| 发表于 2011-10-4 16:25:31 | 显示全部楼层
本帖最后由 zlmyongheng 于 2011-10-4 16:26 编辑

可不可以定义从1开始,
发表于 2011-10-4 16:47:39 | 显示全部楼层
回复 5# zlmyongheng


    可以将数组定义为$tab1_view[26],从1开始使用,$tab1_view[0]空置,也许就可以吧
发表于 2011-10-4 18:15:18 | 显示全部楼层
又见到这个想当鸡的……   不怕封号么
发表于 2011-10-4 19:32:04 | 显示全部楼层
3楼正解!
发表于 2011-10-4 22:56:17 | 显示全部楼层
一般[0]让他返回一个数组的数量
发表于 2011-10-4 23:17:23 | 显示全部楼层
可不可以定义从1开始,
zlmyongheng 发表于 2011-10-4 16:25


试试enum
发表于 2011-10-4 23:44:29 | 显示全部楼层
数组下标是从0开始的
25个,代表:$tab1_view[0],$tab1_view[1],.....,$tab1_view[24]
happytc 发表于 2011-10-4 13:48

这个说的对啊~数组都是从0开始的~你从1开始当然要少一个!要不就改变维度!!!
发表于 2011-10-8 22:38:51 | 显示全部楼层
3楼正解。。我也碰到过。 0带表1   25实际是24 这郁闷了我好久。如果你非用25的话就多声明一个。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-20 23:42 , Processed in 0.156087 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表