Jump to content

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

anything.ahk anything-explorer-history.ahk anything-run.ahk


  • Please log in to reply
54 replies to this topic
jixiuf
  • Members
  • 48 posts
  • Last active: Dec 24 2015 01:57 AM
  • Joined: 16 May 2011

need AHK_L
similar to quicksliver on Mac
<!-- m -->http://www.screenr.com/xxss<!-- m --> (there is a screencast here : )
<!-- m -->http://www.screenr.com/vp8s(A<!-- m --> new One )
<!-- m -->http://www.screenr.com/BH7s<!-- m --> (and another one show anything-favorite-directories.ahk)
<!-- m -->http://www.screenr.com/MyHs<!-- m --> (and another show anything-window-switch.ahk)
<!-- m -->http://www.screenr.com/Zbjs<!-- m --> (new one ,show anything-services.ahk)
you can also download these videos
<!-- m -->http://screencast-re... ... pl-run.mp4<!-- m -->
<!-- m -->http://screencast-re... ... istory.mp4<!-- m -->
<!-- m -->http://screencast-re... ... switch.mp4<!-- m -->
<!-- m -->http://screencast-re... ... av-dir.mp4<!-- m -->
<!-- m -->http://screencast-re... ... es.ahk.zip<!-- m -->

and source code is host on
<!-- m -->https://github.com/j... ... hk_scripts<!-- m -->

you can follow these links ,and save them on you disk .
<!-- m -->https://github.com/j... ... 12_9_8.zip<!-- m -->
if you think
anything.ahk is great ,and have written an anything-source for it ,you can post it here .


If you use GNU/Emacs maybe you have known "Anything"
maybe not ,
you can visit "Anything" on emacswiki
<!-- m -->http://www.emacswiki.../emacs/Anything<!-- m -->
and see what "Anything" it is .

Documention:

http://jixiuf.github...ything-doc.html
some screenshots:

anything-directory-history1.JPG
anything-directory-history2.JPG
anything-directory-history3.JPG
anything-directory-history4.JPG
anything-directory-history5.JPG
anything-directory-history6.JPG

anything-fav-history1.JPG
anything-fav-history2.JPG
anything-fav-history3.JPG
anything-fav-history4.JPG

 



sumon
  • Moderators
  • 1317 posts
  • Last active: Dec 05 2016 10:14 PM
  • Joined: 18 May 2010
If that was what it seemed to be, it seems pretty cool :)

jixiuf
  • Members
  • 48 posts
  • Last active: Dec 24 2015 01:57 AM
  • Joined: 16 May 2011
some little example ,show how to write anything source
anything-example2.ahk
#include anything.ahk

action4source1(candidate)
{
anything_MsgBox("you have select candidate:" . candidate)
}

getCandidates()
{
return Array("red","green")
}

source1 :=Object()
;;"candidate" can be a function name ,
;;the function must return an array
;;"action" is a function accept one parameter
;;the parameter is your selected candidate
;;"name" is just a name show behind each candidate

;; when you select a candidate , "Anything" will execute the 
;; "action" function on your selected candidate 
source1["candidate"]:="getCandidates"
source1["action"]:="action4source1"
source1["name"]:="name"
f1::anything(source1)




anything-example3.ahk
#include anything.ahk

action4source1(candidate)
{
anything_MsgBox("you have select candidate:" . candidate)
}

source1 :=Object()
;;this example is the same to anything-example2.ahk
;;except : 
;;candidates can be an array
;;
candidates:=Array("red","green")
source1["candidate"]:=candidates

source1["action"]:="action4source1"
source1["name"]:="demo2"

f1::anything(source1)


anything-example4.ahk

#include anything.ahk
;;anything support multiply sources
;; the candidate from different source will execute different action 
;; when you select it .
;;
;; and Ctrl-o  will send the candidates of first source to Last 
action4source1( candidate)
{
anything_MsgBox("you have select candidate:" . candidate . "from source1")
}

getCandidates()
{
candidates:=Array("red","green")
return candidates
}

source1 :=Object()
source1["candidate"]:="getCandidates"
source1["action"]:="action4source1"
source1["name"]:="source1"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

action4source2(candidate)
{
anything_MsgBox("you have select candidate:" . candidate . "from source2")
}
getCandidates2()
{
candidates:=Array("white","black")
return candidates
}

source2 :=Object()
source2["candidate"]:="getCandidates2"
source2["action"]:="action4source2"
source2["name"]:="source2"

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

action4source3(candidate)
{
display:=candidate[1]
real:=candidate[2]
anything_MsgBox("you have select candidate:" . candidate . "from source3`n the string display on listview is " . display . "`n real usful info is price:" . real)
}


getCandidates3()
{
candidates:=Array()
book:=Object()
book.insert("book111111111")
book.insert("$10.0")

pen:=Object()
pen.insert("pen22222222222")
pen.insert("$3.0")

candidates.insert(book)
candidates.insert(pen)
return candidates
}

source3 :=Object()
source3["candidate"]:="getCandidates3"
source3["action"]:="action4source3"
source3["name"]:="source3"


sources:= Array()
sources.insert(source1)
sources.insert(source2)
sources.insert(source3)

f1::anything_multiple_sources(sources)


anything-example5.ahk

#include anything.ahk
;;multiple actions for one source
;;Enter execute default action
;;Ctrl-j execute second action
;;Ctrl-m execute third action
;;Tab list all available action for the selected candidate
action4source1(candidate)
{
anything_MsgBox("you  select candidate:" . candidate . "execute the default action ,bind [Enter]")
}
action24source1(candidate)
{
anything_MsgBox("you select candidate:" . candidate . "`n and execute 2th action {Default bind Ctrl-j}")

}
action34source1(candidate)
{
anything_MsgBox("you select candidate:" . candidate . "`n and execute 3th action {Default bind Ctrl-m}")
}

source1 :=Object()
;;candidates can be an array
candidates:=Array("red","green")
source1["candidate"]:=candidates

actions:=Array("action4source1" ,"action24source1","action34source1")
source1["action"]:=actions
source1["name"]:="example5"
f1::anything(source1)


anything-example6.ahk
#include anything.ahk

;;each element of candidates can be an array ,
;;the length of the array is 2 , 
;; first element of array will be displayed on listview and
;;be used to match user's search string .
;; the second element of array can be anything .you can store usefull info here .
;; and it can be passed to "action" function
;;
action4source1(candidate)
{
display :=candidate[1]
real :=   candidate[2]
anything_MsgBox("the string display on listview is :" .display . "and real useful info is " real)
}

getCandidates()
{
candidates:=Array()
red:=Array()
red.insert("red")
red.insert("reddddddd")
candidates.insert(red)

green:=Array()
green.insert("gree")
green.insert("ggggggggggggg")
candidates.insert(green)

return candidates
}

source1 :=Object()
;;candidate can be a function name ,
;;the function must return an array 
source1["candidate"]:="getCandidates"
source1["action"]:="action4source1"
source1["name"]:="name"
f1::anything(source1)


anything-example7.ahk
#include anything.ahk

;;you can set properties for "Anything" by callling 
;; another function
;;        anything_multiple_sources_with_properties(sources,anything_properties)
;; or
;;      anything_with_properties(source ,anything_properties)
;; about anything_properties ,see
;;               default_anything_properties 
;; in  anything.ahk ,you can overwrite properties defined there .


action4source1( candidate)
{
anything_MsgBox("you have select candidate:" . candidate . "from source1")
}


action4source2(candidate)
{
anything_MsgBox("you have select candidate:" . candidate . "from source2")
}

getCandidates()
{
candidates:=Array("red","green")
return candidates
}
getCandidates2()
{
candidates:=Array("white","black")
return candidates
}

source1 :=Object()
source1["candidate"]:="getCandidates"
source1["action"]:="action4source1"
source1["name"]:="1111111"

source2 :=Object()
source2["candidate"]:="getCandidates2"
source2["action"]:="action4source2"
source2["name"]:="22222222222"


sources:= Array()
sources.insert(source1)
sources.insert(source2)

anything_properties:=Object()
anything_properties["quit_when_lose_focus"]:="no"
anything_properties["win_width"]:="600"
anything_properties["win_height"]:="300"

f1::anything_multiple_sources_with_properties(sources,anything_properties)



anything-example8.ahk
#include anything.ahk

;;you can set properties for "Anything" by callling 
;; another function
;;        anything_multiple_sources_with_properties(sources,anything_properties)
;; or
;;      anything_with_properties(source ,anything_properties)
;; about anything_properties ,see
;;               default_anything_properties 
;; in  anything.ahk ,you can overwrite properties defined there .
;;
;; and there is a property named "no_candidate_action"
;; the value of this property is a function accept one parameter
;; the default value is 
;; default_anything_properties["no_candidate_action"]:="anything_do_nothing"
;; that means when no candidates matched your search string ,and you press 
;; "Ctrl-i" key ,then this function will be called ,and the search string 
;; will be the parameter 


;;one more  ,even there are matched candidates ,you can 
;; still pass the "search string" to this function 
;; by Ctrl-i


action4source1( candidate)
{
anything_MsgBox("you have select candidate:" . candidate . "from source1")
}


action4source2(candidate)
{
anything_MsgBox("you have select candidate:" . candidate . "from source2")
}

getCandidates()
{
candidates:=Array("red","green")
return candidates
}
getCandidates2()
{
candidates:=Array("white","black")
return candidates
}

source1 :=Object()
source1["candidate"]:="getCandidates"
source1["action"]:="action4source1"
source1["name"]:="1111111"

source2 :=Object()
source2["candidate"]:="getCandidates2"
source2["action"]:="action4source2"
source2["name"]:="22222222222"


sources:= Array()
sources.insert(source1)
sources.insert(source2)

anything_properties:=Object()
anything_properties["no_candidate_action"]:="do_what_you_want_when_no_matched_candidates"

do_what_you_want_when_no_matched_candidates(candidate)
{
anything_MsgBox("press [Ctrl-i] do what you want when no matech candidates ,with your search string ::" . candidate)
}

f1::anything_multiple_sources_with_properties(sources,anything_properties)



anything-example9.ahk
#include anything.ahk
;;support icon 
action4source1(candidate)
{
anything_MsgBox("you have select candidate:" . candidate . "from source1")    
}

getCandidates()
{
candidates:=Array("red","green","blue")
return candidates
}
icon()
{
ImageListID := IL_Create(3)  ; Create an ImageList to hold 3 small icons.
Loop 3  ; Load the ImageList with a series of icons from the DLL.
IL_Add(ImageListID, "shell32.dll", A_Index)
return ImageListID
}

source1 :=Object()
source1["candidate"]:="getCandidates"
source1["action"]:="action4source1"
source1["name"]:="name"
source1["icon"]:="icon"
f1::anything(source1)


jixiuf
  • Members
  • 48 posts
  • Last active: Dec 24 2015 01:57 AM
  • Joined: 16 May 2011
add another source
anything-favorite-directories.ahk
and a litter improvement of
anything.ahk
anything-explorer-directories.ahk
anything-run.ahk

jixiuf
  • Members
  • 48 posts
  • Last active: Dec 24 2015 01:57 AM
  • Joined: 16 May 2011
BugFix ,anything-explorer-history.ahk
the timer of writing history to disk doesn't work .
now it works

jixiuf
  • Members
  • 48 posts
  • Last active: Dec 24 2015 01:57 AM
  • Joined: 16 May 2011
add anything-window-switch.ahk
it is a replacement of Alt-Tab ,just like iswitchw.ahk
see my another window-switch
iswitch-plus.ahk
<!-- m -->http://www.autohotke... ... highlight=<!-- m -->


and update anything.ahk
add global variable anything_wid ,
and anything-source support property :<icon> now

Skrell
  • Members
  • 384 posts
  • Last active: Jul 07 2016 05:03 PM
  • Joined: 23 Aug 2011
These are GREAT scripts, and i am currently using your window switcher (which is MUCH faster than your iswitchplus script). However, as i am not very good with autohotkey, i am having a VERY hard time understanding your anything source code. So i have 2 requests.
1. Could you put more detailed comments in ur code to help people like me learn?
2. If i wanted to make a change so that your window switcher would automatically switch to a window when there is only 1 search result showing how would i do that?

Keep up the great work!

TheGreatSwami Woo
  • Members
  • 237 posts
  • Last active: Jan 22 2012 03:31 PM
  • Joined: 26 May 2011
seems a pretty cool idea, the screen casts are not very clear though, maybe you dont speak english? A voice over would be very helpful.

Skrell
  • Members
  • 384 posts
  • Last active: Jul 07 2016 05:03 PM
  • Joined: 23 Aug 2011
That's what i was thinking too :/

jixiuf
  • Members
  • 48 posts
  • Last active: Dec 24 2015 01:57 AM
  • Joined: 16 May 2011

These are GREAT scripts, and i am currently using your window switcher (which is MUCH faster than your iswitchplus script). However, as i am not very good with autohotkey, i am having a VERY hard time understanding your anything source code. So i have 2 requests.
1. Could you put more detailed comments in ur code to help people like me learn?
2. If i wanted to make a change so that your window switcher would automatically switch to a window when there is only 1 search result showing how would i do that?

Keep up the great work!


I will put more comments in my code .
and now ,you can look at some little
examples about how to write an anything-source

for the second question
 #include anything.ahk
 #include anything-window-switch.ahk'
 ;; default (now)
 anything_window_switcher_source["anything-execute-action-at-once-if-one"]:="yes" 

!Tab::anything(anything_window_switcher_source)


  • Guests
  • Last active:
  • Joined: --
i don't even know where to put that code? How would ["anything-execute-action-at-once-if-one"]:="yes" even do anything as i don't see code in any of your files that checks for this value??

Skrell
  • Members
  • 384 posts
  • Last active: Jul 07 2016 05:03 PM
  • Joined: 23 Aug 2011
i don't even know where to put that code? How would ["anything-execute-action-at-once-if-one"]:="yes" even do anything as i don't see code in any of your files that checks for this value??

jixiuf
  • Members
  • 48 posts
  • Last active: Dec 24 2015 01:57 AM
  • Joined: 16 May 2011

i don't even know where to put that code? How would ["anything-execute-action-at-once-if-one"]:="yes" even do anything as i don't see code in any of your files that checks for this value??


I'm sorry ,some file is updated ,you need download the new source .

TheGreatSwami Woo
  • Members
  • 237 posts
  • Last active: Jan 22 2012 03:31 PM
  • Joined: 26 May 2011
Hmm, in the end I erased the scripts because in spite of watching the screen casts I had no idea how to use it!!

Skrell
  • Members
  • 384 posts
  • Last active: Jul 07 2016 05:03 PM
  • Joined: 23 Aug 2011
i cannot get your new files to do the switch on 1 source function. I am using 2 files: the anything-config.ahk and anything-window-switch.ahk . This is what my config looks like (note that i only want alt-tab functionality):

;#NoTrayIcon
#SingleInstance force
SetWorkingDir %A_ScriptDir%

#include anything.ahk
;#include anything-run.ahk
;#include anything-favorite-directories.ahk
#include anything-window-switch.ahk
#include anything-explorer-history.ahk

;f3::
;sources:=Array()
;sources.insert(anything_explorer_history_source)
;sources.insert(anything_favorite_directories_source)
;sources.insert(anything_cmd_source)
;sources.insert(anything_window_switcher_source)
;anything_multiple_sources(sources)
;return

;#r::
;sources:=Array()
;sources.insert(anything_cmd_source)
;sources.insert(anything_explorer_history_source)
;sources.insert(anything_favorite_directories_source)
;sources.insert(anything_window_switcher_source)
;anything_multiple_sources(sources)
;return

;;
!Tab::
;^Tab::
sources:=Array()
anything_window_switcher_source["anything-execute-action-at-once-if-one"]:="yes"
sources.insert(anything_window_switcher_source)
sources.insert(anything_cmd_source)
sources.insert(anything_explorer_history_source)
sources.insert(anything_favorite_directories_source)
anything_multiple_sources(sources)
return