Any one knows if there is a method to know that the script is running in debug mode?
I need to change the behavior of my program in function of this.
For sure I could set a variable to True or False, but it would be great if this could be evaluated automatically by testing a system variable
Thanks
Massimo
How to know that the script is running in Debug?
Moderators: Dorian (MJT support), JRL
- Grovkillen
- Automation Wizard
- Posts: 1131
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: How to know that the script is running in Debug?
You can look at the command line variable and see what process it is running from.
Re: How to know that the script is running in Debug?
Thanks, very simple
However I had to change in:
Let>Me=%COMMAND_LINE%
Result:
Me="C:\Program Files (x86)\Macro Scheduler 15\msched.exe"
However I had to change in:
Let>Me=%COMMAND_LINE%
Result:
Me="C:\Program Files (x86)\Macro Scheduler 15\msched.exe"
Re: How to know that the script is running in Debug?
Am I missing something here?
Is not "running in debug" simply another way of saying "running in the editor"? In my experience no matter how you run a non-compiled script the command_line variable will always be installed_directory\msched.exe. That includes running in the editor. The only way I am aware to determine whether you are running in the editor is to check if the current window is "Macro - ScriptName". If the current window is "Macro - ScriptName", you in Debug or running in the editor.
Is not "running in debug" simply another way of saying "running in the editor"? In my experience no matter how you run a non-compiled script the command_line variable will always be installed_directory\msched.exe. That includes running in the editor. The only way I am aware to determine whether you are running in the editor is to check if the current window is "Macro - ScriptName". If the current window is "Macro - ScriptName", you in Debug or running in the editor.
Code: Select all
ExtractFileName>Script_name,fName,1
GetActiveWindow>WinTitle,WinX,Winy
Let>TestName=Macro - %FName%
If>{(%WinTitle%=%TestName%)or(%script_Name%="__debug.dbg")}
Let>Debug_Mode=True
Else
Let>Debug_Mode=False
EndIf
MDL>Debug_Mode
- Dorian (MJT support)
- Automation Wizard
- Posts: 1385
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: How to know that the script is running in Debug?
I was thinking along the same lines as you too. The previous solution would identify if it was a compiled script or being run by Macro Scheduler.JRL wrote: ↑Tue May 10, 2022 8:43 pmAm I missing something here?
Is not "running in debug" simply another way of saying "running in the editor"? In my experience no matter how you run a non-compiled script the command_line variable will always be installed_directory\msched.exe. That includes running in the editor. The only way I am aware to determine whether you are running in the editor is to check if the current window is "Macro - ScriptName". If the current window is "Macro - ScriptName", you in Debug or running in the editor.
Code: Select all
ExtractFileName>Script_name,fName,1 GetActiveWindow>WinTitle,WinX,Winy Let>TestName=Macro - %FName% If>{(%WinTitle%=%TestName%)or(%script_Name%="__debug.dbg")} Let>Debug_Mode=True Else Let>Debug_Mode=False EndIf MDL>Debug_Mode
This was my effort.
Code: Select all
GetActiveWindow>window_title,XX,YY
Pos>%script_name%,window_title,1,Open,
If>Open>0
mdl>Open in debugger
else
mdl>NOT open in debugger
Endif
Yes, we have a Custom Scripting Service. Message me or go here
Re: How to know that the script is running in Debug?
Glad you agree. Its always worrisome not quite knowing what others are thinking. Not that I haven't had to pull my foot out of my mouth hundreds of times before. Still, strive for "accuracy".
I would add to your "If>" line to catch the possibility of not yet having saved/named the new macro.
I would add to your "If>" line to catch the possibility of not yet having saved/named the new macro.
Code: Select all
GetActiveWindow>window_title,XX,YY
Pos>%script_name%,window_title,1,Open,
If>{(%Open%>0)or(%window_title%="Macro - ")}
mdl>Open in debugger
else
mdl>NOT open in debugger
Endif
- Dorian (MJT support)
- Automation Wizard
- Posts: 1385
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: How to know that the script is running in Debug?
Aaah, good point! Thank you!
Yes, we have a Custom Scripting Service. Message me or go here