Running stored macros from an autocall library - macros

I am running into errors when trying to execute a stored macro from an AUTOCALL library.
I have stored a macro within a folder using the following:
libname myMacr 'C:\My Macros';
options mstored sasmstore = myMacr;
%macro HelloWorld() / store;
%put Hello, world!;
%mend;
When I look in the folder after running this, I see a catalog sasmacr.sas7bcat has been created, as expected.
Next, I've added C:\My Macros to my AUTOCALL library list. By running
proc options option=config;
run;
to locate my config file. Following the directions given in Creating an autocall macro library on a PC, I added C:\My Macros to the AUTOCALL list. Closing and reopening SAS, I can confirm my folder has been added to the AUTOCALL list using:
%put %sysfunc(pathname(sasautos));
Indeed, C:\My Macros appears in the list. Furthermore, I can confirm that SAS sees the compiled macro. When I issue:
proc catalog;
contents catalog=sasautos.sasmacr;
quit;
I get the output
Contents of Catalog SASAUTOS.SASMACR
# Name Type Level Create Date Modified Date Description
1 HELLOWORLD MACRO 14 03/21/2017 18:44:28 03/21/2017 18:44:28
However, when I issue %HelloWorld();, I get an error:
1 %HelloWorld();
-
180
WARNING: Apparent invocation of macro HELLOWORLD not resolved.
ERROR 180-322: Statement is not valid or it is used out of proper order.
What am I doing wrong? Is there some option I'm overlooking which must be turned on? What do I need to do in order to run stored macros from my C:\My Macros folder?

Put the line
-initstmt "options mstored sasmstore=sasautos;"
in the config file. This will issue the command within quotes when SAS initializes.
MSTORED
SASMSTORE=

Related

Matlab does not recognizes function

I'm using preaty old Matlab (version 7.1.0.246 (R14) Service Pack 3) :(
I have some toolbox I was provided which I'd like to use. When I try to execute the function, I'm getting Undefined command/function 'test' (my function is test and stored in test.m and the file located in my current working directory).
If I place the file in C:\Temp\ and execute which test, I'm getting the complete file path (C:\Temp\test.m).
If I place the file in C:\Temp\MyMap\ and execute which test, I'm getting the complete file path('C:\Temp\MyMap\test.m') and additional comment %Has no license available.
If I use following one
if exist('test')
test(...)
end
It solves the issue. However, as mentioned previously, its a toolbox and contains many functions. I don't have time (and want to) apply the workaround on all the files/functions.
Any suggestion how this could be solved?

Using Regex in install4j Compiler Variable

During installation, install4J looks for a certain file format to load (and later extract). The file format is the following:
server_${compiler:component_name}_${compiler:modality_version}_${compiler:modality_os}_BN${compiler:timestamp}.tar.gz
Everything works except for the last compiler variable which is the timestamp. I would like that variable to be a regex:
([0-9]{4})(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])(2[0-3]|[01][0-9])([0-5][0-9])
However, install4j is unable to figure out that what I'm giving it is a regex and not hard-coded variable.
How can I resolve this?
Currently, I'm getting this during the build:
[INFO] [WARNING] The path "..\..\target\resources\archives\server_merch_4.1_SP1_win-x86-64_BN([0-9]{4})(0[1-9]|1[0-2])(0[1-9]|[1-2][0-9]|3[0-1])(2[0-3]|[01][0-9])([0-5][0-9]).tar.gz" does not exist.
If this is not possible, is there a way I can use the wildcard "*"?
There is no ad-hoc regex pattern matching like that in install4j.
Use a "Set a variable" action where you list files yourself and write the matching file to an installer variable. In the action that reads the file you can then use the expression ${installer:myVariable} where myVariable is the variable name configured in the "Set a variable" action.

Macro to generate xlsx works fine manually but not from the batch through QlikviewManagement Consol

I am trying to export few charts to Excel (.Xlsx format) through Qlikview Macro and to save it on postrelaod at a particular location. The file works perfectly fine when it is run manually or from the batch (.bat) on double click.
But when scheduled to run from the Qlikview Management Console through the external File(.bat file) its generating the Excel Extract but the file is blank. The error is:
Error: Paste method of Worksheet class failed
I have checked the permission/location of the file and its not an issue.
Postreload trigger saving charts via macro will not work via QMC (both postreload and frontend/chart manipulations doesn't work via QMC).
To solve that I do as following.
1) Set reload in QMC to refresh data in your document.
2) After successful reload another document which triggers... macro from first document to save that charts but with that it also gave me trouble as it generated conflict (you can not open Qlikview from Qlikview..... (I know that it is nosense) so in second document I run macro from first one like that (via PsExec):
EXECUTE "C:\Qlikview\PROD APPLICATION\modules\scripts\edx\PsExec64.exe" *\\SERVER_NAME* -u *SERVER_NAME\User* -p *password* -i 1 -d -high cmd /c ""C:\Program Files\QlikView\qv.exe" "C:\Qlikview\PROD APPLICATION\modules\$(vDocument).qvw" /vvRun=yes
I use variable vRun to specify that macro on open runs only when it is set to yes:
and in macro it is set to close app after saving charts:
ActiveDocument.UnlockAll
ActiveDocument.ClearAll true
ActiveDocument.Save
ActiveDocument.GetApplication.quit
end sub

Run script file from other script file in Octave

I have several Octave script files that run tests, named test_1, test_2, etc. I want to have a script file that will run all the tests, without having to switch all the test_n files to function files. I've tried several variations on this:
#!/path/to/octave -q
addpath('/path/to/directory/containing/all/scripts/');
source(test_1.m);
source(test_2.m);
but I always get "error: invalid call to script /path/to/directory/containing/all/scripts/test_1.m".
(I've tried source_file(), run(), and just having the filename alone on the line.)
Is there any way to run script files from a script file in Octave?
Try
source test_1.m
or
source('test_1.m')
instead.
Your syntax implies test_1 is a struct variable and you're trying to access a field called m
Same with the run command (in fact, run simply calls source under the hood).
You can also call the script directly, if it's on the path. You just have to make sure you don't include the .m extension, i.e.
test_1
test_2
Just put the name of the included script, without .m extension on a separate line.
Lets have for example script 1: 'enclosed.m'
and script 2: 'included.m'. Then enclosed.m should look like:
% begin enclosed.m
included; % sources included.m
% end encluded.m

PHP GTK module in php.ini

I installed PHP GTK in C:\php-gtk but when I go to run it like from the command line like this
cd C:\php-gtk2
php demos\phpgtk2-demo.php
It gives this error
Please load the php-gtk2 module in your php.ini
My ini file has this content (it is called php-cli.ini)
[PHP]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; About the php.ini in PHP-GTK ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; This file introduces the php.ini settings that you will need in order to
; run PHP-GTK on your system. You may also need other settings from PHP's
; standard php.ini file, e.g. to load further extensions or otherwise control
; PHP's behaviour in matters such as error reporting. Please add those in
; the upper part of this file, in the PHP section.
; You should use PHP's CLI executable to run PHP-GTK. This php.ini file
; should be in the same directory as the PHP executable, to avoid conflict
; with any other copies of PHP that may be installed on your machine.
; The first thing you will need to do is tell PHP where you want it to look
; for the PHP extension libraries (php_*.dll or php_*.so files) on your system.
extension_dir = "./ext"
; Make sure that php-gtk2.dll under Windows, or php-gtk2.so under Unix, is in
; the directory named in extension_dir alongside any other shared PHP extensions
; you intend to use, and tell PHP to load it.
extension = php_gtk2.dll
;extension = php_pdo.**
;extension = php_sqlite.**
;extension = php_pdo_sqlite.**
[Date]
; Defines the default timezone used by the date functions
;date.timezone =
[PHP-GTK]
;;;;;;;;;;;;;;;;;;;;;;
; PHP-GTK extensions ;
;;;;;;;;;;;;;;;;;;;;;;
; Extensions written for PHP-GTK are in the format php_gtk_*.dll (Windows) or
; php_gtk_*.so (Unix), written here as a comma-separated list. The library
; files need to be in the same directory as the PHP-GTK library, along with
; any other PHP extensions you are using.
;php-gtk.extensions = php_gtk_libglade2.dll,php_gtk_sourceview2.dll
;;;;;;;;;;;;;
; Code Page ;
;;;;;;;;;;;;;
; The string variables used for titles and other text values in GTK+ are
; encoded in UTF-8 internally. A code page is needed so that PHP-GTK 'knows'
; which character set is being used, and can convert it to UTF-8 as necessary.
; If your environment uses UTF-8 already, you can set the codepage directive
; to UTF-8 to skip the conversions.
; The default codepage setting in PHP-GTK 2 is ISO-8859-1, but you can also
; use either OEM (e.g. 850) or Windows Code Pages (e.g. CP1250) here, so
; long as the encoding format you choose is capable of iconv conversion. See
; http://www.microsoft.com/globaldev/reference/cphome.mspx for a list of
; the code pages and character sets that are supported on Windows systems.
php-gtk.codepage = CP1250
What do I need to do? Is there something wrong with the ini file? Do I need to rename it? What is the problem that is tripping up the program?
you can take it a bit further, and not worry about paths, I work in Windows environment and I use relative paths even inside .ini like this:
extension_dir = "ext"
extension = php_cairo.dll
extension = php_mongo.dll
This allows me to move the php-gtk folder anywhere.
As for running my projects I do a similar thing, I create .cmd files like this:
"%CD%\..\..\PhpGtkRuntime\php.exe" "%CD%\index.php"
So you can have for example a central folder and in a subfolder goes php-gtk and in an other one all you projects like this:
php-gtk/PhpGtkRuntime
php-gtk/Projects
The whole idea is that I distribute a folder to the final user with a run.cmd inside it and the user does a simple copy paste of the folder, really nothing else. I have made an example package with MongoDB included and all of it is portable even MongoDB, Check here..
Ok the problem was that I needed to call php-gtk as I had renamed it already
Just solved the problem.
I was trying to run the demo script from the demos folder. But when I tried it with the same folder where the php.exe is it ran smoothly. So there is no problem with the php-cli.ini or no need to worry about this error "Please load the php-gtk2 module in your php-cli.ini"
So Goodluck with PHP-GTK.