Jump to content

isUserName((”Robert” ) as an if test


Recommended Posts

I need some help in using the isUserName((”Robert” ) test. Some of the lines of code may be wrapped.)I’m using WPI to upgrade Filzellia FTP program on my wife’s and my machines.

I have the following 3 lines of code in WPI that work:

{JSCRIPT}=if(isUserName("Robert")) {JSCRIPT}=alert("conditional Test message-the user is Robert")

{JSCRIPT}=if(!isUserName("Rita")) {JSCRIPT}=alert("conditional Test message-user is not Rita")
When the %USERNAME% =“Robert”

{FILECOPY} "%wpipath%Install\internet\Filezilla_stuff\sitemanager.xml" "%USERPROFILE%\AppData\Roaming\FileZilla\sitemanager.xml"

These 2 lines fail:
There are 2 files in the Filezilla_stuff folder; sitemanager.xml and RITAsitemanager.xml.  The files contain different FTP sites:

{JSCRIPT}=if(isUserName("Robert")) {FILECOPY} "%wpipath%Install\internet\Filezilla_ stuff\sitemanager.xml" "%USERPROFILE%\AppData\Roaming\FileZilla\sitemanager.xml"

{JSCRIPT}=if(isUserName("Rita")) {FILECOPY} "%wpipath%Install\internet\Filezilla_stuff\RITAsitemanager.xml" " %USERPROFILE%\AppData\Roaming\FileZilla\sitemanager.xml"

However when I attempt to select which “sitemanager.xlm” file to copy (depending upon the %USERNAME%, both lines fail with returned code 999.

 

   Monday, February 16, 2015 2:58:49 PM - cmd2 Success (returned code undefined): if(isUserName("Robert")) alert("conditional Test message-the user is Robert")

   Monday, February 16, 2015 2:58:51 PM - cmd3 Success (returned code undefined): if(!isUserName("Rita")) alert("conditional Test message-user is not Rita")

   Monday, February 16, 2015 2:58:54 PM - cmd5 Success (returned code 0): CMD /C COPY /Y "O:\Install\internet\Filezilla_stuff\sitemanager.xml" "C:\Users\Robert\AppData\Roaming\FileZilla\sitemanager.xml"

   Monday, February 16, 2015 2:58:54 PM - cmd6 *** Fail *** (returned code 999): !isUserName("Rita") {FILECOPY} "O:\Install\internet\Filezilla_stuff\RITAsitemanager.xml" " C:\Users\Robert\AppData\Roaming\FileZilla\RITAsitemanager.xml"

I’m hoping that someone can supply me with the correct contax.

Thanks, Bob

Link to comment
Share on other sites

  • 2 weeks later...

I was able to solve the problem myself.  Here is the code that works.

 

{JSCRIPT}=if (isUserName("Rita")) RunCmd('cmd /c copy /y "%wpipath%Install\internet\Filezilla_stuff\RITAsitemanager.xml" "%USERPROFILE%\AppData\Roaming\FileZilla\sitemanager.xml"',false,true)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...