AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with list.

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
deportivo5



Joined: 05 Sep 2008
Posts: 44

PostPosted: Tue Jan 13, 2009 8:56 am    Post subject: Problem with list. Reply with quote

Hi guys.
im trying to do a list box. which shows the 3 timing that has been taken and also the average.
I cant seem to load all 3 values into the list.
Only 1 value goes in. When i click on the script again, it

Code:

SetWorkingDir %A_ScriptDir%

-----Stopwatch Start------------
Run Communicator
Loop
{
IfWinExist Microsoft Office Communicator
{
WinActivate
StartTime := A_TickCount
Run %A_ScriptDir%\off communicator.bat
break
}
Else
{
SoundBeep 0, 0 ; used to let the loop re-run.
}
}

-------StopWatch End-------------------
Loop
{
ImageSearch, Action1, Action2, 0, 0, A_ScreenHeight, %A_ScriptDir%\communicator.bmp
if ErrorLevel = 2
{
Msgbox, communicator.bmp cant be found
}
else if ErrorLevel = 1
{
Soundbeep 0, 0
}
else
{
ElapsedTime := (A_TickCount - StartTime)/1000 ;
Rounded := Round(ElapsedTime,2)
break
}
}

Gui, Add, ListView, r3 w300 MyListView, First Try|Second Try|Third Try|Average
Gui +Resize
Gui, font, s12
Gui, show, x0 y0, timelist
GuiControl, -Redraw, MyListView ; disable redraw
LV_Add(A_index, +Integer Rounded) ; A_index was added to supposedly used to determine the column number that i wish to put the new value)
GuiControl, +Redraw, MyListView
LV_ModifyCol() ; Auto-size each column to fit its contents.
Return

GuiEscape:
GuiClose:
Gui, Destroy
ExitApp

_________________
I have lost friends, some by death... others through sheer inability to cross the street.
Virginia Woolf (1882 - 1941),

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.


Last edited by deportivo5 on Fri Jan 16, 2009 9:08 am; edited 4 times in total
Back to top
View user's profile Send private message
Tseik



Joined: 09 Oct 2008
Posts: 180
Location: Finland

PostPosted: Tue Jan 13, 2009 9:38 am    Post subject: Reply with quote

heh =D use Return, not Sleep 100000000000000000
Back to top
View user's profile Send private message
deportivo5



Joined: 05 Sep 2008
Posts: 44

PostPosted: Tue Jan 13, 2009 10:23 am    Post subject: Reply with quote

haha
i tried putting the word RETURN
still the GUI disappear in an instant.

thanks for the effort though
^_^
_________________
I have lost friends, some by death... others through sheer inability to cross the street.
Virginia Woolf (1882 - 1941),

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.
Back to top
View user's profile Send private message
evan
Guest





PostPosted: Tue Jan 13, 2009 10:40 am    Post subject: Reply with quote

Gui part is good, its the loop problem
Code:
Gui, Add, ListView, r3 w300 MyListView, First Try|Second Try|Third Try|Average
Gui +Resize
GuiControl, -Redraw, MyListView
Gui, font, s12
Gui, show, x0 y0, hello
LV_ModifyCol(1, +Integer: %ElapsedTime%)
GuiControl, +Redraw, MyListView
return
GuiEscape:
GuiClose:
Gui, Destroy
ExitApp
Back to top
Tseik



Joined: 09 Oct 2008
Posts: 180
Location: Finland

PostPosted: Tue Jan 13, 2009 10:43 am    Post subject: Reply with quote

This works fine for me... if you remove loops

Code:
Gui, Add, ListView, r3 w300 MyListView, First Try|Second Try|Third Try|Average
Gui +Resize
GuiControl, -Redraw, MyListView
Gui, font, s12
Gui, show, x0 y0, hello
LV_ModifyCol(1, +Integer: %ElapsedTime%)
GuiControl, +Redraw, MyListView
Return ; Added cause somehow my GUI will close automatically.

GuiEscape:
GuiClose:
Gui, Destroy
ExitApp



Like evan said your loop is the problem
Back to top
View user's profile Send private message
Guest






PostPosted: Tue Jan 13, 2009 10:52 am    Post subject: Reply with quote

deportivo5 wrote:
haha
i tried putting the word RETURN
still the GUI disappear in an instant.

thanks for the effort though
^_^

And just where did you put the RETURN. Try this, it stays until gui is closed manualu
Code:
Gui, Add, ListView, r3 w300 MyListView, First Try|Second Try|Third Try|Average
Gui +Resize
GuiControl, -Redraw, MyListView
Gui, font, s12
Gui, show, x0 y0, hello
;LV_ModifyCol(1, +Integer: %ElapsedTime%) ; this line has a problem =  ':'
LV_ModifyCol(1, +Integer %ElapsedTime%)
GuiControl, +Redraw, MyListView
;Sleep 100000000000000000 ; Added cause somehow my GUI will close automatically.
return

GuiEscape:
GuiClose:
Gui, Destroy
ExitApp
Back to top
deportivo5



Joined: 05 Sep 2008
Posts: 44

PostPosted: Wed Jan 14, 2009 2:00 am    Post subject: Reply with quote

hey Guest,

I have done the changes as u suggested.
But still, I get an error.
Basically, I wish to record the timing how long my MSN will take to boot up and log in.
In the process, I will start the stop watch upon running the MSN.
When it is done, it will stop the time and publish in a GUI.
The .bat file will then kill off the MSN and the loop repeats with open of MSN again.
The 2nd timing will be recorded in the 2nd column.
And so for the third.
After the third, the GUI will show all 3 timings and the average timing.

My code on the 1st thread have been updated. But it is still uncomplete and Im stuck. Anyone can help?
_________________
I have lost friends, some by death... others through sheer inability to cross the street.
Virginia Woolf (1882 - 1941),

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.
Back to top
View user's profile Send private message
Ponyo
Guest





PostPosted: Fri Jan 16, 2009 2:33 am    Post subject: Reply with quote

is adding %A_Index% as ur row number a possible solution?
Back to top
deportivo5



Joined: 05 Sep 2008
Posts: 44

PostPosted: Fri Jan 16, 2009 3:23 am    Post subject: Reply with quote

updated my problem.
anyone can help?
need it urgently.
_________________
I have lost friends, some by death... others through sheer inability to cross the street.
Virginia Woolf (1882 - 1941),

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.
Back to top
View user's profile Send private message
Tseik



Joined: 09 Oct 2008
Posts: 180
Location: Finland

PostPosted: Fri Jan 16, 2009 4:38 am    Post subject: Reply with quote

Code:
Run Communicator


Does this part work? Or is it:

Code:
Run Communicator.exe


Are u using scite, u can doubleclick the errormessage and it tells where the problem locates. Or can u provide us some info about the error?[/code]
_________________
was i wrong, it makes me a very sad panda!
Back to top
View user's profile Send private message
deportivo5



Joined: 05 Sep 2008
Posts: 44

PostPosted: Fri Jan 16, 2009 6:30 am    Post subject: Reply with quote

erm..
okok.

well..
communicator is not a problem.
my script can work.
So the communicator will load. Then upon successful logging into the communicator, my GUI will appear.
The number will appear. Supposed 1.98 seconds. (edited my script again to round up the values)

My problem now is.. I created a .bat file to close communicator.
Supposedly its called "off communicator.bat"
Yeah.
So wad problem i have now is:
1. How to make the GUI stays there, Along with the 1st value.
2. How to make a loop of 3 times for this program, along with my "off communicator.bat file"
3. Upon looping 3 times, I will obtain 3 timings that have been recorded for the time i take to log in to communicator. How to make the value appears on my assigned columns, 1st try - 2nd try - 3rd try.
4. Upon obtaining the third value, how do i have the GUI automatically calculate the average of the three values and publish in the 4th column named "average"?

THanks
_________________
I have lost friends, some by death... others through sheer inability to cross the street.
Virginia Woolf (1882 - 1941),

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.
Back to top
View user's profile Send private message
deportivo5



Joined: 05 Sep 2008
Posts: 44

PostPosted: Mon Jan 19, 2009 3:53 am    Post subject: Reply with quote

is any1 able to help?
i need to submit it tmr
Sad
_________________
I have lost friends, some by death... others through sheer inability to cross the street.
Virginia Woolf (1882 - 1941),

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group