Posts: 56
Threads: 14
Joined: Jul 2008
I have a dialog List box to check a difference using < and > in a Edit.
I want to make it so that if the edit= 3 and the Highlighted Item in the list Box is less then three the Macro will Continue.
But if the Highlighted Item in the list Box is more then 3 Then the macro will choose the Next Item on the List below it. Is there any possible way to do this?
Thanks!
Posts: 12,072
Threads: 140
Joined: Dec 2002
You probably already have the macro and the dialog, partially created. Please post here. Add comments where you don't know how to do something.
Posts: 56
Threads: 14
Joined: Jul 2008
Function Function76
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
str controls = "3"
str cb3
if(!ShowDialog("Function76" &Function76 &controls)) ret
;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Call Center"
;1 Button 0x54030001 0x4 2 110 48 14 "OK"
;2 Button 0x54030000 0x4 60 110 48 14 "Cancel"
;3 ListBox 0x54030101 0x0 6 16 96 56 ""
;7 Edit 0x54032801 0x0 20 100 100 46""
;5 Button 0x54032000 0x0 104 16 18 14 "+"
;6 Button 0x54032000 0x0 104 32 18 14 "-"
;4 Button 0x54020007 0x0 2 2 126 96 "Employee Names "
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,DT_Init(hDlg lParam) ;;*
,ret 1 ;;*
,case WM_DESTROY DT_DeleteData(hDlg) ;;*
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 5 ;;+
,str s.getwintext(id(3 hDlg))
,s.trim; if(!s.len) ret
,CB_Add id(3 hDlg) s
,;SendMessage id(3 hDlg) CB_ADDSTRING 0 s ;;use this instead of the above line if CB_Add is unavailable
,
,case 6 ;;-
,int i=CB_SelectedItem(id(3 hDlg))
,if(i<0) ret
,SendMessage id(3 hDlg) CB_DELETESTRING i 0
,
,case IDOK
,DT_Ok hDlg ;;*
,case IDCANCEL DT_Cancel hDlg ;;*
ret 1
What i want to do is to make it so that if an item in the Listbox has the Status (Offline) then the Macro will Continue. But if the Item in Listbox is (Online) it will select the next Name in the Listbox.
I have tried using acc and < & >
Posts: 12,072
Threads: 140
Joined: Dec 2002
When? While the dialog is open, or when closed (OK)? If while open, should it be in response to a pressed button or some other event?
Posts: 56
Threads: 14
Joined: Jul 2008
Its going to be response to another Macro calling it. While the dialog is open.
Posts: 12,072
Threads: 140
Joined: Dec 2002
Macro
;find listbox item containing "(offline)"
int hlb=id(3 win("Call Center" "#32770"))
int i n=LB_GetCount(hlb)
for i 0 n
,str s
,LB_GetItemText hlb i s
,;out s
,if(find(s "(offline)" 0 1)>=0) goto g1
ret
;g1
;here the macro continues
out i
out s
Posts: 56
Threads: 14
Joined: Jul 2008
Is there a way that it can highlight the next name that is in line?
So names are like this
Leah (Offline)
OJ(Offline)
Denis
Johnny Chahal
Shammi Singh
Jagdeep
So if Leah and OJ are Offline or any other Random Person then it will Highligh the Next Name that does not have the Offline Status and set there name in a string
Posts: 12,072
Threads: 140
Joined: Dec 2002
Macro
int hlb=id(3 win("Call Center" "#32770"))
int i n=LB_GetCount(hlb)
for i 0 n
,str s
,LB_GetItemText hlb i s
,;out s
,if(find(s "(offline)" 0 1)<0)
,,LB_SelectItem hlb i
,,break
Posts: 56
Threads: 14
Joined: Jul 2008
Ok now just one more thing.
I want to use an edit to Control if they are Online or Offline. so..
if Leah Goes from Online like..
Leah
to Offline
Leah (Offline) With her Status from Skype is there a way that i can make a Macro Check so that If she goes offline it will change will show in the list box she is Offline? By putting the words (Offline) behind her name?
Posts: 12,072
Threads: 140
Joined: Dec 2002
Macro
LB_GetItemText hlb i s
s+" (offline)"
SendMessage hlb LB_DELETESTRING i 0
SendMessage hlb LB_INSERTSTRING i s
Posts: 56
Threads: 14
Joined: Jul 2008
So where would i insert that in the code i already have?
Posts: 12,072
Threads: 140
Joined: Dec 2002
Don't know where you need it. For example it can be at the end of the macro.
Posts: 56
Threads: 14
Joined: Jul 2008
Gintaras Wrote:Don't know where you need it. For example it can be at the end of the macro. ok it works great but only one problem
now there is
Leah(Offline)
and
Leah
In the same box. I need to remove Leah and add Leah (Offline)
Posts: 12,072
Threads: 140
Joined: Dec 2002
Make so that i is equal to the index of Leah. Indexes start from 0. For example, if Leah is the first item, i must be 0.
For example, this macro deletes "Leah" and adds "Leah (offline)"
Macro
int hlb=id(3 win("Call Center" "#32770"))
int i n=LB_GetCount(hlb)
for i 0 n
,str s
,LB_GetItemText hlb i s
,;out s
,if(find(s "(offline)" 0 1)<0)
,,break
if(i=n) ret ;;all offline
LB_GetItemText hlb i s
s+" (offline)"
SendMessage hlb LB_DELETESTRING i 0
SendMessage hlb LB_INSERTSTRING i s
Posts: 56
Threads: 14
Joined: Jul 2008
what if Leah is not always the first item?
Posts: 12,072
Threads: 140
Joined: Dec 2002
The macro finds the first item that is without "(offline)". Let's say it is Leah. Then i is correct. It is index of Leah.
Posts: 56
Threads: 14
Joined: Jul 2008
Gintaras Wrote:The macro finds the first item that is without "(offline)". Let's say it is Leah. Then i is correct. It is index of Leah. Thanks a lot for all that help i owe you. Sorry it was so long to get what i needed. Your the best thanks.
|