Jump to content
JonnyR1995

Reassigning the stop button with scar

Recommended Posts

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!

Link to comment
Share on other sites

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 by JonnyR1995
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...