/    Sign up×
Community /Pin to ProfileBookmark

Run Program Function

I am using the below code on an intranet site. The javascript drop down menu functions fine and runs the relevant programs.

The second onclick command gives a script error – ‘missing’)” and I cannot see why.

<script type=”text/javascript”>

fso = new ActiveXObject(“Scripting.FileSystemObject”);

function RunProgram(Program_Path) {
Default_Value = Program_Path.match(new RegExp(“Default”, “i”))
if (Default_Value) {
} else {
new ActiveXObject(“WScript.Shell”).Run(Program_Path,3,false)
}
}

</script>
<select onchange=”RunProgram(this.value)”>
<option value=”Default” selected>Launch EMIS/MENTOR</option>
<option value=”C:progra~1mentor~1mentor.exe”>MENTOR</option>
<option value=”C:progra~1lv2lv.exe”>EMIS</option>
</select>

<td rowspan=”3″><A href=”javascript:// “onclick=”RunProgram(C:\progra~1\mentor~1\mentor.exe)”><img name=”access_page_allstaff_r8_c6″ src=”../grph_files/sliced_images/access_page_allstaff_r8_c6.gif” width=”93″ height=”51″ border=”0″ alt=””></a></td>
<td><img src=”../grph_files/sliced_images/spacer.gif” width=”1″ height=”6″ border=”0″ alt=””></td>

</tr>

Can anyone help me please?

Thank you

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisOct 29.2003 — <A href="javascript:// "onclick="RunProgram(C:progra~1mentor~1mentor.exe)">[/quote]
Try this instead:
&lt;A href="#" onclick="RunProgram('C:\progra~1\mentor~1\mentor.exe');return false"&gt;
Copy linkTweet thisAlerts:
@FarnboroughauthorOct 29.2003 — Thanks, that worked just fine.
×

Success!

Help @Farnborough spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...