Execute script (1580 Views)
Reply
Advisor
Tutino
Posts: 34
Registered: ‎02-21-2011
Message 1 of 14 (1,580 Views)
Accepted Solution

Execute script

Hello everyone,

                              I would like to know if there is any way to execute a script manually, with manually I mean without use the schedule or the format control

 

 

Best regards,

Agustin

Please use plain text.
Frequent Advisor
abhijitkhewale
Posts: 74
Registered: ‎10-15-2010
Message 2 of 14 (1,579 Views)

Re: Execute script

Hi Tino, Which script are you referring to?(Javascript, DDE script etc)
Please use plain text.
Advisor
Tutino
Posts: 34
Registered: ‎02-21-2011
Message 3 of 14 (1,579 Views)

Re: Execute script

Hi there!

                  I'm developing a script (table = scripts ) with javascript and I need an easy way to test it.

 

Best regards,

Agustin

Please use plain text.
Valued Contributor
Pikutj
Posts: 78
Registered: ‎05-26-2011
Message 4 of 14 (1,579 Views)

Re: Execute script

Hi,

 

It depends on aim of your scripts and variable you are using in script.

However to test  a simple script you have to pass the variables in function,if exists and then click execute button located at top of window.

 

Anyhow what is version u r using?

 

 

regards,

Please use plain text.
Advisor
Tutino
Posts: 34
Registered: ‎02-21-2011
Message 5 of 14 (1,579 Views)

Re: Execute script

Hi! 

       I'm using SM 7.02.021. I found the command jscall, so I move the script to the script library and now I'm executing my script using this function!

 

Can you recommend me another o better way to do this?

 

Thanks in advance!!

Agustin

Please use plain text.
Valued Contributor
JustinN
Posts: 221
Registered: ‎01-11-2011
Message 6 of 14 (1,579 Views)

Re: Execute script

Tino,

Within ServiceManager jscall is the way to i've tested simple javascript functions. If you need a specific file (like device) you will have to call the function inside of a formatctrl related to that specific file type.

If you are only using it to manipulate data like arrays or strings then jscall is still the best way (within ServiceManager).

Please use plain text.
Advisor
Tutino
Posts: 34
Registered: ‎02-21-2011
Message 7 of 14 (1,579 Views)

Re: Execute script

Thanks guys!!!

 

I'm testing my scripts without problems!!

Please use plain text.
Honored Contributor
-m-
Posts: 989
Registered: ‎02-22-2011
Message 8 of 14 (1,579 Views)

Re: Execute script

As long as the script record is self-contained (meaning a file variable is not passed to it), an Execute button can be placed on the screen used to display the script.

 

1. Launch a Windows client and login as a SysAdmin

2. System Navigator: Tailoring -> Tailoring Tools -> Display Options

3. Add the following Display Option:

Screen ID: scripts.view

Action: do nothing

GUI Option: 20

Text Option: 20

Bank: 1

Default Label: Execute

Condition: true

 

RAD tab:

RAD Application: script.execute

Names: name

Values: script.name in $L.filed

 

Note: The same idea can be used on other Display Screens if there is a need to pass a file variable.

 

If the goal is simply to test the script, then access the script.execute RAD Application and click the Test button.

Please use plain text.
Frequent Advisor
abhijitkhewale
Posts: 74
Registered: ‎10-15-2010
Message 9 of 14 (1,579 Views)

Re: Execute script

Hi, I would like to add something, as per HP suggestions your gui id for buttons should be greater than 5000 if you are adding new button.
Please use plain text.
Honored Contributor
-m-
Posts: 989
Registered: ‎02-22-2011
Message 10 of 14 (1,579 Views)

Re: Execute script

I agree that adding a new Display Option should be completed with care. It should also be recorded in a work-log as a potential conflict when performing an Application Upgrade. I'm not aware of that specific recommendation but would interested in reviewing the details. Do you know if it is documented anywhere?

 

In this particular case, a GUI option less than 200 is needed in order for it to appear as a button on the Toolbar.

 

Option numbers less than 200 appear as buttons in the Toolbar

Option numbers greater than 200 and less than 4000 appear in the drop-down menu

Option numbers between 4001 - 4099 are reserved

Option numbers greater than 32000 are reserved

Please use plain text.
Valued Contributor
Pikutj
Posts: 78
Registered: ‎05-26-2011
Message 11 of 14 (1,561 Views)

Re: Execute script

Hi Tino, []If you are using SM 7.02 then there would be execute button on scriptlibrary form.This will execute your script. Actually this button is using the jscall function only. and what way are you using to testing the script now? [] -m- also suggested a way to execute script. [] I am adding more way to do the same.[] 1)Use RAD debugger []execute following command : $L.void=jscall(1 in $L.file) Make sure that current file variable($L.file) has the script record. []2)Use the OOB execute button or create a new as suggested by -m- . []Can use $L.void=jscall(1 in $L.file) in Prerad expression of button(do) instead of RAD script.execute. [] hth,
Please use plain text.
Honored Contributor
-m-
Posts: 989
Registered: ‎02-22-2011
Message 12 of 14 (1,561 Views)

Re: Execute script

In case a summary is needed :smileyhappy:

 

If you are testing JavaScript only, then creating a ScriptLibrary record is convenient because it provides Compile and Execute buttons. Other options include: Display Options, Format Controls, Wizards, Process records, and triggers  (they all have sections for executing JavaScript).

 

If you are testing a script (System Navigator: Tailoring -> Scripts), then creating a new Display Option is convenient regardless of the content in your script (RAD Expressions, JavaScript, and/or calling a RAD Application).

 

The jscall() provides a way to execute JavaScript in an area where RAD expressions are evaluated (Format Control Calculations, Pre Rad Expressions in Display Option, Post Expressions in Link record, etc).

Please use plain text.
Frequent Advisor
abhijitkhewale
Posts: 74
Registered: ‎10-15-2010
Message 13 of 14 (1,561 Views)

Re: Execute script

Hi -M-, I have same information as you posted in thread.
Please use plain text.
Valued Contributor
Pikutj
Posts: 78
Registered: ‎05-26-2011
Message 14 of 14 (1,561 Views)

Re: Execute script

Hi All, "-m-" You are absolutely correct, but since Tino is using JS so here jscall function seems to be more relevant. Although your summarization is useful indeed. Thanks,
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation