vbscript encoded file (vbe) not properly working after adding plain vbs - vbscript

I have encoded vbs(vbe) and plain vbs in one file (.vbe) I create this file programmatically with the help of other .vbs script.
For some reason, when it is created programmatically- (.vbe) file doesnt work. BUT When I open it in notepad and add just a simple space, save it and run again- vbe works perfectly. What can be the reason for that?
Also if I manually copy the code from the opened .vbe and then create in ANSI format new .vbe and paste there my code- it works also as well

Related

Can Firefox be "automated"?

I have a PHP file on the server that creates a backup and then returns it as a zip file. There is no HTML returned, just the ZIP file.
My question is:
How can I call Firefox, pass the URL, and tell it where to save the file, and then have that instance of Firefox close? I plan on using Windows Task Scheduler to call this page once per day. The zip file produced has a unique name.
I've seen the option to pass the url, and that works just fine. I also saw the option to open it in a new window. So far I've tried the code below. It opens the file, and the save file dialog. I want this to happen silently.
If there's a better way to accomplish this using another tool rather than Firefox, that would be very helpful.
firefox -new-window https://example.com/bk/makebackup.php?u=username&p=pw&site=site_to_backup

Is it possible to get ie to render a document as html with an extension that is not .htm or .html? (Windows)

I am trying to get an html document that's saved on the file system to run through a vbscript first (to check for script injection) and then open in Internet Explorer if the check passes. I have written the vbscript as well as a .bat to call the script, and all of this works when I don't change the file extension (.htm or .html) but do "open with..." and select my .bat file - the vbscript opens it in IE. But when I change the file extension, IE automatically opens the download dialog instead of rendering the html. I want to use a custom extension as a way of only running certain html docs through my script.
So my question is: Is there a way to get Internet Explorer to recognize and render the document in a file with a custom extension?
CatCat's comment about setting the MIME type is the right answer

Can a batch file write to a hidden notepad file?

Some context:
I have an Excel Macro (.xlsm) file I've created for my company, which I'm creating a batch file for that copies it from a Network folder to a local folder for each computer/user profile that clicks the batch file. What I'm looking to do is for every user that runs the batch file, I want to append their name to a hidden notepad file in the same network folder of the original macro file. That way, whenever I revise/fix/add features to the macro, I'll have a list of all the users that are using the macro file, so I can send an email letting them know of the updates.
Note: I know how to obtain the username of the user that runs the files.
I know that you can write and append to Notepad files using a batch file, but I can't find a source that verifies whether it's possible to write to an existing hidden Notepad file. I came upon this post in my search, but that's using the C# language.
So, my question(s) are:
Can a batch file write/append to a hidden notepad file?
If so, would I use the same syntax/method that you would when writing to a visible (non-hidden) file?
If not, would could I go about this feat? Could I temporarily unhide a hidden file, append to it, then rehide it? Or should I go about it using a different method?
Is this a good method, or is there a more efficient/better way to accomplish this (keeping a list of users that have the macro file)?
You could use stream redirection operator >> and system variable with login as i recall %username%. Do echo %username%>>hiddenfile. txt

Write to New File Created By Notepad In Lua

I'm aiming to open a new .txt file in Notepad and then write to it. Since the file I'm opening (notepad.exe) isn't the same file I want to write to (the new .txt file), I'm unaware of how I can write to the file. Here's the code I have so far:
local list = io.popen("notepad.exe","w")
print(list)
list:write("Tester")
list:flush()
Notepad is opened, but the text isn't written to the new file because the code is trying to edit notepad.exe instead.
What can I do to be able to edit the new opened .txt file? I don't want to actually save the file anywhere, so that's why I'm aiming to just put text in an untitled .txt file. Thanks in advance :)
Notepad does not respond console input.
You must find edit control on notepad's window and PostMessage keypressing event to it.
Or prepare temporary file and load it:
local list = io.open("newfile.txt","w")
list:write("Tester")
list:close()
os.execute("notepad.exe newfile.txt")

How to close a PDF file using Ruby?

I have been working on Vanilla, a LaTex preprocessor. I and most people open their PDF files to see how their output looks like. But sometimes, we forget to close it down before starting the compiling process again. If the PDF file is open, then the LaTex compiler complains that it cannot write to that file. So I want to add code to the preprocessor which will look if the output PDF file is open and it will close the PDF file if it is open. I have been looking everywhere to see how to go about doing it. I am not an expert in Ruby. I don't want to kill the whole process of Acrobat32.exe or any other PDF viewing program used to view that file because the user might have other PDFs open in the same program. I just need a way to kill the process of that one PDF file. So can anyone suggest me a way to do it?
Can't you just move the old file first, remove it if possible, and then generate a new version of the same PDF with the name you want?

Resources