avk_tp Posted June 1, 2013 Share Posted June 1, 2013 Hello, I've got a translation workflow up and running, but the website limits the number of requests per hour per API key. As such, while I could put out the workflow as is, I was wondering if there's a relatively simple way of prompting the user to get and enter their own. I tried using the Wolfram|Alpha workflow as my example, but I couldn't get it to work. I'm hoping that someone knows of another (simpler) example I could try to replicate, given that I'm not actually a programmer. Thanks very much, Anthony Link to comment
Tyler Eich Posted June 1, 2013 Share Posted June 1, 2013 Hello, I've got a translation workflow up and running, but the website limits the number of requests per hour per API key. As such, while I could put out the workflow as is, I was wondering if there's a relatively simple way of prompting the user to get and enter their own. I tried using the Wolfram|Alpha workflow as my example, but I couldn't get it to work. I'm hoping that someone knows of another (simpler) example I could try to replicate, given that I'm not actually a programmer. Thanks very much, Anthony I made the Wolfram|Alpha Workflow; could you post your issue on the Wolfram|Alpha thread? I recently updated the workflow because I found a bunch of empty code messing up the programming. Anyway, I'd be happy to explain how I did it if you like Cheers Link to comment
jdfwarrior Posted June 1, 2013 Share Posted June 1, 2013 Hello, I've got a translation workflow up and running, but the website limits the number of requests per hour per API key. As such, while I could put out the workflow as is, I was wondering if there's a relatively simple way of prompting the user to get and enter their own. I tried using the Wolfram|Alpha workflow as my example, but I couldn't get it to work. I'm hoping that someone knows of another (simpler) example I could try to replicate, given that I'm not actually a programmer. Thanks very much, Anthony I made the Wolfram|Alpha Workflow; could you post your issue on the Wolfram|Alpha thread? I recently updated the workflow because I found a bunch of empty code messing up the programming. Anyway, I'd be happy to explain how I did it if you like Cheers Since this is more geared toward help and not the Wolfram workflow, it's actually probably better to keep the conversation here. That way I can chip in and help as well. I personally don't use the Wolfram workflow so I'm not sure how it does it, but Tyler could help you, or if you simply described it, I could point you in the right direction as well. Link to comment
avk_tp Posted June 2, 2013 Author Share Posted June 2, 2013 Thanks for the help, guys. As in the wolfram|alpha workflow, first up I've got a script filter (which seems to work fine): require_once('workflows.php'); $w = new Workflows(); $q = $argv[1]; $id = urlencode($q); $w->result( 'setting API', $q, "Set API to '$q'", 'Enter a valid API', 'icon.png', 'yes'); echo $w->toxml(); Then I run a script, which I think is where the problem is: $q = $argv[1]; require_once('workflows.php'); $w = new Workflows(); $id = $argv[1]; $w->set('appid', $id, 'settings.plist'); echo $id; Attempting to set the api key, I get a fatal error: Fatal error: Call to undefined method Workflows::set() in /Users/anthonykevins/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.A2B87F2A-763E-45D4-893C-B773A0C90632/setapi.php on line 15 My best guess is that the problem has something to do with 'settings.plist'. I don't see it in the wolfram|alpha workflow folder, and so I have no variant of it in my folder either (I've obviously got 'info.plist' in there though). Any ideas? Link to comment
Tyler Eich Posted June 2, 2013 Share Posted June 2, 2013 Thanks for the help, guys. As in the wolfram|alpha workflow, first up I've got a script filter (which seems to work fine): Then I run a script, which I think is where the problem is: Attempting to set the api key, I get a fatal error: My best guess is that the problem has something to do with 'settings.plist'. I don't see it in the wolfram|alpha workflow folder, and so I have no variant of it in my folder either (I've obviously got 'info.plist' in there though). Any ideas? It says that the '$w->set()' method is failing. Could you add var_dump($w); after $w = new Workflows(); That will output the contents of the Workflows Class. settings.plist will save to '~/Library/Application Support/Alfred 2/Workflow Data/{bundle.id}/settings.plist' by default. Check there. Link to comment
avk_tp Posted June 2, 2013 Author Share Posted June 2, 2013 It says that the '$w->set()' method is failing. Could you add var_dump($w); after $w = new Workflows(); That will output the contents of the Workflows Class. settings.plist will save to '~/Library/Application Support/Alfred 2/Workflow Data/{bundle.id}/settings.plist' by default. Check there. I added the line, but the error persists: qobject(Workflows)#1 (6) { ["cache":"Workflows":private]=> string(95) "/Users/anthonykevins/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/wordreference" ["data":"Workflows":private]=> string(85) "/Users/anthonykevins/Library/Application Support/Alfred 2/Workflow Data/wordreference" ["bundle":"Workflows":private]=> string(13) "wordreference" ["path":"Workflows":private]=> string(143) "/Users/anthonykevins/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.A2B87F2A-763E-45D4-893C-B773A0C90632" ["home":"Workflows":private]=> string(20) "/Users/anthonykevins" ["results":"Workflows":private]=> array(0) { } } Fatal error: Call to undefined method Workflows::set() in /Users/anthonykevins/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.A2B87F2A-763E-45D4-893C-B773A0C90632/setapi.php on line 16 Thanks again for the help. Link to comment
jdfwarrior Posted June 2, 2013 Share Posted June 2, 2013 I added the line, but the error persists: Thanks again for the help. The previous error says that the set() function doesn't exist. Have you modified the workflows.php file any? Where did you get it from? Download it directly from my blog? Link to comment
avk_tp Posted June 3, 2013 Author Share Posted June 3, 2013 The previous error says that the set() function doesn't exist. Have you modified the workflows.php file any? Where did you get it from? Download it directly from my blog? Downloading it directly from your blog fixed the problem! I'm almost certain I didn't modify the workflows.php, but although the version I had was 0.3, it was missing the "save values to a specified plist" section. I probably originally copy/pasted the file from another workflow (most likely the urban dictionary one that I used as my example for the script). Thanks so much for the help! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now