AutoHotkey Community

It is currently May 26th, 2012, 2:04 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Problem with list.
PostPosted: January 13th, 2009, 9:56 am 
Offline

Joined: September 5th, 2008, 3:34 am
Posts: 44
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 January 16th, 2009, 10:08 am, edited 4 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 13th, 2009, 10:38 am 
Offline

Joined: October 9th, 2008, 6:04 am
Posts: 180
Location: Finland
heh =D use Return, not Sleep 100000000000000000


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 13th, 2009, 11:23 am 
Offline

Joined: September 5th, 2008, 3:34 am
Posts: 44
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 13th, 2009, 11:40 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 13th, 2009, 11:43 am 
Offline

Joined: October 9th, 2008, 6:04 am
Posts: 180
Location: Finland
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 13th, 2009, 11:52 am 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 14th, 2009, 3:00 am 
Offline

Joined: September 5th, 2008, 3:34 am
Posts: 44
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 16th, 2009, 3:33 am 
is adding %A_Index% as ur row number a possible solution?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 16th, 2009, 4:23 am 
Offline

Joined: September 5th, 2008, 3:34 am
Posts: 44
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 16th, 2009, 5:38 am 
Offline

Joined: October 9th, 2008, 6:04 am
Posts: 180
Location: Finland
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!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 16th, 2009, 7:30 am 
Offline

Joined: September 5th, 2008, 3:34 am
Posts: 44
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 19th, 2009, 4:53 am 
Offline

Joined: September 5th, 2008, 3:34 am
Posts: 44
is any1 able to help?
i need to submit it tmr
:(

_________________
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Exabot [Bot], poserpro, Tilter_of_Windmills and 10 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group