Tropic Posted March 10, 2010 Report Share Posted March 10, 2010 Hi, I got a macro that is basically a multiple choice menu of different things to open. Their all check-marks. So basically the user runs the macro and checks off what they want to open. In the Multple Choice menu, I got choices up to letter "N". The problem: The macro hangs sometimes if i choose more then one... This is a huge Case Switch? I was thinking should i break it down to sub routines? Thanks! Quote Link to comment Share on other sites More sharing options...
Yehnfikm8Gq Posted March 10, 2010 Report Share Posted March 10, 2010 I don't know how Case behaves with multiple matches. I don't think that is what it was intended for. Someone else will have to comment on that. If you are opening "things" you may need to add time delays after each so they do not happen at the same time. If Case seems to be the problem go to Ifs. Quote Link to comment Share on other sites More sharing options...
Tropic Posted March 10, 2010 Author Report Share Posted March 10, 2010 Yeah, i could do If's i just wanted to test out the Case. So delays after each one? or should i do for wait for window title etc..? Quote Link to comment Share on other sites More sharing options...
Yehnfikm8Gq Posted March 10, 2010 Report Share Posted March 10, 2010 As with all timing, start long and shorten. If Wait for Window Title works that fine. I normally add a short delay after that but in this instance timing is not critical. I played with Case a few months back but found the lack of ifs, buts, maybes and almosts was a bit limiting compared to If statements. Quote Link to comment Share on other sites More sharing options...
Tropic Posted March 10, 2010 Author Report Share Posted March 10, 2010 So Basically If Variable T1 = A Then Open Yahoo End if If Variable T1 = B Then Open Google End If But if you choose A & B Or i could assign different variables for Yahoo & Google? Quote Link to comment Share on other sites More sharing options...
Yehnfikm8Gq Posted March 10, 2010 Report Share Posted March 10, 2010 If you select more than one item, T1 is the sum of the items so if you select A and E, T1 will be AE. You should be using Contains for multiple selections. Equals is fine for single choice. Otherwise, the Ifs will work with the necessary time delays if some apps have heavy startups. I have one macro like this where the first option A is to do the entire list so that looks like: If Variable T1 Contains A or If Variable Contains B Then Open Yahoo End if If Variable T1 Contains A or If Variable T1 Contains C Then Open Google End If My time delays are built into each macro (in your case that would be Open Yahoo etc) but putting in the above code is fine. You can pre-seed the Multichoice so if A and E were your normal choices, set T1 = AE before the Multichoice and the selections A and E will be already selected when the box opens. If you want something else you change but it means that normally you just hit OK. Quote Link to comment Share on other sites More sharing options...
Tropic Posted March 10, 2010 Author Report Share Posted March 10, 2010 John, your awesome, I will try this out! Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.