How to write code in several lines
Moderators: Dorian (MJT support), JRL
How to write code in several lines
After a lot of searchs for some days i cound not find how to splite a code line.How can i continue code in the next line?
Re: How to write code in several lines
Show us a real example.
Re: How to write code in several lines
Code: Select all
Srt>Captura_Haystack
ScreenCapture>Captura_Haystack_var_1,Captura_Haystack_var_2,Captura_Haystack_var_3,Captura_Haystack_var_4,%CAPTURAS_DIR%\%Captura_Haystack_var_5%.bmp
if>SCREENCAP_RESULT<>0
GoSub>Continuar,"ScreenCapture" failed%crlf%SCREENCAP_RESULT: %SCREENCAP_RESULT%%crlf%Captura: %Captura_Haystack_var_5%.bmp
endif
END>Captura_Haystack
Code: Select all
GoSub>Captura_Haystack,BB_PANEL_DER_INI_X,BB_PANEL_DER_INI_Y,BB_PANEL_DER_FIN_X,BB_PANEL_DER_FIN_Y,temp_Captura_Verificable
Code: Select all
GoSub>Captura_Haystack,BB_PANEL_DER_INI_X,_
BB_PANEL_DER_INI_Y,_
BB_PANEL_DER_FIN_X,_
BB_PANEL_DER_FIN_Y,_
temp_Captura_Verificable
Re: How to write code in several lines
Hi, For the SRT, to avoid the long names, I would typically add a couple of lines with meaningful names so it is clear what is happening, also use local scope to the SRT, ie something like:
I don't think you can directly split the lines as you suggest so better to build it up step by step instead. Personally, for calling the SRT I would probably just add a couple of lines assigning the long variables to shorter ones and then pass the shorter ones to the SRT (you can then hide the lines within CODEBLOCK> ... ENDCODEBLOCK>)
(As an aside, there is a way you can split and add the lines yourself (see below). When you run the program the full names will be inserted on one line but when you write it you can have it on split lines. Would require a couple of extra lines.)
Code: Select all
SRT>Captura_Haystack
Let>LOCALVARS=1
Let>tmp=Captura_Haystack_var
Let>x1=%tmp%_1
Let>y1=%tmp%_2
Let>x2=%tmp%_3
Let>y2=%tmp%_4
Let>file=%tmp%_5
ScreenCapture>x1,y1,x2,y2,SCFile
If>SCREENCAP_RESULT<>0
Let>Message="ScreenCapture" failed%crlf%SCREENCAP_RESULT: %SCREENCAP_RESULT%%crlf%Captura: %file%
GoSub>Continuar,Message
Endif
Let>LOCALVARS=0
END>Captura_Haystack
I don't think you can directly split the lines as you suggest so better to build it up step by step instead. Personally, for calling the SRT I would probably just add a couple of lines assigning the long variables to shorter ones and then pass the shorter ones to the SRT (you can then hide the lines within CODEBLOCK> ... ENDCODEBLOCK>)
(As an aside, there is a way you can split and add the lines yourself (see below). When you run the program the full names will be inserted on one line but when you write it you can have it on split lines. Would require a couple of extra lines.)
Code: Select all
/*
Captura_Haystack:
GoSub>Captura_Haystack,_
BB_PANEL_DER_INI_X,_
BB_PANEL_DER_INI_Y,_
BB_PANEL_DER_FIN_X,_
BB_PANEL_DER_FIN_Y,_
temp_Captura_Verificable
*/
LabelToVar>Captura_Haystack,Captura_Haystack
RegEx>(?m-s)_\R,Captura_Haystack,0,m,nm,1,,Captura_Haystack
IncludeFromVar>Captura_Haystack
Re: How to write code in several lines
Ok , thank you so much for that info.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: How to write code in several lines
There's no line continuation character. But there is always word wrap
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: How to write code in several lines
Hi Marcus,
Thank you for showing us the practical use of IncludeFromVar.
Thank you for showing us the practical use of IncludeFromVar.
Re: How to write code in several lines
Wrap is ok but it creates new memory spaces increasing the memory used by the program , right?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: How to write code in several lines
Err, why?pantik wrote:Wrap is ok but it creates new memory spaces increasing the memory used by the program , right?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: How to write code in several lines
becasue you create new variables... i dont know just asking...
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: How to write code in several lines
Word wrap just wraps the lines in the editor. Nothing to do with variables.
Under the editor select Edit/Word Wrap.
Under the editor select Edit/Word Wrap.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: How to write code in several lines
Ahh!! Ok. I did not know this feature. Well that is what i was looking for.Thanks Marcus