Difference between revisions of "How to Script Buttons"

From SDU
Jump to: navigation, search
m (Reverted edits by Agegeleruvy (Talk); changed back to last version by BrianM)
 
Line 1: Line 1:
----
 
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
 
----
 
=[http://awibuky.co.cc This Page Is Currently Under Construction And Will Be Available Shortly, Please Visit Reserve Copy Page]=
 
----
 
=[http://awibuky.co.cc CLICK HERE]=
 
----
 
</div>
 
 
__NOTOC__
 
__NOTOC__
 
{{Global Header}}
 
{{Global Header}}
Line 17: Line 9:
  
  
{| style=&quot;width:100%;vertical-align:top;&quot; cellpadding=&quot;10&quot;
+
{| style="width:100%;vertical-align:top;" cellpadding="10"
 
|-
 
|-
! style=&quot;width:10%;&quot; | Attribute
+
! style="width:10%;" | Attribute
! style=&quot;width:40%;&quot; | Description
+
! style="width:40%;" | Description
! style=&quot;width:50%;&quot; | Examples
+
! style="width:50%;" | Examples
|-valign=&quot;top&quot;
+
|-valign="top"
 
| '''btnID'''
 
| '''btnID'''
 
| Used for referencing the button. This is typically a label used for easy identification of the button in scripts.
 
| Used for referencing the button. This is typically a label used for easy identification of the button in scripts.
| &lt;source lang=&quot;javascript&quot;&gt;ImgBtnCreate(&quot;btn001&quot;, ...
+
| <source lang="javascript">ImgBtnCreate("btn001", ...
ImgBtnCreate(&quot;btnchg&quot;, ...
+
ImgBtnCreate("btnchg", ...
ImgBtnCreate(&quot;mybtn&quot;, ...&lt;/source&gt;
+
ImgBtnCreate("mybtn", ...</source>
|-valign=&quot;top&quot;
+
|-valign="top"
 
| '''btnCaption'''
 
| '''btnCaption'''
| The text to be displayed on the button. Either identify the string such as &quot;My Button&quot; or reference a msgtext() value. The msgtext() value is obtained from the msg_cat.js file.  
+
| The text to be displayed on the button. Either identify the string such as "My Button" or reference a msgtext() value. The msgtext() value is obtained from the msg_cat.js file.  
| &lt;source lang=&quot;javascript&quot;&gt;ImgBtnCreate(..., &quot;I am a button&quot;...
+
| <source lang="javascript">ImgBtnCreate(..., "I am a button"...
ImgBtnCreate(..., msgtext(514), ...&lt;/source&gt;
+
ImgBtnCreate(..., msgtext(514), ...</source>
|-valign=&quot;top&quot;
+
|-valign="top"
 
| '''func'''
 
| '''func'''
 
| The script to be initiated when the button is selection
 
| The script to be initiated when the button is selection
| &lt;source lang=&quot;javascript&quot;&gt;ImgBtnCreate(..., ..., &quot;detailSave('NEW_CHANGE')&quot;, ...
+
| <source lang="javascript">ImgBtnCreate(..., ..., "detailSave('NEW_CHANGE')", ...
ImgBtnCreate(..., ..., &quot;myscript()&quot;, ...&lt;/source&gt;
+
ImgBtnCreate(..., ..., "myscript()", ...</source>
|-valign=&quot;top&quot;
+
|-valign="top"
 
| '''btnEnabled'''
 
| '''btnEnabled'''
 
| If true then the button is Active. If false then it is not.
 
| If true then the button is Active. If false then it is not.
| &lt;source lang=&quot;javascript&quot;&gt;ImgBtnCreate(..., ..., ..., true, ...
+
| <source lang="javascript">ImgBtnCreate(..., ..., ..., true, ...
ImgBtnCreate(..., ..., ..., false, ...&lt;/source&gt;
+
ImgBtnCreate(..., ..., ..., false, ...</source>
|-valign=&quot;top&quot;
+
|-valign="top"
 
| '''btnWidth'''  
 
| '''btnWidth'''  
 
| Button width in pixels. 0 defaults to the size of the text.
 
| Button width in pixels. 0 defaults to the size of the text.
| &lt;source lang=&quot;javascript&quot;&gt;ImgBtnCreate(..., ..., ..., ..., 0, ...
+
| <source lang="javascript">ImgBtnCreate(..., ..., ..., ..., 0, ...
ImgBtnCreate(..., ..., ..., ..., 220, ...&lt;/source&gt;
+
ImgBtnCreate(..., ..., ..., ..., 220, ...</source>
|-valign=&quot;top&quot;
+
|-valign="top"
 
| '''help'''
 
| '''help'''
 
| Displays information in status bar of the browser window. This is typically the bottom left-hand corner of your.
 
| Displays information in status bar of the browser window. This is typically the bottom left-hand corner of your.
| &lt;source lang=&quot;javascript&quot;&gt;ImgBtnCreate(..., ..., ..., ..., ..., &quot;Click here to open a ticket&quot;, ...&lt;/source&gt;
+
| <source lang="javascript">ImgBtnCreate(..., ..., ..., ..., ..., "Click here to open a ticket", ...</source>
|-valign=&quot;top&quot;
+
|-valign="top"
 
| '''tabIndex'''  
 
| '''tabIndex'''  
 
|
 
|
Line 61: Line 53:
 
== More Examples ==
 
== More Examples ==
 
'''Open a Service Desk htmpl file in a new window'''
 
'''Open a Service Desk htmpl file in a new window'''
&lt;source lang=&quot;javascript&quot;&gt;ImgBtnCreate(&quot;btn001&quot;, &quot;Custom Form&quot;, &quot;popup_window('','ztest.htmpl'))&quot;, true, 0, &quot;Select this button to view a Service Desk htmpl in a new window&quot;);&lt;/source&gt;
+
<source lang="javascript">ImgBtnCreate("btn001", "Custom Form", "popup_window('','ztest.htmpl'))", true, 0, "Select this button to view a Service Desk htmpl in a new window");</source>
  
 
'''Open a Service Desk htmpl file in an existing window'''
 
'''Open a Service Desk htmpl file in an existing window'''
&lt;source lang=&quot;javascript&quot;&gt;ImgBtnCreate(&quot;btn001&quot;, &quot;Existing Window&quot;, &quot;upd_frame('ztest.htmpl')&quot;, true, 0, &quot;Select this button to use the existing window&quot;);&lt;/source&gt;
+
<source lang="javascript">ImgBtnCreate("btn001", "Existing Window", "upd_frame('ztest.htmpl')", true, 0, "Select this button to use the existing window");</source>
  
 
'''Open a new window referencing an external URL'''
 
'''Open a new window referencing an external URL'''
&lt;source lang=&quot;javascript&quot;&gt;ImgBtnCreate(&quot;btn001&quot;, &quot;SDU&quot;, &quot;popupWithURL('http://www.servicedeskusers.com', 1, 1, '')&quot;, true, 0, &quot;User Community for CA/Unicenter Service Desk&quot;);&lt;/source&gt;
+
<source lang="javascript">ImgBtnCreate("btn001", "SDU", "popupWithURL('http://www.servicedeskusers.com', 1, 1, '')", true, 0, "User Community for CA/Unicenter Service Desk");</source>
  
 
'''Open a new email message referencing the ticket'''
 
'''Open a new email message referencing the ticket'''
&lt;source lang=&quot;javascript&quot;&gt;ImgBtnCreate(&quot;btn001&quot;, &quot;Send eMail&quot;, &quot;window.open('mailto:?subject=Regarding $args.type.sym $args.ref_num&amp;body=Click on the following URL to view $args.type.sym $args.ref_num: $args.web_url')&quot;, true, 0);&lt;/source&gt;
+
<source lang="javascript">ImgBtnCreate("btn001", "Send eMail", "window.open('mailto:?subject=Regarding $args.type.sym $args.ref_num&body=Click on the following URL to view $args.type.sym $args.ref_num: $args.web_url')", true, 0);</source>
  
 
'''Launch an application'''
 
'''Launch an application'''
&lt;source lang=&quot;javascript&quot;&gt;function ExecuteMyApp() {
+
<source lang="javascript">function ExecuteMyApp() {
var myshell = new ActiveXObject( &quot;WScript.shell&quot; );
+
var myshell = new ActiveXObject( "WScript.shell" );
 
myshell.run( 'enter application command line here', 1, true );
 
myshell.run( 'enter application command line here', 1, true );
 
}
 
}
ImgBtnCreate(&quot;btn001&quot;, &quot;My Application&quot;, &quot;ExecuteMyApp()&quot;, true, 0, &quot;Click this button to launch My Application&quot;);&lt;/source&gt;
+
ImgBtnCreate("btn001", "My Application", "ExecuteMyApp()", true, 0, "Click this button to launch My Application");</source>

Latest revision as of 05:25, 30 November 2010

To make corrections or additions to this article, select the edit tab above.
To discuss or ask questions about this article, select the discussion tab above.

Overview

Service Desk buttons are created using a ImgBtnCreate function.

ImgBtnCreate(btnID, btnCaption, func, btnEnabled, btnWidth, help, tabIndex)


Attribute Description Examples
btnID Used for referencing the button. This is typically a label used for easy identification of the button in scripts. <source lang="javascript">ImgBtnCreate("btn001", ...

ImgBtnCreate("btnchg", ... ImgBtnCreate("mybtn", ...</source>

btnCaption The text to be displayed on the button. Either identify the string such as "My Button" or reference a msgtext() value. The msgtext() value is obtained from the msg_cat.js file. <source lang="javascript">ImgBtnCreate(..., "I am a button"...

ImgBtnCreate(..., msgtext(514), ...</source>

func The script to be initiated when the button is selection <source lang="javascript">ImgBtnCreate(..., ..., "detailSave('NEW_CHANGE')", ...

ImgBtnCreate(..., ..., "myscript()", ...</source>

btnEnabled If true then the button is Active. If false then it is not. <source lang="javascript">ImgBtnCreate(..., ..., ..., true, ...

ImgBtnCreate(..., ..., ..., false, ...</source>

btnWidth Button width in pixels. 0 defaults to the size of the text. <source lang="javascript">ImgBtnCreate(..., ..., ..., ..., 0, ...

ImgBtnCreate(..., ..., ..., ..., 220, ...</source>

help Displays information in status bar of the browser window. This is typically the bottom left-hand corner of your. <source lang="javascript">ImgBtnCreate(..., ..., ..., ..., ..., "Click here to open a ticket", ...</source>
tabIndex

More Examples

Open a Service Desk htmpl file in a new window <source lang="javascript">ImgBtnCreate("btn001", "Custom Form", "popup_window(,'ztest.htmpl'))", true, 0, "Select this button to view a Service Desk htmpl in a new window");</source>

Open a Service Desk htmpl file in an existing window <source lang="javascript">ImgBtnCreate("btn001", "Existing Window", "upd_frame('ztest.htmpl')", true, 0, "Select this button to use the existing window");</source>

Open a new window referencing an external URL <source lang="javascript">ImgBtnCreate("btn001", "SDU", "popupWithURL('http://www.servicedeskusers.com', 1, 1, )", true, 0, "User Community for CA/Unicenter Service Desk");</source>

Open a new email message referencing the ticket <source lang="javascript">ImgBtnCreate("btn001", "Send eMail", "window.open('mailto:?subject=Regarding $args.type.sym $args.ref_num&body=Click on the following URL to view $args.type.sym $args.ref_num: $args.web_url')", true, 0);</source>

Launch an application <source lang="javascript">function ExecuteMyApp() { var myshell = new ActiveXObject( "WScript.shell" ); myshell.run( 'enter application command line here', 1, true ); } ImgBtnCreate("btn001", "My Application", "ExecuteMyApp()", true, 0, "Click this button to launch My Application");</source>