Jump to content

Subscript used with non-Array variable


Recommended Posts

I am new at Scripting . Please help me :D

#include <GUIConstants.au3>
#include <String.au3>
#include <array.au3>
#include <inet.au3>

reset()
Local $sonuc
Local $sonu[1]

$link = InputBox("ENTER", "Enter The URL", "", "")
#EndRegion ### END Koda GUI section ###
While 1
If Not $link = "" Then
$a = _INetGetSource($link)
$s = _StringBetween($a,'flv_url=','&amp;url_')
MsgBox(0,"",$s[0])
$s2 = _StringBetween($s[0],'.com_','.flv')
;~ MsgBox(0,"",$sonu[0])
$dw = $s[0] & "&OBT_fname=sitename.com_" & $s2[0] & ".flv"
MsgBox(0,"",$dw)
ClipPut($dw)
reset()
Exit
Else
Exit
EndIf
WEnd


Func reset()
$a = ""
$s = ""
$s2 = ""
$dw = ""
EndFunc
Link to comment
Share on other sites

  • Moderators

TheRock,

First, welcome to the AutoIt forums. A good start - some code to work on and a clear question. I wish some other newcomers would do the same. :-)

From what I can see, your problem arises when $s is not a variable - i.e. _StringBetween returns an error, not an array. I have modified your script to add a bit of errorchecking:

#include <GUIConstants.au3>
#include <String.au3>
#include <array.au3>
#include <inet.au3>

Local $sonuc
Local $sonu[1]

reset()
$link = InputBox("ENTER", "Enter The URL", "", "")

While 1
    If Not $link = "" Then
        $a = _INetGetSource($link)
        $s = _StringBetween($a, 'flv_url=', '&amp;url_')
        If @error Then
            MsgBox(0, "", "The URL was not valid")
            Exit
        Else
            MsgBox(0, "", $s[0])
            $s2 = _StringBetween($s[0], '.com_', '.flv')
;~ MsgBox(0,"",$sonu[0])
            $dw = $s[0] & "&OBT_fname=sitename.com_" & $s2[0] & ".flv"
            MsgBox(0, "", $dw)
            ClipPut($dw)
            reset()
            GUICtrlSetData($link, "")
            Exit
        EndIf
    Else
        Exit
    EndIf
WEnd

Func reset()
    $a = ""
    $s = ""
    $s2 = ""
    $dw = ""
EndFunc  ;==>reset

I hope that works better. You do use _StringBetween again to get $s2 - but I am sure you can add the errorcheck for that yourself now. ;-)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...