Pass parameters (arguments) to a VisualNeo Win application - Forum

Forum Navigation
You need to log in to create posts and topics.

Pass parameters (arguments) to a VisualNeo Win application

Hello,

 

I would like to be able to execute a VisualNeo Win and pass parameters (arguments) in the shortcut or the run command, and then have the Application "listen" somehow so it can behave in different ways depending on the parameters passed along.

For example, if I want the app to start in fullscreen mode:

C:/MyApp.exe -fullscreen -adress lan1.server.net

The idea is to be able to add some string of text on the launching, but my problem is that I don't know how the App can retrieve it. Any Idea? I'm missing something obvious?

Could not get any info on the help file.

PD: I think this can be done executing a PowerShell with arguments to write a file and then have the file readed by the App, but I rather keep it clean, is it possible? The app won't be launched by another WisualNeo Win app.

Thanks for your time and help.

Hi @pau-de-anguera

Use [CommandLine] variable.

Predefined Global Variables

There are a number of important variables that are created and updated automatically by VisualNEO Win. These variables contain information about the status of your publication, the reader’s computer, the current date and time, etc. These may be inserted wherever normal variables are accepted.

Read-Only Variables

The first group of global variables are Read-Only, meaning that they can be examined and displayed, but not modified, using the SetVar or other Action commands.

App Properties

[CommandLine]

Command line parameters passed to the publication. Multiple parameters are separated with carriage returns [#13]. The first parameter is always the name of the publication exe.

 

luishp and Krakerman have reacted to this post.
luishpKrakerman

Hello,

https://winhelp.visualneo.com/RunOptions.html

An for a running app: CommandLine_OnChange

https://winhelp.visualneo.com/Access.html

Regards

luishp and Krakerman have reacted to this post.
luishpKrakerman

Thank you very much. Appreciated.

So how would you put each command line that was parsed into different variables.

@krakerman

So how would you put each command line that was parsed into different variables.

From the Help File page at https://winhelp.visualneo.com/RunOptions.html ...

StrParse "[CommandLine]" "[#13]" "[Param]" "[Count]"

Loop "1" "[Count]" "[X]"
   AlertBox "Result" "Parameter [X] is [Param[X]]"
EndLoop

 

Yes I know that but say you want each of those parameters into different variables.

SetVar "[CMD1]" "[Param[1]]"

does not work. So if I want CMD1 to be the first parameter and CMD2 to be the second how do you go about that is what I am asking.

@krakerman

SetVar "[CMD1]" "[Param[1]]" does not work.

Try ...

StrParse "[CommandLine]" "[#13]" "[Param]" "[Count]"
SetVar "[CMD1]" "[Param1]"
SetVar "[CMD2]" "[Param2]"

 

Krakerman has reacted to this post.
Krakerman

@krakerman
@gaev

Or...  StrParse "[CommandLine]" "[#13]" "[CMD]" "[Count]"?

All of your parsed variables will start with CMD however [CMD1] will be the path and filename of your executable.

SetVar "[CMD1]" "[Param[1]]" does not work because you've created a compound variable. It's actually two variables in one.
You could try:

StrParse "[CommandLine]" "[#13]" "[Param]" "[Count]"
Loop "2" "[Count]" "[loopCount]"
SetVar "[NewCount]" "[loopCount]-1"
SetVar "[CMD[NewCount]]" "[Param[loopCount]]"
EndLoop

Now your CMD variables will start with 1 and exclude the executable path and filename.

Krakerman has reacted to this post.
Krakerman

Thanks :)