It is currently June 29th, 2022, 9:19 pm

is this possible?

Get help with creating, editing & fixing problems with skins
vipe7
Posts: 13
Joined: February 14th, 2012, 11:21 pm

is this possible?

Post by vipe7 »

Hello all! My 1st post:)
Is it possible to make something like Google search, but when i type "Programs" to open my Programs directory, also when type Internet to open Firefox?
User avatar
Brian
Developer
Posts: 2422
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: is this possible?

Post by Brian »

I don't want to say it is not possible, because it could be. I will say that there are easy ways to accomplish the same thing.

You can launch any application with the !Execute bang, and you can open Windows Special folders easy enough, and having a Google search is very easy with the InputText plugin - BUT, combining them into one "search" box is going to be very difficult.

I would just have something like this:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Variables]
SearchText=Type Search Here!

[Style]
FontColor=255,255,255,255
SolidColor=0,0,0,1

[Background]
Meter=Image
X=0
Y=0
W=200
H=50
SolidColor=0,0,0,255

[GoogleInput]
Measure=Plugin
Plugin=Plugins\InputText.dll
X=50
Y=0
W=150
H=15
SolidColor=0,0,255,255
FontColor=255,255,255,255
FontSize=8
DefaultValue=#SearchText#
Command1=!Execute ["http://www.google.com/search?q=$UserInput$"]
FocusDismiss=1

[meterGoogle]
Meter=String
MeterStyle=Style
X=0
Y=0
Text=Google:

[MeterSearch]
Meter=String
MeterStyle=Style
X=50
Y=0
W=150
H=15
Text=#SearchText#
SolidColor=168,168,168,150
LeftMouseUpAction=!Execute [!CommandMeasure "GoogleInput" "ExecuteBatch 1"]
UpdateDivider=30

[MeterPrograms]
Meter=String
MeterStyle=Style
X=0
Y=10R
Text=Programs
LeftMouseUpAction=!Execute [shell:ProgramFiles]

[MeterInternet]
Meter=String
MeterStyle=Style
X=10R
Y=r
Text=Internet
LeftMouseUpAction=!Execute ["%ProgramFiles(x86)%\Mozilla Firefox\firefox.exe"]

[MeterInternet2]
Meter=String
MeterStyle=Style
X=10R
Y=r
Text=Internet2
LeftMouseUpAction=!Execute ["http://rainmeter.net/forums"]
Just click the text: "Type Search Here!" and type your search and hit enter. Your default browser will come up. If you want another browser, then the code will be different.

Click the "Programs" text, and your "Program Files" folder will open (I hope that is what you meant by "programs directory", if you meant the programs under the start menu, then use "shell:Programs" in MeterPrograms). NOTE: If you are running a 64 bit Windows, you have "Program Files" and "Program Files (x86)". "Program Files" will open with this command and "Program Files (x86)" will open if you are running a 32-bit Windows.

Click Internet to open Firefox. (Assuming it is located in /Program Files (x86)/Mozilla Firefox/firefox.exe)

Click Internet2 to open your default browser to "http://rainmeter.net/forum"

-Brian
vipe7
Posts: 13
Joined: February 14th, 2012, 11:21 pm

Re: is this possible?

Post by vipe7 »

I got this all... I got fully selfmade skin... I got Google search already
Also i made second UserInput and when i type www.rainmeter.net it just opens it
Now i just wanna make another UserInput and when i type Internet and press enter, just execute ["%ProgramFiles(x86)%\Mozilla Firefox\firefox.exe"]
same as Programs
This is something like IF commands
Example:
If (UserInput == Internet) do something
elseif (UserInput == Programs) do another thing
elseif ...... somethink different

I mean is this possible to be made in rainmeter?
User avatar
Brian
Developer
Posts: 2422
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: is this possible?

Post by Brian »

This is possible with a Lua script.

Unfortunately, there is a problem with Lua scripts and the InputText.dll in the new beta, but will be fixed and posted this weekend, so you might have to wait until then.

In the mean time, it seems as though you are familiar with programming, you might want to take a few days and see what Lua can do for you. I am sure what you want can be done fairly easy with Lua.

-Brian
dragonmage
Developer
Posts: 1270
Joined: April 3rd, 2009, 4:31 am
Location: NC, US

Re: is this possible?

Post by dragonmage »

While technically possible in Rainmeter it would probably be much easier and more useful to use another program to do this. Most people would probably suggest Launchy but my personal favorite is Executor. If you'd prefer to do it in Rainmeter though I'm sure we could help you figure it out.
User avatar
jsmorley
Developer
Posts: 22526
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: is this possible?

Post by jsmorley »

It's really a pretty easy thing to do in Rainmeter using InputText and a bit of Lua scripting. As Brian said though, we currently have a bug in the latest 2.3 beta that will give us some problems. It has been corrected, and this Sunday when the latest beta is released, I or Brian will post an example of how you can get just want you want, while having complete control over how it looks. That is the advantage over a 3rd party tool in this case, although Launchy is certainly a nice program.
vipe7
Posts: 13
Joined: February 14th, 2012, 11:21 pm

Re: is this possible?

Post by vipe7 »

dragonmage wrote:While technically possible in Rainmeter it would probably be much easier and more useful to use another program to do this. Most people would probably suggest Launchy but my personal favorite is Executor. If you'd prefer to do it in Rainmeter though I'm sure we could help you figure it out.
Tks! Executer is good and useful for me, but i want make it into my rainmeter
jsmorley wrote:I or Brian will post an example of how you can get just want you want, while having complete control over how it looks. That is the advantage over a 3rd party tool in this case, although Launchy is certainly a nice program.
Tks m8... Ill w8 and will check this topic everyday for updates and examples
User avatar
Brian
Developer
Posts: 2422
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: is this possible?

Post by Brian »

As promised, here is a simple "launcher" type skin using a simple Lua script.

First, download the newest beta, then install it. Then download the attached file and extract the folder to your skins folder. Then load "SimpleLauncher.ini".

Once loaded, just type the name of the variable into the input box, and the skin will launch the command. If no variable is found that matches your input, then your default browser will open to google, and search the text you typed into the input box.

The commands I have already implemented are:
Programs -> Opens the folder "Start menu>Programs" (Not the "actual" start menu, but the folder it represents).
ProgramFiles -> Opens the "Program Files" folder.
Internet -> Opens Firefox (Your path might be a little different, just edit the variable in the .ini file to make it match your path to Firefox).

What I am particularly proud of is that you can create a new command by adding a variable of your choice to the [Variables] section, and not have to edit anything in the Lua script.

However, if you are going to use any variable that is not a command, I suggest you edit the "SimpleLauncher.lua" file and follow the instructions.

If you have any questions, feel free to ask!

BTW - JSMorley deserves most of the credit here, he supplied the "template", and I just edited it to make it work the way you wanted.

-Brian
You do not have the required permissions to view the files attached to this post.
vipe7
Posts: 13
Joined: February 14th, 2012, 11:21 pm

Re: is this possible?

Post by vipe7 »

Tks m8! This is really cool for me! It works great! All that i want is OK!
EDIT: Also is it possible if the input is ending with .com or .net or .org or .bg just go to typed website not to google?
User avatar
Brian
Developer
Posts: 2422
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: is this possible?

Post by Brian »

Yes, this is possible by changing your If/then statement in "SimpleLauncher.lua"

Change the If/then to this:

Code: Select all

if string.find(MyInput,'.com',-4) ~= nil or string.find(MyInput,'.net',-4) ~= nil or string.find(MyInput,'.org',-4) ~= nil or string.find(MyInput,'.bg',-3) ~= nil then
		MyCommand = "http://www."..MyInput
	elseif SKIN:GetVariable(MyInput) == nil or SKIN:GetVariable(MyInput) == 'Input' then
		MyCommand = "http://www.google.com/search?q="..MyInput
	else
		MyCommand = SKIN:GetVariable(MyInput)
	end
I just want to add that I am still new to Lua, and this way works just fine, but there is probably a better (or, shorter) way of doing this. :D

-Brian