Stock Meter Gadget

Status
Not open for further replies.
Mar 29, 2018
9
0
10
I also used your idea for the Currency Gadget on the Stock Meter Gadget and it works perfectly BUT it would be nice if I could expand the Stock Meter to handle more than 6 stocks. Any ideas??
 

racksmith101

Proper
Apr 20, 2018
89
0
110
If you could reference the original thread we might have a better idea what gadget and os you were referring to. Many desktop gadget files can be edited to add extra functionality and change the layout and colours.
 
Mar 29, 2018
9
0
10
Below is the answer regarding the Currency Meter Gadget that I modified to use for the Stock Meter Gadget to provide the data source. The OS is Windows 10.

Whilst my modified Stock Meter Gadget works perfectly it will only handle 6 Stocks and I want to increase that number to at least 10. As a source for the actual Data I use Googlesheets to get the data from the LSE.


QUOTE from earlier Currency Gadget solution


81kabJan 12, 2018, 9:45 AM
Hi there, I want to share my workaround for this issue.

First, when looking through the gadget code I noticed that it use 3rd-party service (Yahoo) to retrieve currency values. But unfortunately Yahoo has closed that service ( https://forums.yahoo.net/t5/Yahoo-Finance-help/http-download-finance-yahoo-com-d-quotes-csv-s-GOOG-amp-f/td-p/387096 ).

I decided to use Google Spreadsheets where it is possible to use GoogleFinance() function and export the spreadsheet to CSV file. In my case, I'm going to track USD/RUB and EUR/RUB pairs. I think you could easily replace them with yours.

Step 1.
Create a new google spreadsheet. First column should contain your currency pairs divided by "/" symbol. Second column will have results of GoogleFinance() calculation.

Step 2.
Fill the table. For example, this is my table:

Currencies will update automatically.

Step 3.
Go to menu and select "File" -> "Publish to Web". Next shoose CSV format and click "Publish".
You will get a URL, something like https://docs.google.com/spreadsheets/.../pub?gid=0&single=true&output=csv . Save it to a safe place.

Step 4.
Now we will need to change URL in the gadget's code.
Go to folder C:\Users\[your user name]\AppData\Local\Microsoft\Windows Sidebar\Gadgets\Currency_Meter.gadget\

Find a file called "gadget.js" and open it with a text editor, e.g. Notepad.
You will see a lot of minified code, copy all the code and paste it to http://unminify.com/ . Click "Unminify".
Next, replace all minified code with unminified one. Save the gadget.js file.

Step 5.
In the gadget.js file find definition of function getData() (line #1393 for me). Replace all the code inside the curly brackets with this code:

getDataURL('YOUR URL FROM STEP 3');

Where you should paste URL from the Step 3 inside the brackets.

In my case:


Next, save the file.

Step 6.
Now you will need to disable the Currency Meter gadget and then enable it again. If everything goes well, you will see it is working again!



Feel free to ask any questions, I will try to help.

Unquote
 
Mar 29, 2018
9
0
10
It's the Addgadgets one and if you can look at it & let me know how to increase the number of stocks that can be shown that would be great. It would especially be useful if the solution could be flexible. Thanks !!


No I haven't tried Rainmeter but I'll have a look at it.
 

racksmith101

Proper
Apr 20, 2018
89
0
110
I have looked at the gadget code and it can be modified to show 10 stocks but it would take a couple of hours to do, you need to do a lot of code cutting, pasting and editing of the gadget css, html and jsc files as well as changing the settings css and html files and adding a few sound files and maybe a few png files, but its doable, just gonna take some careful editing. When i'm off for a couple of days next week (half term and the wife's at work) i may have a play around with it and see what i can do.
 
Mar 29, 2018
9
0
10
OK Thanks.

I have played with VB, VBA before and I've had a look at the gadget.js file in Notepad. There seems to be a great deal of repetitive code where the only change is effectively a number from 1 to 6 (presumably for the 1 to 6 shares that be reported). I'm no expert but it does seem to me that these sections could be actually written in a "loop format" using a variable (set at the beginning of the file) to control the number of loops thus removing the necessity of multiple identical sections (apart from the control number 1 to 6 as at the moment). Certainly, if that's possible & practical, in the gadget.js file that might remove a lot of lines of code and make it more dynamic. If that idea works then it might be possible have a control on the settings which could be used to expand/reduce the number of stocks.

Yes I agree that a certain number of new other files might be needed but if this idea could work then it would, I think, considerably reduce the amount of work in the future and make the program more flexible.

As I say I'm no expert but this is simply my lateral thinking ability coming out !!

It's just an idea but I would be grateful for your views on the practicality of this.
 

racksmith101

Proper
Apr 20, 2018
89
0
110
The loop idea had crossed my mind too when I looked at the code, adding more stocks than a set amount would mean the settings file would have to be radically changed to make it more dynamic ,probably with less adjustment to the individual stock lines and things like the gadget size would have to be changed to a linked dynamic size. The sound files probably aren't necessary unless you wanted them retained and could just use a single one for all stocks. The PNG files are probably just for the settings overlay but I'd need to read the code in depth to see where they are used.
 
Mar 29, 2018
9
0
10
I'm glad that you don't think my comments on the loop idea are out of this world. Regarding the "Sound" - until I looked and saw the sound files I didn't even know there was a sound capability - quite frankly I don't think sound/alarm is important for a reporting gadget like this. If you want to get rid of the sound or only have a single one then that's fine by me.

Regarding the loop idea - I only thought that being more dynamic would probably get rid of a lot of code and make the file easier to deal with rather than facing something like over a hundred A4 pages of code in the gadget.js file alone.
 
Status
Not open for further replies.