Jump to content


Photo

Wolfram|Alpha workflow

Wolfram|Alpha wolfram alpha

  • Please log in to reply
46 replies to this topic

#1 Tyler Eich

Tyler Eich

    Advanced Member

  • Member
  • PipPipPip
  • 603 posts
  • LocationIndiana, USA

Posted 16 February 2013 - 07:26 PM

I converted David Ferguson's Wolfram|Alpha extension to a workflow (and made some tweaks along the way  ;))
 
It requires you have an AppID of your own (get one here). Note: Make sure you wait a few minutes before entering the code; Wolfram|Alpha's servers seem to take a moment to register the AppID.
 
It provides feedback with the answer and input interpretation. If you action an item, it will output all the available information to Growl. Pressing ⌥↩ will copy the answer to the clipboard; ⌘↩ will open your query in Wolfram|Alpha (in the default browser).
 
Here's a picture of the workflow editor:
Wolfram%7CAlpha-Workflow.jpg
 
Here's what it looks like in action:
Wolfram%7CAlpha-Preview.jpg
 
Hope you like it! :D
 
 
Update (May 15, 2013): Fixed another bug that prevented saving of AppID
 
Update (March 5, 2013): Fixed bug that prevented the workflow from saving AppID on certain setups
 
Update (Feb 25, 2013): Fixed garbled text issues, added 'Selection is OS X' argument to hotkey

Edited by Tyler Eich, 25 June 2013 - 09:32 PM.

  • drking, thec13, panrubius and 3 others like this

#2 chriswebb

chriswebb

    Newbie

  • Member
  • Pip
  • 6 posts

Posted 17 February 2013 - 02:30 PM

Hi there,

 

I can't seem to get the AppID to register. Every time I try to input the ID I get from the WA website it tries to validate and then keeps returning the message "xxxxx-xxxxxxxxx" Is Not A Valid AppID.

 

Anyone else having this problem? 



#3 epogue

epogue

    Newbie

  • Member
  • Pip
  • 6 posts

Posted 17 February 2013 - 03:25 PM

Hi there,

 

I can't seem to get the AppID to register. Every time I try to input the ID I get from the WA website it tries to validate and then keeps returning the message "xxxxx-xxxxxxxxx" Is Not A Valid AppID.

 

Anyone else having this problem? 

 

Yep, I'm having the same problem.



#4 Tyler Eich

Tyler Eich

    Advanced Member

  • Member
  • PipPipPip
  • 603 posts
  • LocationIndiana, USA

Posted 17 February 2013 - 07:46 PM

Just tried it with a new AppID; I tried it right away and it didn't work. I tried it again after about 3 minutes and it worked. It uses this code to validate the AppID:

$q = $argv[1];
$id = urlencode($q);
$xml_string = $w->request("http://api.wolframalpha.com/v2/validatequery?input=hello+world&appid=$id");

 

 

Try loading 'http://api.wolframal...id=YOUR-ID-HERE' in a browser. If you get an 'error=true' message, it's something on Wolfram|Alpha's side; maybe it takes a few minutes for the AppID to register.

 

Thanks!



#5 chriswebb

chriswebb

    Newbie

  • Member
  • Pip
  • 6 posts

Posted 18 February 2013 - 10:15 PM

That's resolved it - must just be a timing issue.

 

Many thanks for that - great workflow! 


  • Tyler Eich likes this

#6 Robin

Robin

    Newbie

  • Member
  • Pip
  • 1 posts

Posted 19 February 2013 - 02:14 PM

This is a fantastic workflow! Has the potential to replace a bunch of others e.g. currency conversion, weather etc.

 

Is it possible to wait a very short amount of time after the last keystroke before string is submitted to wolfram? It seems to submit as soon as I start typing, but without allowing me to finish typing (even when typing pretty fast). This means that I waste time waiting for the results to come back from (obviously) unfinished queries before it gets to submitting the finished query. Try a currency conversion like "10USD in GBP" to see what I mean.

 

Ideally it would only submit if there haven't been any keystrokes in, say, the last 0.25 seconds.


  • Tyler Eich and parekh like this

#7 Tyler Eich

Tyler Eich

    Advanced Member

  • Member
  • PipPipPip
  • 603 posts
  • LocationIndiana, USA

Posted 19 February 2013 - 04:47 PM

This is a fantastic workflow! Has the potential to replace a bunch of others e.g. currency conversion, weather etc.
 
Is it possible to wait a very short amount of time after the last keystroke before string is submitted to wolfram? It seems to submit as soon as I start typing, but without allowing me to finish typing (even when typing pretty fast). This means that I waste time waiting for the results to come back from (obviously) unfinished queries before it gets to submitting the finished query. Try a currency conversion like "10USD in GBP" to see what I mean.
 
Ideally it would only submit if there haven't been any keystrokes in, say, the last 0.25 seconds.


I know exactly what you mean! I wish the script would run faster, too. Wolfram|Alpha is a bit sluggish, and launching the script with only a few characters is wasteful.

Right now, the workflow waits until at least three characters have been entered (as suggested by David Ferguson). I would love it if I could throttle the script, but I can't. Andrew might add a feature like this later on; it has been suggested by a few people (http://www.alfredfor...script-filters/).

Thanks for the feedback, and I'm glad you like it! :)
  • parekh likes this

#8 getthething

getthething

    Member

  • Member
  • PipPip
  • 23 posts

Posted 21 February 2013 - 07:11 PM

I can't get this to work. I enter my AppID, alfred tells me it's saved and then when I invoke the command it keeps telling me to provide an appID. It's been this way for a couple days now so it doesn't seem to be an issue waiting for something on WA's end. 

 

Any ideas? 



#9 Tyler Eich

Tyler Eich

    Advanced Member

  • Member
  • PipPipPip
  • 603 posts
  • LocationIndiana, USA

Posted 21 February 2013 - 09:40 PM

I can't get this to work. I enter my AppID, alfred tells me it's saved and then when I invoke the command it keeps telling me to provide an appID. It's been this way for a couple days now so it doesn't seem to be an issue waiting for something on WA's end. 

 

Any ideas?

 

Could you check '~/Library/Application Support/Alfred 2/Workflow Data/tylereich.wolframalpha/settings.plist' and see if your API key is stored within? If you need help reading the .plist file, let me know ;)



#10 getthething

getthething

    Member

  • Member
  • PipPip
  • 23 posts

Posted 22 February 2013 - 03:56 PM

Could you check '~/Library/Application Support/Alfred 2/Workflow Data/tylereich.wolframalpha/settings.plist' and see if your API key is stored within? If you need help reading the .plist file, let me know ;)

 

I don't even have the tylereich.wolframalpha folder. Even after deleting and reinstalling the workflow. When I log into the wolfram alpha dev site it says that there has been 4 queries on my appid. Odd. I'm not sure if this will help but it's caused a couple other Alfred related issues for me so far. My startup disk is on different drive than my home folder. Both internal drives but one SSD, one traditional. 



#11 Tyler Eich

Tyler Eich

    Advanced Member

  • Member
  • PipPipPip
  • 603 posts
  • LocationIndiana, USA

Posted 22 February 2013 - 09:29 PM

I don't even have the tylereich.wolframalpha folder. Even after deleting and reinstalling the workflow. When I log into the wolfram alpha dev site it says that there has been 4 queries on my appid. Odd. I'm not sure if this will help but it's caused a couple other Alfred related issues for me so far. My startup disk is on different drive than my home folder. Both internal drives but one SSD, one traditional. 

 

The queries on your AppID are probably from when the workflow validated your ID.

 

I'm not sure what could be causing your issue  :huh:. I deleted my tylereich.wolframalpha folder and it was immediately recreated when I launched the script. It could be an issue with David Ferguson's Workflows class, or with PHP itself, but I sincerely doubt either is at fault.

 

I doubt this will help, but could you try running the script from the terminal? Open Alfred's preferences > workflows, right-click the Wolfram|Alpha entry, 'Show in Finder', and locate the script called 'wolfram.php'. Open Terminal and type 'php -f ', drag 'wolfram.php' into Terminal to load its path, then type '-- "hello world"'. Hit enter and see what comes out.

 

If you need help, let me know  :)



#12 getthething

getthething

    Member

  • Member
  • PipPip
  • 23 posts

Posted 22 February 2013 - 10:08 PM

The queries on your AppID are probably from when the workflow validated your ID.

 

I'm not sure what could be causing your issue  :huh:. I deleted my tylereich.wolframalpha folder and it was immediately recreated when I launched the script. It could be an issue with David Ferguson's Workflows class, or with PHP itself, but I sincerely doubt either is at fault.

 

I doubt this will help, but could you try running the script from the terminal? Open Alfred's preferences > workflows, right-click the Wolfram|Alpha entry, 'Show in Finder', and locate the script called 'wolfram.php'. Open Terminal and type 'php -f ', drag 'wolfram.php' into Terminal to load its path, then type '-- "hello world"'. Hit enter and see what comes out.

 

If you need help, let me know  :)

 

 

Here's what it outputs (assuming I ran it correctly): 

 

 

Usage: php [options] [-f] <file> [--] [args...]
       php [options] -r <code> [--] [args...]
       php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]
       php [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]
       php [options] -- [args...]
       php [options] -a
 
  -a               Run as interactive shell
  -c <path>|<file> Look for php.ini file in this directory
  -n               No php.ini file will be used
  -d foo[=bar]     Define INI entry foo with value 'bar'
  -e               Generate extended information for debugger/profiler
  -f <file>        Parse and execute <file>.
  -h               This help
  -i               PHP information
  -l               Syntax check only (lint)
  -m               Show compiled in modules
  -r <code>        Run PHP <code> without using script tags <?..?>
  -B <begin_code>  Run PHP <begin_code> before processing input lines
  -R <code>        Run PHP <code> for every input line
  -F <file>        Parse and execute <file> for every input line
  -E <end_code>    Run PHP <end_code> after processing all input lines
  -H               Hide any passed arguments from external tools.
  -s               Output HTML syntax highlighted source.
  -v               Version number
  -w               Output source with stripped comments and whitespace.
  -z <file>        Load Zend extension <file>.
 
  args...          Arguments passed to script. Use -- args when first argument
                   starts with - or script is read from stdin
 
  --ini            Show configuration file names
 
  --rf <name>      Show information about function <name>.
  --rc <name>      Show information about class <name>.
  --re <name>      Show information about extension <name>.
  --ri <name>      Show configuration for extension <name>.


#13 boomchaos

boomchaos

    Newbie

  • Member
  • Pip
  • 4 posts
  • LocationUSA

Posted 25 February 2013 - 05:47 AM

It took me a whlie to get this working but it's pretty awesome! However, I have noticed that there are sometimes display problems for what should be recognized characters. : http://i.imgur.com/IOFfSoX.png

Is there any way this can be fixed? Maybe the ASCII/Character encoding needs to be modified specifically for Wolfram?

IOFfSoX.png


  • Tyler Eich likes this

#14 Tyler Eich

Tyler Eich

    Advanced Member

  • Member
  • PipPipPip
  • 603 posts
  • LocationIndiana, USA

Posted 25 February 2013 - 12:04 PM

It took me a whlie to get this working but it's pretty awesome! However, I have noticed that there are sometimes display problems for what should be recognized characters. : http://i.imgur.com/IOFfSoX.png

Is there any way this can be fixed? Maybe the ASCII/Character encoding needs to be modified specifically for Wolfram?

IOFfSoX.png

 

Good catch! I went a little crazy with UTF8 encoding  :P

 

The original download link has been updated  :)


  • boomchaos likes this

#15 Tyler Eich

Tyler Eich

    Advanced Member

  • Member
  • PipPipPip
  • 603 posts
  • LocationIndiana, USA

Posted 05 March 2013 - 11:51 PM

I can't get this to work. I enter my AppID, alfred tells me it's saved and then when I invoke the command it keeps telling me to provide an appID. It's been this way for a couple days now so it doesn't seem to be an issue waiting for something on WA's end. 
 
Any ideas? 

  

I don't even have the tylereich.wolframalpha folder. Even after deleting and reinstalling the workflow. When I log into the wolfram alpha dev site it says that there has been 4 queries on my appid. Odd. I'm not sure if this will help but it's caused a couple other Alfred related issues for me so far. My startup disk is on different drive than my home folder. Both internal drives but one SSD, one traditional. 


These issues should be fixed now; check the original post for details :)

#16 Tyler Eich

Tyler Eich

    Advanced Member

  • Member
  • PipPipPip
  • 603 posts
  • LocationIndiana, USA

Posted 18 March 2013 - 03:06 AM

Thanks for this workflow, but I'm having a problem with it. When I do a search, the results show up properly in the search window if I wait before hitting enter but whenever I press enter the Growl notification looks like this:
 

 
I was really hoping to use it in the same way I used David Ferguson's V1 extension by simply entering the search, hitting enter and having the results appear in a growl notification.


It looks like your Growl is set to use Notification Center instead of a normal theme. One solution: disable Growl's use of Notification Center and use a normal Growl theme (my favorite is Mono by Christopher Lobay—http://beautifulpixe...no-growl-theme/).

If you want a better way to include Growl in NC, try Bark (http://barkplug.in/). I forget which apps use NC and which ones use Growl because Bark does such a good job integrating the two. Plus, you can decide which apps you want to appear in NC and which apps you want to use a normal Growl style for (like Alfred ;) )
  • SaSaSushi likes this

#17 SaSaSushi

SaSaSushi

    Newbie

  • Member
  • Pip
  • 2 posts

Posted 18 March 2013 - 03:11 AM

Thank you very much for the quick reply, Tyler. I accidentally deleted my initial post. :(

 

That indeed took care of the problem!

 

As I mentioned, I am used to just entering my searches and hitting enter in the V1 extension. It seems the workflow requires the parsing of the search to be complete before hitting enter in order for the proper results to appear in the growl notification.

 

Is there any way around that?



#18 Jono

Jono

    Member

  • Member
  • PipPip
  • 154 posts
  • LocationUK

Posted 19 March 2013 - 11:07 AM

I get the following error message when typing a query

http://d.pr/i/6UVg



#19 pandass4sin

pandass4sin

    Newbie

  • New Member
  • Pip
  • 3 posts

Posted 10 April 2013 - 07:19 PM

I have my own API, and I set it, but no matter what it always says that I never provided my appid..



#20 Tyler Eich

Tyler Eich

    Advanced Member

  • Member
  • PipPipPip
  • 603 posts
  • LocationIndiana, USA

Posted 10 April 2013 - 07:40 PM

I have my own API, and I set it, but no matter what it always says that I never provided my appid..

 

Did you get a notification saying your Wolfram|Alpha ID had been set? If so, do you have a file called 'settings.plist' at '~/Library/Application Support/Alfred 2/Workflow Data/tylereich.wolframalpha/'?





Also tagged with one or more of these keywords: Wolfram|Alpha, wolfram, alpha

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users