How can we call a .vsq file in canalyzer? - capl

I'm working on CANalyzer and I want to call a file (.vsq) in it using CAPL. How can we do this?

I can confirm that it is not possible to start/stop a visual sequence directly via CAPL. Only way to automate (control start/stop) a Visual Sequencer is via COM interface.
WORKAROUND TO START
To start a sequence via CAPL, add a "Wait For" command at the start of the sequence, assign a system variable to it and enable "Start sequence on measurement start". In CAPL, change the system variable as per the condition which you had set to start the visual sequence.
CHECK IF STOPPED
There is no way to stop a visual sequence via CAPL. But you can check if the sequence is running or not by adding a "Set" command at the end of the sequence and keep monitoring if that system variable has changed or not.

Related

Action cannot be completed because another process is using the file

Not sure whether I have the message above exactly correct but I run into this often. I try to use Windows to delete a directory or a file and it tells me I can't because the file is in use by another program. It doesn't say what process is using it.
Sometimes it is clear what is using it, but other times it is not. I open the Task manager and go through all the processes but nothing stands out.
Is there a way to determine what has a file open, and a solution (other than rebooting)?
I suppose most of the time it may be Eclipse related but certainly not all of the time.
I use Process Explorer
Ever wondered which program has a particular file or directory open?
Now you can find out. Process Explorer shows you information about
which handles and DLLs processes have opened or loaded.
You can add the column like shown below (Window Title) and it should help you find the file you are looking for, and what is using it:
If you end up choosing to use this program instead of Task Manager, there is an option for that which will open this instead of Task Manager:
If you decide to "Replace Task Manager" and ever get stuck where you cannot 'undo' what you've done (Meaning, "The original Task Manager will no longer open")... You can modify the registry listed here and delete the Debugger entry. (In this example, I have this path to a network drive).
I had this problem in Excel, where some files would be active, but not visible to me, either on my screen or in the task manager. The way I solved it was to use the command prompt to kill the task:
Open command prompt (type cmd in windows search at the bottom left of your screen)
Type "tasklist"
Find the task you want to terminate (for me it was EXCEL.EXE)
End the task by either using the image name (type "taskkill /im EXCEL.EXE", or whatever program you want to end. This will kill all tasks with that image name) or using the ID (i.e. "taskill /pid 1234, or whatever ID the program has. This will kill that specific task)

VBS: Display message on logon screen

It is possible to set up Windows so that it displays verbose messages during startup or shutdown.
I'm writing a VBScript procedure which will be ran at startup and I would like to display a meaning message instead of the default "Running startup scripts".
How to achieve this in VBS?
You need to use Windows administrative tools which allow you to configure start up for specific users or users group to execute anything on start-up, shutdown even change their backgrounds. Network policy maybe useful for that as well if you are on domain controlled environment.
Also you can use MSCONFIG on a single system to add or define what ever you want to run at startup, for as long as it is valid windows program.
Once you configured what script to run use Windows console (run that under wscript.exe) to execute your VBS file with what ever you want to put there (with wscript you will get dialog with your text in it).
Usually it should look like
Wscript.Echo "Meaningful message goes here"
If you run that under cscript.exe you'll get output in your console window.

How to comfortably monitor variables in a VBscript during development process? (e.g. in a continuously opened command window)

I need to write a huge VBscript to automatically run an application and I'm looking for a way to comfortably monitor what I'm actually doing, in other words, to display the values of some/all variables involved in my script.
I'm used to work with Matlab, where I have a comfortable workspace browser. When I run a Matlab script, all variables, their types and their values are accessible in that workspace and can be checked.
The VBscript I write with Notepad++ (it needs to be a free editor) and the only way I found to display variables was echoing them via wscript and cscript.
I set up the shortcuts.xml with the following line to run my script directly from Notepad++:
<Command name="Run with CScript" Ctrl="yes" Alt="no" Shift="yes" Key="116">cmd /K %windir%\system32\cscript.exe "$(FULL_CURRENT_PATH)"</Command>
In case I include commands in my script like
Wscript.Echo myVar
Wscript.Echo "Hello World!"
and run it with the newly introduced shortcut, a cmd window pops up and displays the value of myVar and "Hello World!".
But the next time I run the script a new window pops up. So my question is:
Is it possible get a continuously opened output window, displaying all echoed values everytime I run a script? I actually want to put the window on a second screen and keep the values from previous runs. So I can enter a line Wscript.Echo something, run, check, enter something else and so on, without fiddling around with a bunch of opened windows.
Alternatively, is there any open-source/free editor which offers an accessible workspace like the one in Matlab?
The open-source editor SciTE offers what I was looking for.
The default settings in vb.properties enable a similar behavior like in Notepad++
command.build.$(file.patterns.wscript)=cscript "$(FilePath)"
command.build.subsystem.$(file.patterns.wscript)=1
One can change it as follows to get the output into the integrated console.
command.go.$(file.patterns.wscript)=cscript.exe //nologo "$(FilePath)"
command.go.subsystem.$(file.patterns.wscript)=0
F5 runs the script and Shift+F5 cleans the output.
Another option is the NppExec Plugin for Notepad++ suggested by #Ansgar Wiechers, which adds a console. The script can be run with cscript.exe /nologo "$(FULL_CURRENT_PATH)" then.
Use a debugger. Start your script with the (meta)option //X. If you are lucky, you already have installed software (MS Office, Visual Studio (Express)) that provides a debugger for VBScript. If not do a bit of research to find an Express version suitable to your OS.
You can almost write native VBScript in the VBA editor, so if you have Excel or whatever you can use this to debug, then go through some steps to convert back to VBScript. That's what I usually do.

Windows batch command question, start excel temp.xls

I wanted to know that if I do
start excel temp.xls
The os will start a new excel instance and open the workbook temp.xls in that instance, AS AN ATOMIC action.
Right now what I have is
start excel
start temp.xls
And most often these two command will mess up my other excel instance, ie, opening temp.xls in another excel instance that has another workbook already opened.
Thanks,
While I think that "start excel temp.xls" will open temp.xls in the Excel instance started by start, you'd be on the safe side, if you use
"<PathToExcel>excel" [/<opt>] "<PathToXls>temp.xls"
For opt see cli for excel (pick the docs for your version).
The Command-line switches for Excel 2007 document explains the switches:
You can change certain aspects of how
the program starts by adding
subcommands called switches to the
Excel.exe command. A switch appears as
a space after the main command,
followed by a slash mark (/) and the
name of the switch. The switch is
sometimes followed by another space
and then one or more specific
instructions called parameters, which
give the program further information
about how to execute the Excel.exe
command.
In your case you do not use a switch but a parameter. It is used to give the program further information about how to execute the Excel.exe command.
Parameter: file name
Description: starts Excel and opens the specified file.
So I would assume that the parameter is bound to the excel instance started.

VBS Stop option forced to kill on 1 sec :(

I was writing a vbs script to monitor a process and restart it if it died.
however as i was new to vbs i made a mistake in identifying the running process and had a infinate loop of starting a new version and hence crashed my pc....
i have fixed the code to work properly now but in the script properties>script tab the "stop script after specified number of seconds" has been set to 1 and if i disable this option and kick apply.. its still set :( this has only started being like this after i opened a billion cmd consoles and crashed my pc.... is this some sort of security feature.. how do i disable it.
Had exactly the same problem on W7 Ultimate.
The following article was helpful:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/wsh_setindivprops.mspx?mfr=true
"To set global properties for all scripts that are run with the Windows-based script host
1. Click Start, and then click Run.
In the Open box, enter wscript, and then click OK. The Windows Script Host Settings dialog box appears.
Select the Stop script after specified number of seconds check box.
In the seconds box, enter the time limit you want to place on all scripts.
"
Just delete the [scriptname].wsh file in the same directory as the script. Possibly that's been made read-only or similar?
That's the file that contains the settings. You can find more details in this MSDN article: Setting and Customizing Script Properties (.wsh)
Edit: Some new suggestions that might help:
Try going to this key in the registry: HKLM\Software\Microsoft\Windows Script Host\Settings and checking if there is a setting in there that might be the reason. Might be worth going to the same path but under Current User as well (so HKCU\Software\Microsoft\Windows Script Host\Settings).
Otherwise there is an option in the Group Policy Editor called Maximum wait time for Group Policy scripts. I don't think this would affect you but might be worth making sure.
Finally, if neither of the above suggestions help maybe either of the following might at least alleviate the problem:
There is a property called WScript.Timeout which you can set at the beginning of your scripts (like WScript.Timeout = 60) that might help.
There is also a command line parameter \T to wscript that can be used to setting the timeout as described here.

Resources