Script which upon execution, removes all scripts? - page 2

 
https://forum.mql4.com/29660 fourth post Down. I can't copy the script via my phone
 
https://docs.mql4.com/globals/GlobalVariablesDeleteAll. I am.guessing this or the globalvariabledel needs to be integrated into the code? May i ask, how does one go about assigning it a function key
 

Ok now I am at the computer, all it boils down to is the following script gives a slideshow of say 20 charts, automatically switching every 5 seconds:

#import "user32.dll"

   int GetParent(int hWnd);
   int SendMessageA(int hWnd, int Msg, int wParam, int lParam);
#import

#define WM_MDINEXT   548

extern int SlideShowSeconds = 5;

void start()
{
   while (!IsStopped()) {
      int hMDI = GetParent(GetParent(WindowHandle(Symbol(), Period())));
      SendMessageA(hMDI, WM_MDINEXT, 0, 0);

      Sleep(SlideShowSeconds * 1000);
   

}

Now this script loops indefinitely. As we know, to remove a script we right-click on the chart it was executed upon, and click 'Remove Script'. Now, given the nature of the inherently looping, and chart-switching(!), script, this is very tedious when there are 20 charts and rotation sequence of them is being preserved.

So, my initial question was if anyone knew the whereabouts of a script which just removes all active scripts (not indicators or EAs), from all charts. I am under the impression the amount of code would be relatively small given the amount which required for the autoswitch script above? Or would a GV be the best route?

 
blad4:

Ok now I am at the computer, all it boils down to is the following script gives a slideshow of say 20 charts, automatically switching every 5 seconds:

#import "user32.dll"

}

Now this script loops indefinitely. As we know, to remove a script we right-click on the chart it was executed upon, and click 'Remove Script'. Now, given the nature of the inherently looping, and chart-switching(!), script, this is very tedious when there are 20 charts and rotation sequence of them is being preserved.

So, my initial question was if anyone knew the whereabouts of a script which just removes all active scripts (not indicators or EAs), from all charts. I am under the impression the amount of code would be relatively small given the amount which required for the autoswitch script above? Or would a GV be the best route?

You've already been given the answers you need.

1)_There is NO_Script which does exactly what you're looking for.

2)_Doing what you want requires programming skills outside of mql4.

3)_The code is_not Relatively Small nor Relatively Simple.

4)_Please Stop Bugging_Us, Learn to Code or Pay_SomeOne.

 

I would happily pay someone, but I'd like to know more about the functions and logic behind what I'm asking if that's ok with you keyboard warrior? Go through your list from 1-3, and you'll find nobody has said any of that so far, but you seem to have told yourself them for an unknown reason. Is that not the point of a forum; to communicate with others?.. In order to redeem some sense of social intelligence, may you please explain to me why a small script can't be made, in the same was as the autoswitch code was? From what I see, the autoswitch.mql is accessing functions outside of the chart in order to switch to a next chart, the next chart, and so on. Is there not a way to use mql to do the same but backwards?

 
blad4: I would happily pay someone, but I'd like to know more about the functions and logic behind what I'm asking if that's ok with you keyboard warrior? Go through your list from 1-3, and you'll find nobody has said any of that so far, but you seem to have told yourself them for an unknown reason. Is that not the point of a forum; to communicate with others?.. In order to redeem some sense of social intelligence, may you please explain to me why a small script can't be made, in the same was as the autoswitch code was? From what I see, the autoswitch.mql is accessing functions outside of the chart in order to switch to a next chart, the next chart, and so on. Is there not a way to use mql to do the same but backwards?

Have you considered Profiles?


 
I was hoping to avoid it if possible as it felt inefficient just re-opening 20+ charts to stop executing a script which could be so readily mobilised by a hotkey, hence my desire to comprehend if it is worth putting out as a job. It is a good solution though, thank you
 
blad4:I would happily pay someone, but I'd like to know more about the functions and logic behind what I'm asking if that's ok with you keyboard warrior? Go through your list from 1-3, and you'll find nobody has said any of that so far, but you seem to have told yourself them for an unknown reason. Is that not the point of a forum; to communicate with others?.. In order to redeem some sense of social intelligence, may you please explain to me why a small script can't be made, in the same was as the autoswitch code was? From what I see, the autoswitch.mql is accessing functions outside of the chart in order to switch to a next chart, the next chart, and so on. Is there not a way to use mql to do the same but backwards?

I would happily pay someone

Then pay that someone... Also pay them to explain everything because you're too lazy to research and critically think.

if that's ok with you keyboard warrior?

Name calling isn't going to work on someone like me. Are you some kind of teen-ager?

Go through your list from 1-3, and you'll find nobody has said any of that so far

If they didn't say #1 they would have simply just give you a link for the script you're looking for.

If they didn't say #2 they would have given you solutions in mql4 instead of postMessageA.

If they didn't say #3 they would have just coded it and paste the codes for your convenience.

What they didn't say matters.

Is that not the point of a forum; to communicate with others?

Communicate Yes, No_Spoon_Feeding here. No_One's gonna write a book to explain what, how and why you cannot get everything you want... the way you want. Some very good alternatives have been provided.

may you please explain to me why a small script can't be made

Because you haven't done your research to find out what it takes to accomplish it. You can Learn, or PaySomeOne or Keep waiting til someone else does it for you. Most of us decide to help ourselves.

From what I see, the autoswitch.mql is accessing functions outside of the chart in order to switch to a next chart, the next chart

AutoSwitch.mql is using PostMessageA. How good is your PostMessageA programming? How good is your mql4_programming? This is a mql4_forum not a PostMessageA forum.

Is there not a way to use mql to do the same but backwards?

If people could use mql why would they bother with Windows PostMessageA?
 

Thanks for that I was able to skim-read through the nonsense until the last two points you made. Very helpful in fact, I have never heard of 'Windows PostMessageA'! It's amazing how helpful forum members can be to you even whilst they flex their online egos and 'forum rep'... call it geek complex maybe.

Ironically, it's that exact ego which has saved me so much more time! Thank you again, I wouldn't have assumed one can use different coding within mql I'll look into that now.

 

This may be a way by using GV

Not tested in any way

int GetParent(int hWnd);
   int SendMessageA(int hWnd, int Msg, int wParam, int lParam);
#import

#define WM_MDINEXT   548

extern int SlideShowSeconds = 5;

GlobalVariableSet("RunSlideShow",1); 

void start()
{
   while (GlobalVariableCheck( "RunSlideShow") ) {
      int hMDI = GetParent(GetParent(WindowHandle(Symbol(), Period())));
      SendMessageA(hMDI, WM_MDINEXT, 0, 0);

      Sleep(SlideShowSeconds * 1000);
   } 
   

Then by pressing F3 you can select and delete the GV and that should stop the while() loop

Or you could make another script to delete the GV using

GlobalVariableDel("RunSlideShow")


Reason: