Skip to main content
Topic: First time user-tool user. (Read 17533 times) previous topic - next topic

First time user-tool user.

Good evening one and all.
I'm new to the user tools and am having a problem trying to create one of my own. I have downloaded the starter kit, and have played around with the supplied ones. I wish to make an amended version of Notenames, and tried to copy the php file in the scripts/lib directory, but I don't have the required permision on my computer. I am the admin user, but I dont know how to change the required permissions. I tried to copy it to my documents folder, but when I try to execute my amended version I get the following error message...

Warning: require_once(lib/nwc2clips.inc): failed to open stream: No such file or directory in C:\Users\phil\Documents\nwsw_Tubavalves.php on line 26

Fatal error: require_once(): Failed opening required 'lib/nwc2clips.inc' (include_path='.') in C:\Users\phil\Documents\nwsw_Tubavalves.php on line 26


Could one of you more experienced users please explain where I go from here.

My thanks in advance.

Re: First time user-tool user.

Reply #1
I tried to copy it to my documents folder, but when I try to execute my amended version I get the following error message...

Warning: require_once(lib/nwc2clips.inc): failed to open stream: No such file or directory in C:\Users\phil\Documents\nwsw_Tubavalves.php on line 26

Fatal error: require_once(): Failed opening required 'lib/nwc2clips.inc' (include_path='.') in C:\Users\phil\Documents\nwsw_Tubavalves.php on line 26
The script is looking for: lib/nwc2clips.inc
You will need to modify line 26 so it can find the file
    --- or ----
Create a folder: C:\Users\phil\Documents\lib and copy nwc2clips.inc into it.
Registered user since 1996

Re: First time user-tool user.

Reply #2
If you want your script to be similar to the starter kit scripts, you can create your own files within the NWC2 scripts folder. You would need to use "Run as administrator" on your text editor in a similar fashion to what is described in FAQ - How do I create my own templates?.

When working from your user folder, the easiest approach would be to add the full path when including nwc2clips, like require_once("c:/program files/noteworthy software/noteworthy composer 2/scripts/lib/nwc2clips.inc");

I would recommend against using our existing script filename for your custom script.

I would also generally recommend that you create your own starter include file that includes the nwc2clips library. You can then include that intermediate file in all of your scripts, and then only one file would need to be updated in the event that you change the location for the installed NWC2 program files.


Version 2.11 of the Starter Kit now allows you to use a relative include path to the nwc2clips library.

See also:

PHP include_path:
http://www.php.net/manual/en/ini.core.php#ini.include-path

PHP Include/Require:
http://php.net/manual/en/function.include.php

Re: First time user-tool user.

Reply #3
Instead of modifying the standard require line:
Quote
require_once("lib/nwc2clips.inc");

Is it better, worse, or the same architecturally to just add this line before it:
Code: [Select · Download]
set_include_path("C:/Program Files/Noteworthy Software/NoteWorthy Composer 2/Scripts");

Either way, is there an easy way for a script to obtain the path from a registry entry, rather than hard-coding it?

Re: First time user-tool user.

Reply #4
Thanks all. I can now run my own scripts. Can't seem to get it to do what I want though.....


Re: First time user-tool user.

Reply #6
But how do I view registry entries in Windows (XP)?  And how does a script retrieve a value from the registry?

Re: First time user-tool user.

Reply #7
Regedit.exe is normally used to view/modify the registry. Usual caveats about destroying your computer apply.
I don't think that the version of php.exe supplied with NWC's toolkit can read the registry.
It is a fairly simple matter with VBScript. Example <here>.

For a User Tool, the registry is not needed to get NWC's program path. It is always the current working directory when the tool is invoked. So:
Quote from: CurrDir.php
<?php
  // current directory
  fputs(STDERR,getcwd());
?>
works when run as a User Tool.
Registered user since 1996

Re: First time user-tool user.

Reply #8
Version 2.11 of the NWC2 User Tool Starter Kit includes built-in support for relative include of the NWC2 "lib" modules. You should not need to include the full path to the NWC2 clip library now. You should be able to use the same require/include statements used by the built-in starter kit tools.

Version 2.11 also includes support for accessing NWC2 user config data.

  • an updated nwc-conv.exe for command line conversion of *.nwc to and from *.nwctxt
  • a new custom edition of PHP 5.3 that includes support for the COM class interface
  • an updated php.ini environment for easier access to the starter kit's include library from a user development folder outside of the NWC2 program files
  • a new nwc2config lib module for developers to access NWC2 user config data

Re: First time user-tool user.

Reply #9
is there an easy way for a script to obtain the path from a registry entry, rather than hard-coding it?
Code: [Select · Download]
<?php
/*******************************************************************************
rg_Path.php Version 1.00
This script shows the version of the Starter Kit that is installed and
the install path for NWC2.x as retrieved from the Registry.
*******************************************************************************/
require_once("lib/nwc2clips.inc");
require_once("lib/nwc2config.inc");
$libver = NWC2ClipLibVersion();
$appPath = NWC2CONFIG_AppFolder;
$usermsg = <<<__EOMSG
Clip Library Version: $libver
App Path: $appPath
__EOMSG;
fputs(STDOUT,$usermsg);
exit(NWC2RC_REPORT);
?>
Registered user since 1996