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.
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.
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? (http://ntworthy.com/composer/faq/19.htm).
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
Instead of modifying the standard require line:
Is it better, worse, or the same architecturally to just add this line before it:
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?
Thanks all. I can now run my own scripts. Can't seem to get it to do what I want though.....
https://forum.noteworthycomposer.com/?topic=7044.msg48459#msg48459
But how do I view registry entries in Windows (XP)? And how does a script retrieve a value from the registry?
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> (https://forum.noteworthycomposer.com/?topic=6964.0).
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:
works when run as a User Tool.
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.
<?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);
?>