Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Advice in simplifying code...
#1
I'm just looking for general advice to help me out in the future. I just can't see any easier way to do this one...so if you have any ideas, I sure would like to hear them.

here is my code:
Function End_Of_Day
Code:
Copy      Help
,case [EN_CHANGE<<16|101,EN_CHANGE<<16|101,EN_CHANGE<<16|102,EN_CHANGE<<16|105,EN_CHANGE<<16|106,EN_CHANGE<<16|107,EN_CHANGE<<16|108,EN_CHANGE<<16|110]
,double d100 d101 d102 d103 d104 d105 d106 d107 d108 d109 d110 d116
,

,_s.getwintext(id(100 win("End of Day" "#32770")))
,_s.findreplace("$")
,d100=val(_s 2)
,
,_s.getwintext(id(101 win("End of Day" "#32770")))
,_s.findreplace("$")
,d101=val(_s 2)
,
,_s.getwintext(id(102 win("End of Day" "#32770")))
,_s.findreplace("$")
,d102=val(_s 2)
,
,_s.getwintext(id(103 win("End of Day" "#32770")))
,_s.findreplace("$")
,d103=val(_s 2)
,
,_s.getwintext(id(104 win("End of Day" "#32770")))
,_s.findreplace("$")
,d104=val(_s 2)
,
,_s.getwintext(id(105 win("End of Day" "#32770")))
,_s.findreplace("$")
,d105=val(_s 2)
,
,_s.getwintext(id(106 win("End of Day" "#32770")))
,_s.findreplace("$")
,d106=val(_s 2)
,
,_s.getwintext(id(107 win("End of Day" "#32770")))
,_s.findreplace("$")
,d107=val(_s 2)
,
,_s.getwintext(id(108 win("End of Day" "#32770")))
,_s.findreplace("$")
,d108=val(_s 2)
,
,_s.getwintext(id(109 win("End of Day" "#32770")))
,_s.findreplace("$")
,d109=val(_s 2)
,
,_s.getwintext(id(110 win("End of Day" "#32770")))
,_s.findreplace("$")
,d110=val(_s 2)
,
,
,d102=d100-d101
,_s.format("$%.2f" d102)
,_s.setwintext(id(102 win("End of Day" "#32770")))
,
,d116=d100+d103+d104+d105-d106-d107-d108-d109-d110-d101
,_s.format("$%.2f" d116)
,_s.setwintext(id(116 win("End of Day" "#32770")))

I just feel like there should be an easier way to repeat this so I don't have to have such a long code...

Thanks,
Jimmy Vig
#2
Macro
Code:
Copy      Help
,double d100 d101 d102 d103 d104 d105 d106 d107 d108 d109 d110 d116
,double* a=&d100
,int i
,for i 0 11
,,_s.getwintext(id(100+i hDlg))
,,_s.findreplace("$")
,,a[i]=val(_s 2)
#3
A thing a beauty! Truly I wish I had your skills.


Forum Jump:


Users browsing this thread: 1 Guest(s)