Jump to content

array problems w/ stringsplit


Recommended Posts

#include <GUIConstants.au3>

$skypeWinStatus = "c"

$winText = "a"

$a = 0

$counter1 = 0

$time = FileGetTime(@Windowsdir & "\Notepad.exe", 1)

Global $winText = WinGetText ("Target Skype Window", "")

Global $array = StringSplit(StringReplace($winText, "Call Duration 00:01", @LF), @LF)

hotkeyset("{F5}", "finished")

Global $skypeWindow = winGetHandle("classname=tSkMainForm.UnicodeClass")

Global $skypeTestAlive = WinGetState($skypeWindow)

if @error then

msgbox(0, "error", "window could not be found")

endif

winSetTitle($skypeWindow, "Contacts", "Target Skype Window")

$winText = winGetText($skypeWindow, "")

createGUI()

getSkypeHandle()

moveSkypeWin()

makePhoneCall()

func getSkypeHandle()

Global $skypeWindow = winGetHandle("Skype Call Feedback - Mozilla Firefox")

Global $mozillaWindow = winGetHandle("classname=MozillaUIWindowClass")

Global $skypeTestAlive = WinGetState($skypeWindow)

Global $mozillaTestAlive = winGetState($mozillaWindow)

if @error then

msgbox(0, "error", "window could not be found")

endif

GUICtrlSetData (-1, "testing for firefox")

if $mozillaTestAlive = 1 then

winkill($mozillaWindow)

endif

winSetTitle($skypeWindow, "Contacts", "Target Skype Window")

$winText = winGetText($skypeWindow, "")

GUICtrlSetData (-1, "getting Window handle")

endfunc

func moveSkypeWin()

winsetState($skypeWindow, "", @SW_RESTORE)

WinMove($skypeWindow, "", 1, 2, 200, 600)

GUICtrlSetData (-1, "moving skype window")

endfunc

func makePhoneCall()

while $counter1 < 3

$time = FileGetTime(@Windowsdir & "\Notepad.exe", 1)

GUICtrlSetData (-1, "entering phone number")

ControlSend($skypeWindow, "", "", "{TAB}", 0)

ControlSend($skypeWindow, "", "", "{TAB}", 0)

sleep(1000)

if $counter1 = 0 then

$phoneNum = IniRead("settings.ini", "PhoneNumbers", "Phone1", "4166482182")

elseif $counter1 = 1 then

$phoneNum = IniRead("settings.ini", "PhoneNumbers", "Phone2", "4166482182")

elseif $counter1 = 2 then

$phoneNum = IniRead("settings.ini", "PhoneNumbers", "Phone3", "4166482182")

else

$phoneNum = IniRead("settings.ini", "PhoneNumbers", "Phone3", "4166482182")

endif

send($phoneNum)

send("{ENTER}")

while $a < 1

$array = StringSplit(StringReplace($winText, "Call Duration 00:01", @LF), @LF)

$winText = winGetText($skypeWindow, "")

$time = FileGetTime(@Windowsdir, 0, 0)

GUICtrlSetData (-1, $array[0])

sleep(2000)

if $array[0] = 4 then

GUICtrlSetData (-1, "they answered the phone! lawl!")

SoundPlay ("gocrazy.wav", 1)

$a = 1

elseif $array[1] = "Call Duration 00:01" then

GUICtrlSetData (-1, "they answered! lawl!")

SoundPlay ("gocrazy.wav", 1)

$a = 1

elseif $array[2] = "Call Duration 00:01" then

GUICtrlSetData (-1, "they answered! lawl!")

soundplay("gocrazy.wav", 1)

$a = 1

elseif $array[0] = "2" then

GUICtrlSetData (-1, "call ended somehow")

SoundPlay("byebye.wav", 0)

$a = 1

elseif $time[5] = 59 then

GUICtrlSetData (-1, "time ran out baby.")

$a = 1

elseif $time[5] = 58 then

GUICtrlSetData (-1, "time ran out baby.")

$a = 1

elseif $time[5] = 57 then

GUICtrlSetData (-1, "time ran out baby.")

$a = 1

endif

wEnd

sleep(2000)

send("{ESC}")

GUICtrlSetData (-1, "call ended")

sleep(2000)

$a = 0

getSkypeHandle()

moveSkypeWin()

sleep(2000)

$counter1 = $counter1 + 1

wEnd

$counter1 = 0

makePhoneCall()

endfunc

func finished()

Exit

endfunc

;output window settings

func createGUI()

GUICreate("Output", 250, 250, 401, 1)

GUISetState (@SW_SHOW)

GUISetBkColor(0x62940F)

GUISetFont(9, 300)

GUICtrlCreateEdit ("Output", 5, 5 , 250 , 250)

winsetState("Output", "", @SW_DISABLE)

WinActivate ("Target Skype Window")

endfunc

while 1

$MSG = GuiGetMsg()

if $MSG = $GUI_EVENT_CLOSE then

Exitloop

endif

wEnd

this is my autoit program, for the program skype. it automatically makes phonecalls to people, and if they pick up, it plays a sound. anyhow, for some reason, its giving me an array out of bounds or something error:

happens on line 106

elseif $array[2] = "call duration 00:01" then

elseif ^ERROR

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

anyways, what am i missing? what am i doing wrong? i did a test earlier to see if the value exists. and it does. because i made it print everything to a notepad window, and it printed out 3 things: array[0], array[1], and array[2] so.. im boggled. help plz :)

this was made, just as a test of my programming abilities.

Edited by 0_00_0
Link to post
Share on other sites

this is my autoit program, for the program skype. it automatically makes phonecalls to people, and if they pick up, it plays a sound. anyhow, for some reason, its giving me an array out of bounds or something error:

heres a pic:

Posted Image

Skype Annoyer.au3? :P

And you want help pulling that kind of stunt on people? :)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...