It is currently July 2nd, 2024, 7:58 am

Running VBS script from button

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7598
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Running VBS script from button

Post by Yincognito »

LuciferVisuals wrote: April 13th, 2023, 5:52 amSYSTEM RESTORE DELETED MY .ini Files - Didn't expect that!!! BUT NOW COPY MY ENTIRE SKIN TO MY D: DRIVE EVERY NIGHT. I assume I can just copy and paste it back over the working one in rainmeter to over-write it in case that happens again?

So glad I wrote a long boring post or I would not have spotted it.
For the record, if it's just about exiting Rainmeter from a Rainmeter skin, a simple:

Code: Select all

LeftMouseUpAction=["C:\Program Files\Rainmeter\Rainmeter.exe" !Quit]
would do the job, no need for a .bat script calling a .vbs script and all that redundancy.

Other than that, bar some usage of the obsolete !Execute... bang instead of the current [!SomeBangHere][!AnotherBangHere] form, the code looks fine to me (testing it is not feasible since the resources you use and the system you have is probably different than ours). And yes, you should take the necessary precautions before using system restore. Personally, I never used it and never will, 3rd party backup solutions and common sense copy of key folders / files to another partition to have a restorable duplicate are closer to what I envision. Indeed, copying a previously saved version of your skin over the current one is usually enough to have that saved version back again ready for usage, however in some cases, copying other skin dependencies like plugins or layouts is needed. It is preferable to do this while the said skin is unloaded though, just to be on the safe side and avoid possible conflicts.
Last edited by Yincognito on April 13th, 2023, 3:07 pm, edited 1 time in total.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16367
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Running VBS script from button

Post by balala »

LuciferVisuals wrote: April 13th, 2023, 5:52 am I have no idea what UTF-16 LE is, never heard of it,
What text editor are you using? If you're using plain Notepad, open the Remote-Active-1.ini file into it, click Edit > Save as. In the opening Save as dialog, on the lower part of the window you have an Encoding menu. Check there the encoding of your file. It should be UTF-16 LE. If it's another, choose UTF-16 LE from the menu and click Save. In the opening Confirm save as dialog, click Yes, to rewrite the old file which has an improper coding with the UTF-16 LE coded file. Take care that the file with the old coding is rewritten with the newly coded file.
If you're using Notepad++ as text editor, open the file into this app and click the Encoding menu, In the list you have to choose UCS-2 LE BOM as coding of your file. If you have to modify this, don't forget to save the file, to get the encoding changed to the proper one.
If you're using any other text editor I can't say precisely how do you modify the coding, but for sure it can be done in any editor.
LuciferVisuals wrote: April 13th, 2023, 5:52 am Also no idea what language I coded my skin in, I really did start with your hello world example in the tutorial and started adding bits to it by trial and error, after two weeks it had got to what I sent you, and half that fortnight was spent on making graphics for it. I'm amazed and impressed that it works.
Rainmeter uses plain .ini file to store the code of skins. This type of file is a dedicated sort of code, divided into sections (each of them has a name included into brackets, most of them being either measures - the one having a Measure=... option, or meters - as you guesed these are the sections having a Meter=... option and additionally a few "special" sections, like [Metadata], [Rainmeter] or [Variables]) and each section having options (like Measure=Calc, or Formula=( MyMeasure + 1 ), but obviously these are only two examples).
And don't be amazed, nor impressed it works. You did an excelent work, especially for a beginner in Rainmeter coding, if the posted code is yours. Don't worry we all started with altering existing codes, I also did this in my first attempt to realize a working code. And even today, after more than a decade of continuous work with these codes, I also get existing skins and alter them. So don't worry, it's a great job done...
LuciferVisuals wrote: April 13th, 2023, 5:52 am THIS MIGHT BE IMPORTANT TO OTHER USERS
SYSTEM RESTORE DELETED MY .ini Files - Didn't expect that!!!

I had to use restore because I wrote some other VBS scripts one of which was to hide and restore the desktop Icons, (makes rainmeter look so much better), anyway the script hid them but I couldn't get them back, even in windows, so I did a system restore, which worked but deleted my .ini files. (I have fixed those scripts) and they work perfectly at least in windows.

BUT NOW COPY MY ENTIRE SKIN TO MY D: DRIVE EVERY NIGHT

I assume I can just copy and paste it back over the working one in rainmeter to over-write it in case that happens again?
Sorry this has happened. Unfortunately (or fortunately?) I can't tell what a system restore does. But copying the files is a good idea to keep them safe. I do a backup of my whole system once per week, not daily. In any case, having some level of safeness is always a good idea.
LuciferVisuals wrote: April 13th, 2023, 5:52 am BRILLIANT NOW IT'S #*$%ING OBVIOUS WHAT THE PROBLEM IS !!!!!!
I'm glad if you found it. Congratulations.
LuciferVisuals wrote: April 13th, 2023, 5:52 am So glad I wrote a long boring post or I would not have spotted it Thanks so much for your time and patience. it's fixed now and works I just tested it. I have several other cool scripts, once I finish this I'll post the entire project somewhere so others can use it and them
No, you didn't write a boring post. There are no boring posts. Finally when we have no enough time (happens too often unfortunately) we don't read the long posts and are returning to them when have more time.
LuciferVisuals wrote: April 13th, 2023, 5:52 am But to be fair a simple typo in the scripts path would have caused exactly the same mistake and error message.
Right.
User avatar
LuciferVisuals
Posts: 226
Joined: April 11th, 2023, 7:04 pm

Re: Running VBS script from button

Post by LuciferVisuals »

Thanks for lookin through it Yincognito I have already removed the Executes. Looking at my code, it's probably hard to imagine that I don't really know what I'm doing, lol, but I don't. I found I only learn by trial and error, something doesn't work. I mess with it until I find a workable solution, obviously that is not always the correct or best solution. So I wanted someone to look it over in case I have something fundamentally wrong at the outset, something that I'm getting away with by luck, but that could then lead to much bigger problems down the line.

Thanks really appreciate it.

Btw the vbs was part of my learning curve, but my result totally closes rainmeter and every resource it uses, it even removes it from the windows hidden icons, so you have to relaunch it from the windows task bar. It was part of a series of other batch files I have written, I used only use this one as the first to test from Rainmeter because it's the simplest (and safest) one. But I'll try your suggestion to see what it does.

Keith
User avatar
LuciferVisuals
Posts: 226
Joined: April 11th, 2023, 7:04 pm

Re: Running VBS script from button

Post by LuciferVisuals »

To balala

Wow, there is a lot isn't there? I have been using both started with notepad, then found Notepad++ much better. As its all working I'll finish what I'm doing atm, then I'll go through and resave every file. I checked in N++ by just opening one of my files and opting for save as, and it appears to be defaulting to Ms ini file.

OH! I just discovered I cannot go back up to see your post once I started a reply, that's annoying I was going to look at what you said it should be, then look again for it in the list. I'll do that soon as I post this.

Thanks
User avatar
balala
Rainmeter Sage
Posts: 16367
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Running VBS script from button

Post by balala »

LuciferVisuals wrote: April 13th, 2023, 7:25 pm Wow, there is a lot isn't there? I have been using both started with notepad, then found Notepad++ much better.
Yep, Notepad++ has lot of advantages.
LuciferVisuals wrote: April 13th, 2023, 7:25 pm OH! I just discovered I cannot go back up to see your post once I started a reply, that's annoying I was going to look at what you said it should be, then look again for it in the list. I'll do that soon as I post this.
You can't go back, but you can either quote me (when you want to reply, you have to click the Reply with quote button:
ReplyWithQuote.png
instead of Post Reply and in this case you can see and read the quoted reply in the field you're writing your reply). This quotation can be removed before you posting your reply (by clicking the Submit button) if needed or can be kept.
Or can open the same topic onto another tab of your browser (whatever browser are you using) and can switch between these two tabs, to can read my post on one tab and write yours onto the other.
You do not have the required permissions to view the files attached to this post.
User avatar
LuciferVisuals
Posts: 226
Joined: April 11th, 2023, 7:04 pm

Re: Running VBS script from button

Post by LuciferVisuals »

Thanks CodeCode, I have downloaded it and i'll check that out, but my coding was all part of my learning process

My batch files ar 1k each and now work perfectly, which was my objective at the time, the VBS script is another 1K and not essential but just makes the batch file run instantly and totally invisible. By comparison the that .exe is 180k and I intended building my scripts into my project which Ill post somewhere when done. Looking ahead I think many people might wary about downloading anything containing .exe files. But I might be wrong there.

Keith
User avatar
LuciferVisuals
Posts: 226
Joined: April 11th, 2023, 7:04 pm

Re: Running VBS script from button

Post by LuciferVisuals »

LOL thats not working but I'll get the hang of it.

Keith
User avatar
LuciferVisuals
Posts: 226
Joined: April 11th, 2023, 7:04 pm

Re: Running VBS script from button

Post by LuciferVisuals »

I Think I have now got a fully working Project. Just need to put some examples in of to show what it does, and then look at what I need to do to make it a "portable" package and I'll upload it (when I find where it should go, and see if there are any rules).

Anyone like a preview, I can Zip it all and send it to you, or post a zipped copy here, not sure of the protocol for that. Then you can have a play with, let me know what you think. I'll be honest I'm pretty impressed with it, not up to any of your standards, but this is my first attempt.

Keith
User avatar
balala
Rainmeter Sage
Posts: 16367
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Running VBS script from button

Post by balala »

LuciferVisuals wrote: April 13th, 2023, 8:01 pm LOL thats not working but I'll get the hang of it.
Not sure what is not working, because you removed the quotation you should have been include in your reply. Please keep it when you want to quote something, because otherwise we don't know which message have you replied to.
LuciferVisuals wrote: April 14th, 2023, 8:45 pm I Think I have now got a fully working Project. Just need to put some examples in of to show what it does, and then look at what I need to do to make it a "portable" package and I'll upload it (when I find where it should go, and see if there are any rules).

Anyone like a preview, I can Zip it all and send it to you, or post a zipped copy here, not sure of the protocol for that. Then you can have a play with, let me know what you think. I'll be honest I'm pretty impressed with it, not up to any of your standards, but this is my first attempt.
Post it into the appropriate section of the Share Your Creations section of this forum (most probably the Docks and Launchers would be a good place, but finally it's up to you in which section you do upload it). To upload the skin, create a .rmskin package, as described here.
You can include a preview in your post.
User avatar
LuciferVisuals
Posts: 226
Joined: April 11th, 2023, 7:04 pm

Re: Running VBS script from button

Post by LuciferVisuals »

Post it into the appropriate section of the Share Your Creations section of this forum (most probably the Docks and Launchers would be a good place, but finally it's up to you in which section you do upload it). To upload the skin, create a .rmskin package, as described here.
You can include a preview in your post.
Just looking at that as it happens, I't's all working, but until I put some actions into it it just looks good, I'm leaving the Batch files out atm.

Hoping the quotes work this time.

Keith