Jump to content

alexcory

Member
  • Posts

    47
  • Joined

  • Last visited

Contact Methods

  • Twitter
    @AlexCory_

Profile Information

  • Location
    San Francisco
  • Interests
    Love Mt. Biking, Snowboarding, and just all outdoor activities. I also love creating things.

alexcory's Achievements

Member

Member (4/5)

1

Reputation

  1. You could maybe add a setting called "text expansion key" so people could use other keys too. I just think tab is super intuitive and it allows it so your snippets don't interfere with other text you might be typing. Some people may prefer the enter key. Anyway, I will promote the shit out of the text expansion for Alfred if you add this one feature. Until then I'll have to stick with aText
  2. Basically what I want is instead of "auto expanding" what would be nice is to type your keyword, and then hit tab to expand it. Example: (you type) lorem + TAB which would equate to Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  3. Okay, so I thought this through a little more and here's what I've gotten so far. I need to be able to grab the file path of the current project that I have open. I thought of a couple different ways to do this. First of all, at least for me, I only have 2 `workspaces` I used to house all of my projects on my machine. `htdocs` and `git repositories`. I'm assuming most developers do the same. With this in mind, I feel like developers could set their project directories initially which would give me the place to stop when pattern matching in the next step. I could then use Applescript to grab the current file, match that absolute path with the `projects` in their `workspace` to determine the `current project's directory`. I've found the following Applescript code from another workflow but being that I'm mostly `php` proficient, I am having trouble passing the output of the Applescript to php. I know there is a way to just grab the current project directory via Applescript but I can't figure out how. Could I get a wee bit of help on this please! Also, here are the steps I've thought of to complete this workflow. Any suggestions / advice on things I might have planned out wrong? Step 1 (aka: pre-search - initialized by hot key) Settings:Choose whether you want absolute path, or relative path to be default when pasting path in [need help figuring this part out] ie: relative get path of project directory [i feel like there's a better a better way to do this. Any way to do it in bash?]path to find: /users/username/path/to/workspace/current_project ideas:have the user initially set their "workspaces" where they usually put their projects (not preferred) grab the path via Applescript for whatever IDE/Text Editor the user is currently in [how do I grab this?] get path of current filepath to find: /users/username/path/to/workspace/current_project/views/elements/header.php possible logic // filename: get_path.scpt on getPath() -- get path to frontmost document set frontPath to (path to frontmost application as text) try tell application (frontPath) try set p to (path of document 1) -- preview uses this style on error set p to (do shell script "ruby -rcgi -e 'print CGI.unescape ARGV[0][7..-1]' " & quoted form of p) if p starts with "localhost" then set p to (file of document 1) -- keynote, pages uses this style end try end tell set p to POSIX path of p on error -- if all else fails try to get it through system events tell application "System Events" set theprocess to the first process whose frontmost is true set thewindow to the value of attribute "AXFocusedWindow" of theprocess set thefile to the value of attribute "AXDocument" of thewindow as string end tell --tell application "System Events" to tell (process 1 where frontmost is true) -- value of attribute "AXDocument" of window 1 --end tell set p to result set p to (do shell script "ruby -rcgi -e 'print CGI.unescape ARGV[0][9..-1]' " & quoted form of p) end if end try return p end getPath set p to getPath() of pathscript -- get parent directory do shell script "dirname " & quoted form of p return p [What am I doing wrong here?] // then grabbing the the output of p in the php file // filename controller.php <?php include_once 'get_path.scpt'; include_once 'Workflows.php'; $w = new Workflows; $path = exec('osascript get_path.scpt'); // [Why do neither of these work? Output: "Parse error: parse error in Command line code on line 1"] // $path = passthru("/usr/bin/osascript get_path.scpt"); var_dump($path); ?> Step 2 (aka: search) set the search location to current project's directory get path of queried fileie: /users/username/path/to/workspace/current_project/assets/css/main.cs set paths relative to current project (queried file & current file) ie: remove the "/users/username/path/to/workspace/ where the current_project names match, stop removing pre-directories // aka left with: $current_file = '/current_project/views/elements/header.php'; $queried_file = '/current_project/assets/css/main.css'; generate path to be pasted inpossible logic // find how many "../'s" are needed // find the path moving out $dotdot_slashes = count(explode('/', $current_file)) - 1; //don't move up passed current_project $path_out = str_repeat('../', $dotdot_slashes); // find the path moving mack in $remove_root_from_queried_file = array_shift(explode('/', $queried_file)); $path_in = implode('/', $remove_root_from_queried_file); // path to be pasted in $final_path = $path_out . '/' . $path_in; return $final_pathAny help would be greatly appreciated!
  4. So I'm trying to build a workflow where you would initially set whether you wanted to use the absolute path or relative path. It would then recognize the file you are currently in based off of where you're cursor is (shouldn't matter what IDE you're in), also recognize the project directory that is open. You would then be able to fuzzy search (or just regular search) the current project directory for a file you want to include in your current file (ie: a CSS file or something). When you hit enter, it would then either paste in the relative path or absolute path depending on what your initially set up. Any help oh how to start this?
  5. Awesome, I just tried this and I guess some other app is overriding the ⌥+C command. I know this doesn't pertain to you guys, but any advice on how to find out what's causing this? Maybe like some sort of global "key conflicts" or just away to see which apps are controlling which hotkeys? I really appreciate the help by the way!
  6. I can't find out which workflow is using ⌥+C. Any workflows to search through the hotkeys that are currently being used? I tried using the Help workflow but I'm not able to search through the created 'alfred-help.md' file. It's only showing a preview of the file and I wasn't able to locate where the file is at on my machine.
  7. `git` is in both `usr/local/bin` and `usr/bin/`. The same thing goes for `rsync`. At least I was able to see both of them in both directories. Could you walk through what's going on in those commands? Does the " --git-dir " portion return the git repository that you're currently selecting? What does the " --work-tree do? How does the ".git" work? The .git part is mostly what's throwing me off I think. // Add all the files $command = "git --git-dir $github/.git --work-tree $github/ add $github/*"; exec($command);
  8. Hey Andrew! I really appreciate the help! Here's what I've tried: turning off the `⌘-Click Opens Filename/URL` setting in iTerm to see if that might help. You don't think symlinks would have anything do with this do you? (Just curious). I had to reinstall Alfred when I reformatted my computer a couple weeks back. (Should I try reinstalling it again?) ​There's been some other problems but I pretty much have them all figured out. I just haven't had time to figure this one out lately. Help would be greatly appreciated! -Alex (btw, favorite app on my mac. I customized my mac to have the Ubuntu Ambience theme and made Alfred look like Sublime Text's ⌘+⇧+P . see here if you're curoius!)
  9. Whenever I go to open a URL, it opens the default terminal (iTerm) instead of opening the url. I think I figured out what the problem is though. (partially) I noticed there were two chrome images on the drop-down as you can see from this image. Any idea on what might be causing this/how to fix it?
  10. I can't seem to get the php to execute the command I'm giving it in the terminal. The Problem: 1. Won't actually perform the task in iTerm 2. My plugins don't open at vim startup if I start vim like this vim ~/path/to/directory But will work with this cd ~/path/to/directory; vim Here's what I put in php: $dir = "{query}"; $cmd = "cd " . "$dir" . "; vim"; //echo $cmd; //ouputs: cd path/to/proper/directory; vim; exec("$cmd"); // doesn't even open the terminal $dir = "{query}"; $cmd = "open -a iTerm; cd" . "$dir" . "; vim;"; // IF TERMINAL SWITCH THE ABOVE iTerm TO Terminal //echo $cmd; //ouputs: cd path/to/proper/directory; vim; exec("$cmd"); // doesn't even open the terminal Then I tried running a `terminal command` action with the following in it query=“{query}”; echo “${query// /\\ }" // because the ~/path/to/foo bar won't work. Needs to be ~/path/to/foo\ bar I know that last one is not quite right. I'm still learning bash. I posted a question on StackOverflow here. Can anybody help me please!?
  11. I'm pretty sure it's not a good idea to put cd in there but it made it work properly without opening the terminal every time. It ended up looking like this. # -- Step 1: Sync Local Directories -- rsync -avz /path/to/directory1/ ~/path/to/local/git\ repository/for/directory1/; # rm -r .DS_Store; # -- Step 2: Push Changes To Github -- cd ~/path/to/local/git\ repository/for/directory1/; git add *; git commit -m "{query}"; git push --all Is it not good practice to put the cd in there? Can it cause problems or anything?
  12. Why does this work in if I put it in a Terminal Command but not in a Run Script set to /bin/bash/? # -- Step 1: Sync Local Directories -- rsync -avz /path/to/directory1/ ~/path/to/local/git\ repository/for/directory1/; # rm -r .DS_Store; # -- Step 2: Push Changes To Github -- ~/path/to/local/git\ repository/for/directory1/; git add *; git commit -m "{query}"; git push --all
×
×
  • Create New...