Jump to content

stripping/trim parameter


Recommended Posts

i'm using this script as an ie replacement(binary is iexplore.exe) to stop some pesky programs from using ie instead of my default browser:

; Script Function:blah blah goodbye ie

#NoTrayIcon

if $CmdLine[0] > 0 Then

ShellExecute("G:\applications-x\KMplus\k-meleon.exe", $CmdLineRaw);

Else

ShellExecute("G:\applications-x\KMplus\k-meleon.exe")

EndIf

it all works fine but some programs initiate a url command with '-nohone'. which my browser doesn't understand and initiates a websearch with the term instead of going to the right url.

i need to know how to remove =nohome from the command if it exists.. i tried this but ofcourse it's messed up:

; Script Function:blah blah goodbye ie

#NoTrayIcon

if $CmdLine[1]="-nohome" Then

ShellExecute("G:\applications-x\KMplus\k-meleon.exe", $CmdLine[2]);

Else

if $CmdLine[0] > 0 Then

ShellExecute("G:\applications-x\KMplus\k-meleon.exe", $CmdLineRaw);

Else

ShellExecute("G:\applications-x\KMplus\k-meleon.exe")

EndIf

thank you

Link to comment
Share on other sites

#NoTrayIcon
$sStrippedCmd = StringRegExpReplace($CmdLineRaw, "(?i)-nohome/s", "")
if $CmdLine[0] > 0 Then
ShellExecute("G:\applications-x\KMplus\k-meleon.exe", $sStrippedCmd);
Else
ShellExecute("G:\applications-x\KMplus\k-meleon.exe")
EndIf

Edited by zorphnog
Link to comment
Share on other sites

#NoTrayIcon
$sStrippedCmd = StringRegExpReplace($CmdLineRaw, "(?i)-nohome/s", "")
if $CmdLine[0] > 0 Then
ShellExecute("G:\applications-x\KMplus\k-meleon.exe", $sStrippedCmd);
Else
ShellExecute("G:\applications-x\KMplus\k-meleon.exe")
EndIf
thanks zenph.. it didn't actually work but i got the idea.. thank you so much!

this works:

#NoTrayIcon
$sStrippedCmd = StringRegExpReplace($CmdLineRaw, "-nohome ", "")
if $CmdLine[0] > 0 Then
ShellExecute("G:\applications-x\KMplus\k-meleon.exe", $sStrippedCmd);
Else
ShellExecute("G:\applications-x\KMplus\k-meleon.exe")
EndIf

thanks again, really appreciate it

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...