[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference iosg::all-in-1_v30

Title:*OLD* ALL-IN-1 (tm) Support Conference
Notice:Closed - See Note 4331.l to move to IOSG::ALL-IN-1
Moderator:IOSG::PYE
Created:Thu Jan 30 1992
Last Modified:Tue Jan 23 1996
Last Successful Update:Fri Jun 06 1997
Number of topics:4343
Total number of notes:18308

3330.0. "SCRIPT script in FOR loop ..." by TAV02::CHAIM (Semper ubi Sub ubi .....) Mon Sep 27 1993 16:22

A customer has written a DO script which will loop on the PROFILE and do a
NEWDIR into user accounts and then execute a SCRIPT script. 

EX. DO script ND.SCP

FOR PRIFIL with ... DO
  get #user_name = .user \\ -
  .text #user_name \\ -
  DO oa$lib:nd1.scp

EX. DO script ND1.SCP

.text #user_name
get oa$function="newdir " #user_name
SCRIPT oa$lib:ND3.scp

EX. SCRIPT script ND3.scp

FC {RETURN}
I {RETURN}

What happens is that the SCRIPT script seems to be executed ONLY for the last
user. The A1TRACE shows that the NEWDIR is "executed" and then the SCRIPT
script is opened, but it doesn't seem to get executed.

Thanks,

Cb.

T.RTitleUserPersonal
Name
DateLines
3330.1IOSG::MAURICEDifferently hirsuteMon Sep 27 1993 16:5211
    Hi,
    
    Mixing DO scripts and SCRIPT scripts is complex. The rules for when a
    SCRIPT script actually fires are complex. So the best thing is not to
    try it. In your examples I would be inclined to make the DO scripts
    into SCRIPT scripts by prefixing the lines with .FUNCTION directives.
    Or alternatively make the SCRIPT script into a DO script.
    
    Cheers
    
    Stuart
3330.2All SCRIPT scripts - still doesn't work ..TAV02::CHAIMSemper ubi Sub ubi .....Tue Sep 28 1993 09:428
Re. .1

I tried making all the scripts into SCRIPT scripts, but the actual script
command is still executed only after the for loop has finished.

Thanks,

Cb.
3330.3Try without FORIOSG::MAURICEDifferently hirsuteTue Sep 28 1993 14:1732
    I had a go, and like you found the FOR loop seemed to prevent the
    SCRIPT script firing. I had some success with:
    
    ND.SCP
    
    .fu FOR FIRST PROFIL with .user = "M" DO get #user_name = .%key
    .label again
    .text #user_name
    .fu SCRIPT oa$lib:nd1.scp
    .fu get #x = profil.%next[#user_name]
    .if #X = "N" then .goto end
    .fu get #user_name = #x
    .goto again
    .label end
    
    ND1.SCP
    
    .fu .text "HI " #user_name
    .fu get oa$function="newdir " #user_name
    .fu SCRIPT OA$LIB:ND3.scp
    
    ND3.SCP
    
    FC {RETURN}
    .exit
    
    This looped through the profile for users whose names began with "M". I
    hope that will be enough to get you started. 
    
    Cheers
    
    Stuart