Initiate "Sys" object in vbs - object

i'm trying to do some stuff in vbscript, and i have to take a screenshot of the screen. I don't want to use an external executable (Auto Screenshot using VBS).
I find a vbs which can be nice (how to take screenshot by vbscript?) but when i use this, it use an object (Sys), but i don't know how to create it.
I find some resources here, but i really don't know how to initiate the object "Sys", apparently it's like already "in" the vbscript, but it doesn't works for me.
I tried some stuff (Set Sys = CreateObject("System") or things like that, but nothing works :(
I hope you'll find something ^^

The question you've referenced looks like a low-quality question. The references to "Sys" that you see appear to be in a product called TestComplete. See How to capture a screenshot using VBScript in TestComplete? You'd need to acquire and install TestComplete to use it, or find another program to capture screenshots instead.

Related

Why won't my one simple custom user Python snippet '__init__' appear in IntelliSense?

I've spent the last two hours trying to figure this out, but nothing I've found online helps. Either all search results I've found were severely outdated, not relevant to my problem, or didn't work.
I am a complete beginner to Python, so please try to make your suggestions/solutions/answers understandable enough for me (i.e. draw them in crayon if you must.:)) I want the init method to not autocomplete all of this:
__init__(self, *groups: _Group) -> None:
super().__init__(*groups)
I want it to simply autocomplete as "init()" and that's it, nice and clean for what I'm currently doing.
Searching around, looking at other python snippet extension files, and even using a snippet generator, I've
found that this should be the code that I should use:
"__init__ method":
{
"prefix": "__init__",
"body": ["__init__($0)"],
"description": "New __init__ method"
}
I've created a global.code-snippets file and even a python.json file with Configure User Snippets, both of which are located in C:\Users<myusername>\AppData\Roaming\Code\User\snippets. However, it does not show up when I type out init, instead I still get the default suggestions:
Default init suggestions
What am I missing? I didn't think this would be so difficult.
I've looked at https://code.visualstudio.com/docs/editor/userdefinedsnippets, I've tried https://snippet-generator.app/, I've checked out other Python snippet extensions to see how they were written out.
A bit more digging around and using different keyword searches this morning brought me to IntelliSense in Visual Studio Code, and 3/4 of the way down there was Suggestion selection which said to use the editor.suggestSelection setting. Turns out it was disabled. Once I enabled it, both my python.json and global.code-snippet suggestions showed up.

Using std::process::Command with windows_subsystem="windows" causes console flash/popup

OK, here is my situation:
I'm making a program with a GUI in rust and I don't want to show the console window to the user.
The easy solution for this is the flag (don't know if that's the actual name for those things) #![windows_subsystem = "windows"]. It works great, the console is gone. Buuut.. The std::process::Command struct is unusable because it flashes a cmd window and not actually runs the command.
So if I have a code like this, I wont be able to use it. (But i need it)
#![windows_subsystem = "windows"]
use std::process::Command;
fn main() {
// GUI stuff that at some point uses the Command like below
Command::new("runas").args(&["/user:MY-COMPANY\\Administrator", "/savecred", path]).spawn().expect("Couldnt start Installer");
}
Does anybody have any idea how I can hide the console window but still be able to use the Command?
An easy workaround for this issue is conhost.
You can use Command::new("conhost").arg("YourCommand")
Came here. Couldn't figure it out either. This is so obscure and nowhere else is there any listed solution. That conhost workaround didn't fix it at all sadly.
Anyways, here's the solution after I finally figured it out.
Import CommandExt on windows from the std library, then set command.creation_flags(CREATE_NO_WINDOW) (you can find the CREATE_NO_WINDOW constant in windows-rs or winapi)
I really don't suggest using the constant manually, but here is the value anyways:
const CREATE_NO_WINDOW: u32 = 134217728u32; (or 0x08000000)
I would like to correct something though
It does actually run the command. It just also flashes the window while doing it. But of course, with the solution above, window flashing is now gone
Here's a list of all of the process creation flags

add simulink block programmatically from within function

Is there a way to add a simulink block programmatically from within a function? The principle works by using add_block(...) via script in the basic matlab workspace. But if i try to add a block from within a function, Matlab seems to dont see the simulink model anymore. I get the error Invalid destination block specification.
Any clue what to do? Thanks.
EDIT: This add_block('built-in/Gain','Model/blk') worksin the command window, but it doesnt work inside a function.
Got it finally working, just had to change the current workspace. evalin('Base',...) does the trick.

Can I alter Python source code while executing?

What I mean by this is:
I have a program. The end user is currently using it. I submit a new piece of source code and expect it to run as if it were always there?
I can't find an answer that specifically answers the point.
I'd like to be able to say, "extend" or add new features (rather than fix something that's already there on the fly) to the program without requiring a termination of the program (eg. Restart or exit).
Yes, you can definitely do that in python.
Although, it opens a security hole, so be very careful.
You can easily do this by setting up a "loader" class that can collect the source code you want it to use and then call the exec builtin function, just pass some python source code in and it will be evaluated.
Check the package
http://opensourcehacker.com/2011/11/08/sauna-reload-the-most-awesomely-named-python-package-ever/ . It allows to overcome certain raw edges of plain exec. Also it may be worth to check Dynamically reload a class definition in Python

Getting echofunc.vim to work

I came across echofunc.vim today (from a link in SO). Since I'm rubbish at remembering the order of function parameters, it looked like a very useful tool for me.
But the documentation is a bit lean on installation! And I've not been able to find any supplementary resources on the internet.
I'm trying to get it running on a RHEL box. I've copied the script into ~/.vim/plugin/echofunc.vim however no prompt when I type in a function name followed by '('. I've tried adding
let g:EchoFuncLangsUsed = ["php","java","cpp"]
to my .vimrc - still no prompting.
I'm guessing it needs to read from a dictionary somewhere - although there is a file in /usr/share/vim/vim70/ftplugin/php.vim, this is the RH default and does not include an explicit function list.
I'm not too bothered about getting hints on the functions/methods I've defined - just trying to get hints for the built-in functions. I can see there is a dictionary file available here which appears to provide the resources required for echofunc.vim, I can't see how I set this up.
TIA,
It expects a tags file, the last line of the description describes exactly how to generate it:
ctags -R --fields=+lS .
It works here with PHP but not with JS. Your mileage may vary.
I didn't know about this plugin, thanks for the info.
You should try phpcomplete.vim, it shows a prototype of the current function in a scratchpad. It is PHP only, though.

Resources