JonnyR1995 Posted January 15, 2013 Share Posted January 15, 2013 Hi guys, I'm totally new here and have been trying to find out if its possible to change the Stop command when using the SCAR. Thing is the script is set up for the web browser and the command to stop is currently ctrl+F4 so obviously, when I press that it just closes down the browser completely. It's probably easy to change, can anyone help? Thanks! Quote Link to comment Share on other sites More sharing options...
Janilabo Posted January 15, 2013 Share Posted January 15, 2013 CTRL + ALT + S works? -Jani Quote Link to comment Share on other sites More sharing options...
JonnyR1995 Posted January 15, 2013 Author Share Posted January 15, 2013 (edited) CTRL + ALT + S works?-Jani Hey, For some reason, CTRL + ALT + S brings up HP support information I've just removed the HP support information shortcut, but the CTRL+ALT+S command still does nothing for me when the script is running. Edited January 15, 2013 by JonnyR1995 Quote Link to comment Share on other sites More sharing options...
Janilabo Posted January 15, 2013 Share Posted January 15, 2013 Hey, For some reason, CTRL + ALT + S brings up HP support information I've just removed the HP support information shortcut, but the CTRL+ALT+S command still does nothing for me when the script is running. I think hotkeys worked only for the first instance of SCAR (that you'll open). Anyways, you can try: Tools => Redefine Hotkeys... With that tool you can change hotkeys. If you want quick way to stop your scripts (that will work for any instance of SCAR), you can do what I have done with MSSL - make your very own custom Wait procedure and place the stopping hotkey(s) in it: procedure Wait2(MS: LongInt); var t: Integer; k: Byte; begin t := GetSystemTime; k := CharToVKey('s'); repeat if (GetCurrentKeyState(VK_CONTROL) and GetCurrentKeyState(VK_MENU) and GetCurrentKeyState(k)) then // CTRL + ALT + S TerminateScript; Wait(1); until ((GetSystemTime - t) > MS); end; Then just replace every Wait() in your scripts with Wait2(). There's pros and cons with this way, though. It is really quick way to stop your scripts, but eventually memory will leak, especially if you have some massive scripts. That just means you would need to restart SCAR more often, to free the memory that has leaked. -Jani Quote Link to comment Share on other sites More sharing options...
FHannes Posted January 15, 2013 Share Posted January 15, 2013 It is really quick way to stop your scripts, but eventually memory will leak, especially if you have some massive scripts. That just means you would need to restart SCAR more often, to free the memory that has leaked. How so? Resources are freed after TerminateScript just as they are as the script is stopped other ways... Quote Link to comment Share on other sites More sharing options...
Janilabo Posted January 15, 2013 Share Posted January 15, 2013 How so? Resources are freed after TerminateScript just as they are as the script is stopped other ways...Arrays aswell? 1 Quote Link to comment Share on other sites More sharing options...
JonnyR1995 Posted January 15, 2013 Author Share Posted January 15, 2013 I think hotkeys worked only for the first instance of SCAR (that you'll open). Anyways, you can try: Tools => Redefine Hotkeys... With that tool you can change hotkeys. If you want quick way to stop your scripts (that will work for any instance of SCAR), you can do what I have done with MSSL - make your very own custom Wait procedure and place the stopping hotkey(s) in it: procedure Wait2(MS: LongInt); var t: Integer; k: Byte; begin t := GetSystemTime; k := CharToVKey('s'); repeat if (GetCurrentKeyState(VK_CONTROL) and GetCurrentKeyState(VK_MENU) and GetCurrentKeyState(k)) then // CTRL + ALT + S TerminateScript; Wait(1); until ((GetSystemTime - t) > MS); end; Then just replace every Wait() in your scripts with Wait2(). There's pros and cons with this way, though. It is really quick way to stop your scripts, but eventually memory will leak, especially if you have some massive scripts. That just means you would need to restart SCAR more often, to free the memory that has leaked. -Jani Sorted it, thanks man! Life saver! Quote Link to comment Share on other sites More sharing options...
FHannes Posted January 15, 2013 Share Posted January 15, 2013 Arrays aswell? Arrays are internal data structures in the script engine, they should be freed when the engine is. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted January 15, 2013 Share Posted January 15, 2013 But ScriptTerminate is no longer called if you manually stop the script? (recall seeing that in one of the release notes) so any cleanup code in ScriptTerminate wouldn't get called. Quote Link to comment Share on other sites More sharing options...
FHannes Posted January 15, 2013 Share Posted January 15, 2013 That's only when you forcefully terminate the script, not when you just stop it or use TerminateScript. For example, if the script is stuck in a native function, like when finding a deformed bitmap, which can take a lot of time if you pass large values, it won't be able to interrupt that function call. The engine can only stop scripts when the thread actually inside of the script code and not inside of SCAR's API. When you stop SCAR when the thread is executing an API call, it will either stop when it's done doing that and enters back into the script's code, or when you press the stop button again, which forcefully terminates the script. So, that's the only time that ScriptTerminate isn't called, but most resources are freed after execution as usual, even when using forceful termination. Quote Link to comment Share on other sites More sharing options...