Jump to content

Recommended Posts

Posted

$nettadr = StringSplit(GUICtrlRead(GUICtrlRead($listview)), "|", "")
FileWrite (@workingdir&"\info.txt", $nettadr[7])

This works if I have selected something in the $Listview

But if I haven't selected anything I get an Autoit Error:

Error: Array variable has incorrect number of subscripts or subscript dimension range exceeded

and the application closes

And I can't figure out how to prevent it from getting that error and close.

I jsut want it to popup a msgbox saying I have to choose something

But realy can't figure out how to!

Any help is appreciated

Tommy

Posted


i believe its because your trying to force an array into a non array variable, like its trying to split the entire list since nothing is selected
are you using dim nettadr[max array length] befor this?
also u can try using 
if guictrlread($listview) = "" then
msgbox(0,"title","Must select an item first")
else
$nettadr = StringSplit(GUICtrlRead(GUICtrlRead($listview)), "|", "")
FileWrite (@workingdir&"\info.txt", $nettadr[7])
endif

if that doesnt help and ur not using dim or another function to create an array let me know and ill try to be of more help


            
        

        

        
    

    
    

    

                    
                    
                        
                    
                    
                

                    

                    
                    






    

    

    
        
            
                


    
        
    

                
                
                    
                        

                    
                
            
        
        
            
                


Deathboy
            
            
                Posted 
                
            
        
    
    
        


Deathboy
            
        
        
            
                
                    


    
        
    

                    
                    
                        

                    
                
            
            
                Active Members
                
            
            
                
                    
                        
                            
                                
                            
                                 30
                            
                                
                            
                        
                        
                    
                
            
            
                

            
        
    
    
        



    
        
            
                
                    
                        Author
                    
                    
                    
                    
                    
                
            
            
                
                    
                    
                        
                        
                        
                        
                        
                        
                            
                                
                            
                            
                            
                            
                            
                            
                        
                    
                
                
            
        

        
           
           Posted 
           
            
            
                
                
            
        
    

    

    

    
        
        
            
 
i believe its because your trying to force an array into a non array variable, like its trying to split the entire list since nothing is selected

are you using dim nettadr[max array length] befor this?

also u can try using

if guictrlread($listview) = "" then

msgbox(0,"title","Must select an item first")

else

$nettadr = StringSplit(GUICtrlRead(GUICtrlRead($listview)), "|", "")

FileWrite (@workingdir&"\info.txt", $nettadr[7])

endif

if that doesnt help and ur not using dim or another function to create an array let me know and ill try to be of more help

AAh hahah ofc simple guictrlread ^^ i tried with the _GUICtrlListView_... commands but couldn't figure it out.

Didn't use DIM but don't need to either. Worked great vith the guictrlread

Thanks alot!!!

Tommy :mellow:

Posted

heh alright im new at doing arrays so i thought dim was always needed :mellow: but yw for the gui help lol

Dunno if you wanna know, but the array was created from splitstring command that I used for a listview:

$nettadr = StringSplit(GUICtrlRead(GUICtrlRead($listview)), "|", "")
FileWrite (@workingdir&"\info.txt", $nettadr[7]) ;will show the "words" after the 6th seperator, 0 is seperator1

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
×
×
  • Create New...