I’d like to use a calc spreadsheet to organize and hyperlink a collection of small batch scripts I have. However Calc warns me about every batch script being possible dangerous—which is unhelpful and annoying for my purposes. Is there a way to disable this warning?
Yes, it is unhelpful, but it gives you a higher security level.
.
Tip 1:
Open your file from a trusted source
https://help.libreoffice.org/latest/mk/text/shared/optionen/macrosecurity_ts.html
Tip 2:
Place the macro code into the MyMacros of the application, and put the launcher menu items, toolbar icons into the application too - instead of the actual file.
Tip 3: (never use it!!!)
Set the macro security level to Low.
To clarify, are you suggesting I run my batch scripts via a macro? I’ll look into that. Any links to sample code would be helpful.
No. Tip 1: the trusted macro source locations are also used to determine if a document is trustworthy and thus places it links to or calls to external resources it does are trusted as well.
Adding the folder as a trusted source doesn’t disable the warning. Setting macro security to low doesn’t disable it either. To be clear, this is the warning I’m referring to.
At this point, it seems like I’ll need to utilize macros. However, figuring out how to use the Shell command to open a .bat file (or any file using the default program) has been shockingly difficult. So any help with that would be appreciated.
I never seen such message. I suppose it it is not a message of the LibreOffice, but it is a message of your antivirus software/system.
So, is it a Windows .bat file, but not LibreOfiice macro? Then I am almost sure: the warning is not raised by the LO.
I’m no expert, but I don’t think Windows itself would respond this way, in this context. This is what happens when I click a hyperlink in MS Excel.
It wouldn’t be surprising for LO to have a similar warning
I would like try running the script via a macro. But haven’t had luck so far. Do have any advice regarding that? This doesn’t work and I have no idea why. Calc doesn’t return an error or anything.
Dim Path as string, EXE as string
EXE = "C:\Windows\System32\cmd.exe"
Path = """C:\Users\mpgri\OneDrive\Synced Documents\_New Install\Batch Scripts\StickyNotesAutoOpen.bat"""
Shell(EXE, 1, Path)
Maybe it is possible. I never used OneDrive nor the OneDrive sync directory. I did use the Google sync directory in some previous years (some years ago with the LO 4.4.7), but I not remember such message.
The warning is there only because it’s a .bat file. It doesn’t warn me if I try it with a .txt file.
I wouldn’t dare to be almost sure. Look for the string STR_DANGEROUS_TO_OPEN
in the source code. It takes the value:
It might be dangerous to open \"$(ARG1)\".\nDo you really want to open it?
Can you share the content of your batch file?
The contents don’t seem to affect anything with calc’s behavior. The file I’ve been trying to test with so far literally just prints hello and nothing else.
echo off
echo hello
pause
Sorry, I not understand it. Is tis the content of the problematic batch file? There is not any link to the OneDrive…
Please give us more details about the problem. Where is the link to the OneDrive? In a Calc File? In a Macro?
This is the contents of the .bat file. It’s literally a text file with few lines of text. The link to this file is saved as a hyperlink in a calc sheet.
What type of hyperlinks ? Document? (a batch file is not a document)
Please upload an .ods type sample file here with your hyperlink.
Here’s a calc sheet with a hyperlink. It’s just a normal hyperlink to a local batch file. I can’t upload the batch file because it’s not an authorized file type.
Calc sheet with hyperlink.ods (9.7 KB)
It could had been helpful to state the exact message from the beginning… anyway, that check and message is not related to macros or trusted locations and indeed from LibreOffice, and AFAIS can’t be disabled.