Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to open folders by name that are specified in a csv #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions GUI/GUI.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ gui_spawn:
}

gui_state = main
search_urls := 0

Gui, Margin, 16, 16
Gui, Color, 1d1f21, 282a2e
Expand Down Expand Up @@ -122,6 +123,41 @@ gui_search_add_elements:
Gui, Show, AutoSize
return

gui_project_search_add_elements:
Gui, Add, Text, %gui_control_options% %cYellow%, %gui_search_title%
Gui, Add, Edit, %gui_control_options% %cYellow% vList -WantReturn
Gui, Add, Button, x-10 y-10 w1 h1 +default ggui_find_and_open_folder ; hidden button
GuiControl, Disable, Pedersen
Gui, Show, AutoSize
return

gui_find_and_open_folder:
OnSelect:
Gui, Submit, nohide
gui_destroy()
;Parse a comma separated value (CSV) file:
Loop, read, %A_ScriptDir%\Miscellaneous\folders.csv
{
LineNumber = %A_Index%
Loop, parse, A_LoopReadLine, CSV
{
; save all column values to Field1, Field2, ...
Field%A_Index% := A_LoopField
}
If (Field1 == List)
{
folder = %Field2%
Loop, %search_urls%
{
StringReplace, search_final_url, search_url%A_Index%, REPLACEME, %folder%
run %search_final_url%
}
search_urls := 0
return
}
}
return

gui_search(url) {
global
if gui_state != search
Expand Down Expand Up @@ -151,6 +187,27 @@ gui_SearchEnter:
search_urls := 0
return

gui_projectsearch(url) {
global
if gui_state != search
{
gui_state = search
; if gui_state is "main", then we are coming from the main window and
; GUI elements for the search field have not yet been added.
Gosub, gui_project_search_add_elements

}

; Assign the url to a variable.
; The variables will have names search_url1, search_url2, ...

search_urls := search_urls + 1
search_url%search_urls% := url
}




;-------------------------------------------------------------------------------
; TOOLTIP
; The tooltip shows all defined commands, along with a description of what
Expand Down
12 changes: 11 additions & 1 deletion GUI/UserCommands.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ else if Pedersen = x%A_Space% ; Search Google as Incognito
;-------------------------------------------------------------------------------
;;; SEARCH OTHER THINGS ;;;
;-------------------------------------------------------------------------------
else if Pedersen = f%A_Space% ; Search Facebook
else if Pedersen = fb%A_Space% ; Search Facebook
{
gui_search_title = Search Facebook
gui_search("https://www.facebook.com/search/results.php?q=REPLACEME")
Expand Down Expand Up @@ -134,6 +134,11 @@ else if Pedersen = rel ; Reload this script
gui_destroy() ; removes the GUI even when the reload fails
Reload
}
else if Pedersen = flist ; show CSV with folders
{
gui_destroy()
run, notepad.exe "%A_ScriptDir%\Miscellaneous\folders.csv"
}
else if Pedersen = dir ; Open the directory for this script
{
gui_destroy()
Expand Down Expand Up @@ -204,6 +209,11 @@ else if Pedersen = rec ; Recycle Bin
gui_destroy()
Run ::{645FF040-5081-101B-9F08-00AA002F954E}
}
else if Pedersen = f%A_Space% ; Open local folder
{
gui_search_title = Find local folder
gui_projectsearch("REPLACEME")
}


;-------------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions Miscellaneous/folders.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
c,C:\
programs,C:\Program Files
programsx,C:\Program Files (x86)
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ When typing something in the GUI, whatever you type is matched up against the co
* While in Notepad, type `@` into the GUI. It will write your e-mail address (but you need to go into `UserCommands.ahk` later to specify your own address).
* Try typing `down` into the GUI to open your Downloads folder or `rec` to open the Recycle Bin.
* You can search google by typing `g` followed by a space. A new input field should appear. Type your search query and press enter. Use `l ` if you are 'Feeling Lucky'.
* You can search Youtube with `y `, search Facebook with `f ` or the torrent networks with `t `.
* You can search Youtube with `y `, search Facebook with `fb ` or the torrent networks with `t `.
* If you like Reddit, you can visit a specific subreddit by typing `/` into the GUI and then the name of the subreddit you have in mind.
* Try `week` or `date`. (I can never remember the week number so this is useful when on the phone with somebody who insists on comparing calendars going by week number).
* Type `ping` into the GUI to quickly ping www.google.com to see if your internet connection works.
* Type `f ` to enter the name of a folder that should be opened (definition in [`folders.csv`](./Miscellaneous/folders.csv))

There are some additional example commands included. Try typing simply `?`, and you should see a tooltip with all defined commands and a description of what they do. You may also explore all the sample commands in detail by looking in `UserCommands.ahk`. Now it is time for you to start filling in your own personalized commands.

Expand Down