Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Rainmeter-like Evernote/Search Widget (gui)


  • Please log in to reply
7 replies to this topic
capeably
  • Members
  • 61 posts
  • Last active: Jun 10 2016 06:50 AM
  • Joined: 18 May 2013

This is based on a template originally coded by Just Me (links are in the code).
 
I'm really new to this, so I've had a lot of help tweaking this from folks like kon and others.

One problem I would like to fix:  the widget doesn't resize to accommodate larger text if the user has set their Control Panel > display settings (size of fonts/controls) to be larger or smaller than the default (100%). Does anyone know how this might be fixed?

This is a really cool template Just Me coded. Please feel free to post any adaptations you think people might find interesting.

The way this widget works...

 

In general, it's setup so that for any context (i.e. notebook, tag, or combo) option, if you just click the control with a blank search field, it returns all notes in that context -- goes to the notebook if it's a notebook, to the tag if it's a tag, etc.

 

If you type a search string and then click the control option, it searches the title of notes in that context.

 

If you enter a number (integer) into the search field, it will return all notes in that context that have been updated within that many days as the number entered.

 

You can also submit the searches by:

  • using Tab/Shift+Tab to select the option you want, then hit Enter.
  • Using Alt+1-0 hotkeys
  • Using Numpad1-0 Hokeys


Spoiler

Highlighting by Highlite



Brinki
  • Members
  • 3 posts
  • Last active: Feb 27 2015 08:15 PM
  • Joined: 20 Feb 2015

Hello,

 

I have AutoHotkey installed and have downloaded the script. When I open the file, an error occurs.

My System is Windows XP.

What is wrong ?

 

Error at line 178

Line Text: {2

Error: The leftmost character above is illegal in an expression

 

the program will exit

 

 

 

 

 

 

 



capeably
  • Members
  • 61 posts
  • Last active: Jun 10 2016 06:50 AM
  • Joined: 18 May 2013

Sorry to hear you're having problems. Are you using the latest version of AutoHotkey from http://ahkscript.org/?



Brinki
  • Members
  • 3 posts
  • Last active: Feb 27 2015 08:15 PM
  • Joined: 20 Feb 2015

Did you understand german ?



capeably
  • Members
  • 61 posts
  • Last active: Jun 10 2016 06:50 AM
  • Joined: 18 May 2013

Did you understand german ?

Unfortunately, no. :-(



Brinki
  • Members
  • 3 posts
  • Last active: Feb 27 2015 08:15 PM
  • Joined: 20 Feb 2015

Okay, no problem. I install the latest Version of Autohotkey and it works.

 

Thanks.



lise
  • New members
  • 1 posts
  • Last active: Jul 15 2015 10:51 PM
  • Joined: 15 Jul 2015

capeably,

 

Thanks SO much for that evernote widget.  I have used it already and it works like a charm.

 

I also used it to create a 2nd script because I liked the look of it.

In my modified one you enter text and then search for it on various websites.

I always wanted a way to enter a title once, then search for it on all the various amazons and barnes and noble and imdb and netflix, etc. Basically when I search for a film title I want to stream it, buy it, or see ratings for it. 

This was my first attempt at noodling with a script, so I want to thank you for providing me with most of what I needed.

 

And now one question.  Is there a way in your script to add more items in the list? 

 

Here is my script - you will see that the last youtube entry is where I would like to add a new site but that is where the script stops working. I should add that I don't care about using shortcuts to access these links, so if the limit is set because of shortcuts using Ctrl 1 to 0 for example, I could do without them - I'm just not sure what to delete from the script.

;
; AutoHotkey Version: 1.1
; Language:       English
; Platform:       Win8
; Author:         Lise (I updated evernote ahk to display movie sites)
;
; Script Function:
;	Insert movie title and search for it on all these sites (one at a time)
;

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

SetTitleMatchMode, 2


; GUI style template coded by just me - http://www.autohotkey.com/board/topic/90723-achieve-rainmeter-style-gui-via-gdip-library/?p=573445
; posted to gui examples by kon - http://ahkscript.org/boards/viewtopic.php?f=6&t=3851#p12351
; modified as search box by capeably
; modified with tab selection controls by kon http://www.autohotkey.com/board/topic/120754-gui-example-with-multiple-edit-fields-and-buttons/?p=686496
; modified as Rainmeter-like widget by expert vision


; **********************************************
; ADD this character ` before % to escape it
; **********************************************

GadgetName := "Search Movie Sites"


CtrlTxt1 = Letterboxd
Ctrl1Param1 = http://www.letterboxd.com
Ctrl1Param2 = http://letterboxd.com/search/films/

CtrlTxt2 = IMDB
Ctrl2Param1 = http://www.imdb.com
Ctrl2Param2 = http://www.imdb.com/find?ref_=nv_sr_fn&q=
Ctrl2Param3 =

CtrlTxt3 = Amazon.ca
Ctrl3Param1 = http://www.amazon.ca
Ctrl3Param2 = http://www.amazon.ca/s/ref=nb_sb_noss_2?url=search-alias`%3Ddvd&field-keywords=
Ctrl3Param3 =

CtrlTxt4 = Amazon.uk
Ctrl4Param1 = http://www.amazon.co.uk
Ctrl4Param2 = http://www.amazon.co.uk/s/ref=nb_sb_noss_1?url=search-alias`%3Ddvd&field-keywords=
Ctrl4Param3 =

CtrlTxt5 = Amazon.com
Ctrl5Param1 = http://www.amazon.com
Ctrl5Param2 = http://www.amazon.com/s/ref=nb_sb_noss_1?url=search-alias`%3Dmovies-tv&field-keywords=
Ctrl5Param3 =

CtrlTxt6 = Barnes & Noble
Ctrl6Param1 = http://www.barnesandnoble.com
Ctrl6Param2 = http://www.barnesandnoble.com/s/


CtrlTxt7 = Netflix
Ctrl7Param1 = http://www.netflix.com
Ctrl7Param2 = http://www.netflix.com/search/
Ctrl7Param3 = 


; hulu requires adding something in the ctrl near the bottom - go check
CtrlTxt8 = Hulu
Ctrl8Param1 = http://www.hulu.com
Ctrl8Param2 = http://www.hulu.com/search?q=
Ctrl8Param3 =

CtrlTxt9 = Sony
Ctrl9Param1 = https://store.playstation.com
Ctrl9Param2 = https://store.playstation.com/#!/en-ca/search/q=
Ctrl9Param3 =

CtrlTxt10 = Google
Ctrl10Param1 = https://www.google.com
Ctrl10Param2 = http://www.google.com/search?hl=en&q=
Ctrl10Param3 =

CtrlTxt11 = YouTube
Ctrl11Param1 = http://www.youtube.com
Ctrl11Param2 = http://www.youtube.com/results?search_query=
Ctrl11Param3 =

CtrlTxt12 = YouTube2 (placeholder)
Ctrl11Param1 = http://www.youtube.com
Ctrl11Param2 = http://www.youtube.com/results?search_query=
Ctrl11Param3 =






; | | | | | | | | |
; | | | | | | | | |
; ************************************************







Width := 230
Gui, +LastFound
Gui, +ToolWindow ; get's rid of the taskbar icon and gives a narrower title bar
WinSet, Transparent, 235
Gui, Color, 808080
Gui, Margin, 0, 0
Gui, Font,, Verdana
Gui, Font, s12 cFFFFFF Bold ; Header font
Gui, Add, Progress, % "x-1 y-1 w" (Width+2) " h31 Background31b7b9 Disabled hwndHPROG"
Control, ExStyle, -0x20000, , ahk_id %HPROG% ; propably only needed on Win XP
Gui, Add, Text, % "x0 y0 w" Width " h30 BackgroundTrans Center 0x200 gGuiMove vCaption", %GadgetName%
Gui, Font, s9 c808080 ; Search field font
Gui, add, edit, % "x7 y+10 w" (Width-14) "r1 +0x4000 vTX1" varSearch
Gui, Font, s9 cFFFFFF Bold ; Control label font
Gui, Add, Text, % "x7 y+10 w" (Width-14) "r1 +0x4000 vTX2 gCtrl1", &1 %CtrlTxt1%
Gui, Add, Text, % "x7 y+10 w" (Width-14) "r1 +0x4000 vTX3 gCtrl2", &2 %CtrlTxt2%
Gui, Add, Text, % "x7 y+10 w" (Width-14), _________________
Gui, Add, Text, % "x7 y+10 w" (Width-14) "r1 +0x4000 vTX4 gCtrl3", &3 %CtrlTxt3%
Gui, Add, Text, % "x7 y+10 w" (Width-14) "r1 +0x4000 vTX5 gCtrl4", &4 %CtrlTxt4%
Gui, Add, Text, % "x7 y+10 w" (Width-14) "r1 +0x4000 vTX6 gCtrl5", &5 %CtrlTxt5%
Gui, Add, Text, % "x7 y+10 w" (Width-14) "r1 +0x4000 vTX7 gCtrl6", &6 %CtrlTxt6%
Gui, Add, Text, % "x7 y+10 w" (Width-14), _________________

Gui, Add, Text, % "x7 y+10 w" (Width-14) "r1 +0x4000 vTX8 gCtrl7", &7 %CtrlTxt7%
Gui, Add, Text, % "x7 y+10 w" (Width-14) "r1 +0x4000 vTX9 gCtrl8", &8 %CtrlTxt8%
Gui, Add, Text, % "x7 y+10 w" (Width-14) "r1 +0x4000 vTX10 gCtrl9", &9 %CtrlTxt9%
Gui, Add, Text, % "x7 y+10 w" (Width-14), _________________
Gui, Add, Text, % "x7 y+10 w" (Width-14) "r1 +0x4000 vTX11 gCtrl10", &0 %CtrlTxt10%
Gui, Add, Text, % "x7 y+10 w" (Width-14) "r1 +0x4000 vTX12 gCtrl11", %CtrlTxt11%
Gui, Add, Text, % "x7 y+10 w" (Width-14) "r1 +0x4000 vTX13 gCtrl12", %CtrlTxt12%
Gui, Add, Text, % "x7 y+10 w" (Width-14), _________________
Gui, Add, Text, % "x7 y+13 w" (Width-14) "r1 +0x4000 vTX14 gClose", . CLOSE
Gui, Add, Text, % "x7 y+10 w" (Width-14) "h5 vP"
GuiControlGet, P, Pos
H := PY + PH
Gui, -Caption
WinSet, Region, 0-0 w%Width% h%H% r6-6
Gui, Show,, SearchGadgetWindow ; Name Window Title
Gui, Show, x0 y0 ; Position at top left of screen


hGadgetGui := WinExist()
SetTimer, DesktopIntegration


TotalControls := 14


Selection := 1 ; when tab is first pressed, selection will be changed to 2, and TX2 will be selected
return


DesktopIntegration: ; label activates the gadget window (brings it to the front) whenever the current active window class is "WorkerW" (desktop when you press Win+D)
WinGetClass, ahk_class, A
If (ahk_class == "WorkerW") and (LastClass != "WorkerW") ;and (LastClass != "AutoHotkeyGUI")
WinActivate, % "ahk_id " . hGadgetGui
LastClass := ahk_class
return



ChangeSelection:
TotalLoops := TotalControls - 1
Loop, %TotalLoops% ; loop once for each control (TX2-TX13)
{
i := A_Index + 1
if (i = Selection) ; If this is the selected control change its font
{
Gui, Font, c31b7b9 bold
GuiControl, Font, TX%i%
}
else ; else use the normal font
{
Gui, Font, cFFFFFF bold
GuiControl, Font, TX%i%
}
}
return


GuiMove:
PostMessage, 0xA1, 2
return


#IfWinActive, SearchGadgetWindow ahk_class AutoHotkeyGUI
!1::gosub, Ctrl1
!2::gosub, Ctrl2
!3::gosub, Ctrl3
!4::gosub, Ctrl4
!5::gosub, Ctrl5
!6::gosub, Ctrl6
!7::gosub, Ctrl7
!8::gosub, Ctrl8
!9::gosub, Ctrl9
!0::gosub, Ctrl10


Numpad1::gosub, Ctrl1
Numpad2::gosub, Ctrl2
Numpad3::gosub, Ctrl3
Numpad4::gosub, Ctrl4
Numpad5::gosub, Ctrl5
Numpad6::gosub, Ctrl6
Numpad7::gosub, Ctrl7
Numpad8::gosub, Ctrl8
Numpad9::gosub, Ctrl9
Numpad0::gosub, Ctrl10
!x::ExitApp
Esc::ExitApp


Enter::
NumpadEnter::
Select := {2: "Ctrl1", 3: "Ctrl2", 4: "Ctrl3", 5: "Ctrl4", 6: "Ctrl5", 7: "Ctrl6", 8: "Ctrl7", 9: "Ctrl8", 10: "Ctrl9", 11: "Ctrl10"}
; the selection numbers and the labels they correspond to
if (Selection != 1)
{
gosub, % Select[Selection]
}
return


Tab::
Selection++
if (Selection > TotalControls)
{
Selection := 2
}
gosub, ChangeSelection
return


+Tab::
Selection--
if (Selection < 2)
{
Selection := TotalControls
}
gosub, ChangeSelection
return


#IfWinActive



Close:
ExitApp


Ctrl1:
Selection := 2
Gui, submit, nohide
gosub, ChangeSelection
IfNotEqual, tx1, ; if search field isn't blank
{
Run, %Ctrl1Param2%%TX1%
Return
}
Else ; if search is blank
{
Run, %Ctrl1Param1%
}
Return


Ctrl2:
Selection := 3
Gui, submit, nohide
gosub, ChangeSelection
IfNotEqual, tx1, ; if search field isn't blank
{
Run, %Ctrl2Param2%%TX1%
Return
}
Else ; if search is blank
{
Run, %Ctrl2Param1%
}
Return



Ctrl3:
Selection := 4
Gui, submit, nohide
gosub, ChangeSelection
IfNotEqual, tx1, ; if search field isn't blank
{
Run, %Ctrl3Param2%%TX1%
Return
}
Else ; if search is blank
{
Run, %Ctrl3Param1%
}
Return



Ctrl4:
Selection := 5
Gui, submit, nohide
gosub, ChangeSelection
IfNotEqual, tx1, ; if search field isn't blank
{
Run, %Ctrl4Param2%%TX1%
Return
}
Else ; if search is blank
{
Run, %Ctrl4Param1%
}
Return


Ctrl5:
Selection := 6
Gui, submit, nohide
gosub, ChangeSelection
IfNotEqual, tx1, ; if search field isn't blank
{
Run, %Ctrl5Param2%%TX1%
Return
}
Else ; if search is blank
{
Run, %Ctrl5Param1%
}
Return


Ctrl6:
Selection := 7
Gui, submit, nohide
gosub, ChangeSelection
IfNotEqual, tx1, ; if search field isn't blank
{
Run, %Ctrl6Param2%%TX1%/_/N-8qh/
Return
}
Else ; if search is blank
{
Run, %Ctrl6Param1%
}
Return



Ctrl7:
Selection := 8
Gui, submit, nohide
gosub, ChangeSelection
IfNotEqual, tx1, ; if search field isn't blank
{
Run, %Ctrl7Param2%%TX1%
Return
}
Else ; if search is blank
{
Run, %Ctrl7Param1%
}
Return

Ctrl8:
Selection := 9
Gui, submit, nohide
gosub, ChangeSelection
IfNotEqual, tx1, ; if search field isn't blank
{
Run, %Ctrl8Param2%%TX1%&type=movies
Return
}
Else ; if search is blank
{
Run, %Ctrl8Param1%
}
Return

Ctrl9:
Selection := 10
Gui, submit, nohide
gosub, ChangeSelection
IfNotEqual, tx1, ; if search field isn't blank
{
Run, %Ctrl9Param2%%TX1%
Return
}
Else ; if search is blank
{
Run, %Ctrl9Param1%
}
Return



Ctrl10:
Selection := 11
Gui, submit, nohide
gosub, ChangeSelection
IfNotEqual, tx1, ; if search field isn't blank
{
Run, %Ctrl10Param2%%TX1%
Return
}
Else ; if search is blank
{
Run, %Ctrl10Param1%
}
Return

Ctrl11:
Selection := 12
Gui, submit, nohide
gosub, ChangeSelection
IfNotEqual, tx1, ; if search field isn't blank
{
Run, %Ctrl11Param2%%TX1%
Return
}
Else ; if search is blank
{
Run, %Ctrl11Param1%
}
Return

Ctrl12:
Selection := 13
Gui, submit, nohide
gosub, ChangeSelection
IfNotEqual, tx1, ; if search field isn't blank
{
Run, %Ctrl12Param2%%TX1%
Return
}
Else ; if search is blank
{
Run, %Ctrl12Param1%
}
Return


capeably
  • Members
  • 61 posts
  • Last active: Jun 10 2016 06:50 AM
  • Joined: 18 May 2013

 

And now one question.  Is there a way in your script to add more items in the list? 

 

Here is my script - you will see that the last youtube entry is where I would like to add a new site but that is where the script stops working. I should add that I don't care about using shortcuts to access these links, so if the limit is set because of shortcuts using Ctrl 1 to 0 for example, I could do without them - I'm just not sure what to delete from the script.

Enter::
NumpadEnter::
Select := {2: "Ctrl1", 3: "Ctrl2", 4: "Ctrl3", 5: "Ctrl4", 6: "Ctrl5", 7: "Ctrl6", 8: "Ctrl7", 9: "Ctrl8", 10: "Ctrl9", 11: "Ctrl10"}
; the selection numbers and the labels they correspond to
if (Selection != 1)
{
gosub, % Select[Selection]
}
return

 

 

Hi lise!

 

My apologies for the late reply. I've been away for a while and only just saw this now.

 

I'm so glad that you like the script I posted! Thanks for commenting and posting your own version!

 

I'm not an AHK expert by any means, so I'm not sure what the problem with the script might be. The only thing I can see that might be causing problems is the portion of your script I left in the code quoted above -- there is no code for Ctrl11 and Ctrl12.

 

Try replacing that portion of your script with this, which includes those additional 2 controls:

Enter::
NumpadEnter::
Select := {2: "Ctrl1", 3: "Ctrl2", 4: "Ctrl3", 5: "Ctrl4", 6: "Ctrl5", 7: "Ctrl6", 8: "Ctrl7", 9: "Ctrl8", 10: "Ctrl9", 11: "Ctrl10", 12: "Ctrl11", 13: "Ctrl12"}
; the selection numbers and the labels they correspond to
if (Selection != 1)
{
	gosub, % Select[Selection]
}
return

Hope this helps!