micechal Posted November 15, 2012 Share Posted November 15, 2012 Hi. I tried searching, but found nothing, so there is my problem: I'm trying to make a program, which will press hotkeys in user's defined intervals. The hotkey's quantity is represented by a variable which is assigned from InputBox. The problem is, that I can't change a value in array's element. This is the code: #include <array.au3> $ilosc = InputBox("Ilość scen","Podaj ilość scen, pomiędzy którymi chcesz się przełączać") Global $arr[$ilosc] $interwal = InputBox("Interwał czasowy","Podaj w sekundach odstęp czasowy między kolejnymi przełączeniami") For $i=0 To $ilosc Global $arr[$i] = InputBox("Skrót " & $i,"Dawaj") Next And the error: Global $arr[$i] = InputBox("Skrót " & $i,"Dawaj") Global $arr[^ ERROR What am I doing wrong? Link to comment Share on other sites More sharing options...
Developers Jos Posted November 15, 2012 Developers Share Posted November 15, 2012 try: $ilosc = InputBox("Ilosc scen", "Podaj ilosc scen, pomiedzy którymi chcesz sie przelaczac") Global $arr[$ilosc] $interwal = InputBox("Interwal czasowy", "Podaj w sekundach odstep czasowy miedzy kolejnymi przelaczeniami") For $i = 0 To $ilosc -1 $arr[$i] = InputBox("Skrót " & $i, "Dawaj") Next SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
micechal Posted November 15, 2012 Author Share Posted November 15, 2012 Thanks, now it works. The problem was Global? What does it do? Link to comment Share on other sites More sharing options...
Developers Jos Posted November 15, 2012 Developers Share Posted November 15, 2012 Global defines the whole Array as you already had done in the second line so you should not try to redefine it when setting a single entry in the array. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now