Launch Google from Within Multi-Edit

Post user created macros to share with others here.

Moderator: Moderators

Launch Google from Within Multi-Edit

Postby Jonathan on Wed Jun 01, 2005 9:18 pm

void Launch_Google
{
/*
This macro launches Google (in Internet Explorer, which is assumed to be installed in its default location) from within Multi-Edit using the current line as the search criteria. Placing a colon at the end of the line, will execute an "exact phrase" search.

The current line syntax should like something like the following:

[Either]

about Civil War

[or]

about Civil War:

- Jonathan

*/

str str_URL;
str str_Command_Line = "C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE";
str_URL = "www.google.com/search?as_dt=i";
str Lookup_String = Get_Line;

If (XPos(char(58), Lookup_String, 1)) // Colon is present.
{
int int_Position_Of_Colon = XPos(char(58), Lookup_String, 1);
str str_Exact_Phrase = str_del(Lookup_String, int_Position_Of_Colon, 199);
str_URL += "&as_epq=" + str_Exact_Phrase;
}
else //No colon is present.
{
str_URL += "&as_q=" + Lookup_String;
}

str_URL += "&as_eq=";
str_URL += "&as_filetype=";
str_URL += "&as_ft=i";
str_URL += "&as_occt=any";
str_URL += "&as_oq=";
str_URL += "&as_qdr=all";
str_URL += "&as_sitesearch=";
str_URL += "&btnG=Google+Search";
str_URL += "&hl=en";
str_URL += "&ie=UTF-8";
str_URL += "&lr=";
str_URL += "&num=100";
str_URL += "&oe=UTF-8";
str_URL += "&safe=images";

make_message('Running Google.');
str str_Command_Portion = "C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE";

str_Command_Portion = char(34) + str_Command_Portion + char(34);
ExecProg( str_Command_Portion + " " + str_URL,
Get_Environment("TEMP"),
Get_Environment("TEMP") + '\\temp_out.txt',
Get_Environment("TEMP") + '\\temp_err.txt',
_EP_FLAGS_DONTWAIT);
}
Jonathan
Registered User
 
Posts: 14
Joined: Sun Mar 20, 2005 5:37 am
Location: Falls Church, Virginia

Postby deleyd on Sat Mar 18, 2006 5:21 pm

Place the following line at the very beginning of the file, before void Launch_Google:
Code: Select all
#include WinExec.sh
User avatar
deleyd
Developer
 
Posts: 1020
Joined: Tue Jul 29, 2003 4:27 pm
Location: Santa Barbara, CA

Postby deleyd on Sun Apr 02, 2006 11:52 pm

I have incorporated this Google Current Line function into my EDX 3.0 package at http://www.multieditsoftware.com/forums/viewtopic.php?p=1877#1877 .
User avatar
deleyd
Developer
 
Posts: 1020
Joined: Tue Jul 29, 2003 4:27 pm
Location: Santa Barbara, CA

Postby John Martzouco on Thu Jul 06, 2006 7:43 pm

Very useful, thanks.

You might want to make it a tiny bit more flexible...
Code: Select all
  str str_Command_Portion = Get_Environment("ProgramFiles") + "\\Internet Explorer\\IEXPLORE.EXE";
User avatar
John Martzouco
Registered User
 
Posts: 326
Joined: Fri Jun 09, 2006 1:22 am
Location: Montreal, Canada

Postby deleyd on Fri Jul 07, 2006 5:16 am

Actually in my EDX version I changed it to use ShellExecute instead of ExecProg, so it launches user's default web browser.
Code: Select all
  //Do it as in MeUtil1.s macro LaunchURL
  ShellExecute( 0, "open", str_URL, "", "", 0 );
User avatar
deleyd
Developer
 
Posts: 1020
Joined: Tue Jul 29, 2003 4:27 pm
Location: Santa Barbara, CA

Postby John Martzouco on Fri Jul 07, 2006 10:31 am

nice!
User avatar
John Martzouco
Registered User
 
Posts: 326
Joined: Fri Jun 09, 2006 1:22 am
Location: Montreal, Canada

Postby BrentStroh on Fri Jul 07, 2006 1:48 pm

You might also want to look into Get_Context - that way you could search for the word under the cursor - probably useful when hunting down MSDN pages for specific methods or objects.
BrentStroh
Developer
 
Posts: 268
Joined: Thu Jul 31, 2003 7:26 pm
Location: Richmond, VA


Return to User Created Macros

Who is online

Users browsing this forum: No registered users and 0 guests