Sign in to follow this  
Followers 0
zakiller

Subscript used with non-Array variable error

3 posts in this topic

ok i make this script for sharing my page on fb in another pages but when i made something similar to it ... it worked fine without the non-array error but now it makes me a non-array error even if i writed this code in the error place so here is my script

sleep(1500)
MouseClick("left",102, 782,1,7)
Sleep(1500)
MouseClick("left",223, 15,1,7)
Sleep(1500)
MouseClick("left",245, 42,1,7)
Sleep(1500)
Send("^c")
Sleep(1500)
MouseClick("left",135, 12,1,7)
Sleep(1500)
MouseClick("left",308, 618,1,7)
Sleep(1500)
Send("^v")
Sleep(1500)
Send("{Enter}")
Sleep(1500)
Send("{End}")
Sleep(1500)
MouseClick("left",280, 546,1,7)
Sleep(1500)
$sharepage = PixelSearch(671, 465,859, 660,0x5972A6)
Sleep(1500)
If Not @error Then
MouseClick("left",$sharepage[0],$sharepage[1],1,7)
EndIf
If IsArray($sharepage) = True Then
EndIf
Sleep(1500)
MouseClick("left",46, 11,1,7)
Sleep(1500)
MouseClick("left",187, 42,1,7)
Sleep(1500)
Send("^c")
Sleep(1500)
MouseClick("left",187, 42,1,7)
Sleep(1500)
MouseClick("left",256, 735,1,7)
sleep(1800)
Send("{End}")
Sleep(1500)
$write_a_comment = PixelSearch(216, 119,932, 731,0x777777)
Sleep(1500)
If Not @error Then
MouseClick("left",$write_a_comment[0],$write_a_comment[1],1,7)
EndIf
If IsArray($write_a_comment) = True Then
EndIf
Send("^v")
Sleep(1500)
Send("{Enter}")
Sleep(1500)
Send("^w")

so plzzzz help me

Share this post


Link to post
Share on other sites



sorry this is the right post

ok i made this script for sharing my page on fb in another pages but when i made something similar to it in the past ... it worked fine without giving me the non-array error but now it makes me a non-array error even if i writed this code in the error place

if not @error then

endif

so here is my script

sleep(1500)
MouseClick("left",102, 782,1,7)
Sleep(1500)
MouseClick("left",223, 15,1,7)
Sleep(1500)
MouseClick("left",245, 42,1,7)
Sleep(1500)
Send("^c")
Sleep(1500)
MouseClick("left",135, 12,1,7)
Sleep(1500)
MouseClick("left",308, 618,1,7)
Sleep(1500)
Send("^v")
Sleep(1500)
Send("{Enter}")
Sleep(1500)
Send("{End}")
Sleep(1500)
MouseClick("left",280, 546,1,7)
Sleep(1500)
$sharepage = PixelSearch(671, 465,859, 660,0x5972A6)
Sleep(1500)
If Not @error Then
MouseClick("left",$sharepage[0],$sharepage[1],1,7)
EndIf
If IsArray($sharepage) = True Then
EndIf
Sleep(1500)
MouseClick("left",46, 11,1,7)
Sleep(1500)
MouseClick("left",187, 42,1,7)
Sleep(1500)
Send("^c")
Sleep(1500)
MouseClick("left",187, 42,1,7)
Sleep(1500)
MouseClick("left",256, 735,1,7)
sleep(1800)
Send("{End}")
Sleep(1500)
$write_a_comment = PixelSearch(216, 119,932, 731,0x777777)
Sleep(1500)
If Not @error Then
MouseClick("left",$write_a_comment[0],$write_a_comment[1],1,7)
EndIf
If IsArray($write_a_comment) = True Then
EndIf
Send("^v")
Sleep(1500)
Send("{Enter}")
Sleep(1500)
Send("^w")

so plzzzz help me

Share this post


Link to post
Share on other sites

zakiller,

Welcome to the AutoIt forum. :)

You have your IsArray test in the wrong place. ;)

$sharepage = PixelSearch(671, 465,859, 660,0x5972A6)
Sleep(1500) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @error is set by this line, not the one above
If Not @error Then ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< And Sleep never returns a error so...
    MouseClick("left",$sharepage[0],$sharepage[1],1,7) ; << this line will always execute even if there is no array
EndIf
If IsArray($sharepage) = True Then ; <<<<<<<<<<<<<<<<<<<<<< And this is too late
EndIf

Try something like this:

$sharepage = PixelSearch(671, 465,859, 660, 0x5972A6)
Sleep(1500)
; Now check if the pixel was found
If IsArray($sharepage) Then
    ; And only click if it was found
    MouseClick("left", $sharepage[0], $sharepage[1], 1, 7)
Else
    ; Whatever you do if you do not find the pixel
EndIf

M23

P.S. This thread was reported. The Forum Rules prohibit spamming and login scripts - I see no evidence of that here. ;)


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0