#122214 - 2004-07-06 09:32 PM
Need help
|
MacGyver84
Fresh Scripter
Registered: 2004-07-06
Posts: 8
|
Hi I'm a total newbie when it comes to Kix. I've just set up a 2003 server. I got some Kix "things" working. For instance the If InGroup and the addprinter.
Here's my problem. I need somehow a file to be printed out the first time a new user log on to my domain. I would also like this .doc file to open at the first logon.
Please help me.
Thomas
|
|
Top
|
|
|
|
#122215 - 2004-07-06 09:51 PM
Re: Need help
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
If you assign printers as part of the id or in AD, then you should be able to do something like..
Code:
IF NOT EXIST('%USERPROFILE%\newemployee.doc') COPY @ldrive+'\newemployee.doc' '%userprofile%' SHELL '%compsec% /c print %userprofile%\newemployee.doc' ENDIF
HTH,
Kent
|
|
Top
|
|
|
|
#122218 - 2004-07-06 10:00 PM
Re: Need help
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Very well could. Probably warrants some testing.
Kent
|
|
Top
|
|
|
|
#122219 - 2004-07-06 10:08 PM
Re: Need help
|
MacGyver84
Fresh Scripter
Registered: 2004-07-06
Posts: 8
|
Thank you for the help so far. But I'm not at work so I can't test this before tomorrow.:( But where should i put the original newemployee.doc? In the netlogon folder or? Another question, how can i get the script-window to maximized and up when the script is running?
Thomas
|
|
Top
|
|
|
|
#122221 - 2004-07-06 10:58 PM
Re: Need help
|
MacGyver84
Fresh Scripter
Registered: 2004-07-06
Posts: 8
|
Hmm, could you give a link? But if I use exactly the code above, and paste it into my script... Without any modifications, it will work? Of course the name of the .doc must be right, but besides that....? And yes, do i have to put my newemployee.doc in the Netlogon folder?
Thank you for all your help so far
Thomas
|
|
Top
|
|
|
|
#122223 - 2004-07-07 08:34 AM
Re: Need help
|
MacGyver84
Fresh Scripter
Registered: 2004-07-06
Posts: 8
|
OKay here's my script.
;****************************************************************
;*****Last modified 6.07.2004 at 11.30 by Thomas
;******
;***********************************************************;*****
;* Filnavn: login.kix *
;* Lokasjon: \\hoftun\netlogon\kix *
;* Formål: Kjøres under innlogging *
;****************************************************************
; Welcome screen
CLS
Small
Color b+/n
Box (0,0,24,79,GRID) ; bakgrunn
Color b/n
Box (8,21,18,65,Å) ; skygge
Color c+/n
Box (7,20,18,64,FULL)
Color r+/n
AT (9,25) "Velkommen, @fullname"
AT (10,25)"Du er nå pålogget med en stasjonær pc"
Color w+/n
AT (11,25) "Privilegier : "
AT (12,25) "Maskin : "
AT (13,25) "Domene : "
AT (14,25) "Logon Server : "
AT (15,25) "Kommentar : "
Color r+/n
AT (17,22) " Vennligst vent mens logon valideres"
Color y+/n
AT (11,40) @priv
AT (12,40) @wksta
AT (13,40) @domain
AT (14,40) @lserver
AT (15,40) @comment
Color g+/n
Sleep(5)
; - Blanker skjermbildet
CLS
; - Synkroniserer klokken med Tekstil og Design server
SETTIME "\\hoftun"
; - Mapper opp forskjellige kataloger for forskjellige grupper
If InGroup( "Lærere" )
USE F: "\\hoftun\ansatte$"
USE K: "\\hoftun\klasser$"
USE X: "\\hoftun\felles_alle$"
SetWallpaper("wolf.bmp",1)
ENDIF
If InGroup( "GK_TEKSTIL" )
USE K: \\hoftun\klasser$\GK
USE X: \\hoftun\felles_alle$
ENDIF
If InGroup("VK1_TEKSTIL")
USE K: "\\hoftun\klasser$\VK1"
USE X: "\\hoftun\felles_alle$"
ENDIF
If InGroup("VK2_TEKSTIL")
USE K: "\\hoftun\klasser$\VK2"
USE X: "\\hoftun\felles_alle$"
ENDIF
;Prosedyre for å legge til printer
$ReturnCode = AddPrinterConnection ("\\hoftun\HP_Tekstil_Design")
If $ReturnCode = 0
? "Legger til skriver ved Tekstil og Design avdeling....."
Endif
IF NOT EXIST('%USERPROFILE%\newemployee.doc')
COPY @ldrive+ '\newemployee.doc' '%userprofile%'
SHELL '%compsec% /c print %userprofile%\newemployee.txt'
ENDIF
;**************
Everything else is working, except the wallpappers and the document won't print nor start...? I'm desperat!
Please help me!
Thomas
|
|
Top
|
|
|
|
#122224 - 2004-07-07 02:27 PM
Re: Need help
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
A DOC will never be a TXT..
You have - Code:
IF NOT EXIST('%USERPROFILE%\newemployee.doc') COPY @ldrive+ '\newemployee.doc' '%userprofile%' SHELL '%compsec% /c print %userprofile%\newemployee.txt' ENDIF
Shouldn't it not be - Code:
IF NOT EXIST('%USERPROFILE%\newemployee.txt') COPY @ldrive+ '\newemployee.txt' '%userprofile%' SHELL '%compsec% /c print %userprofile%\newemployee.txt' ENDIF
What is this about Wallpaper? Are you doing something with SETWALLPAPER?
Thanks,
Kent
|
|
Top
|
|
|
|
#122225 - 2004-07-07 07:11 PM
Re: Need help
|
MacGyver84
Fresh Scripter
Registered: 2004-07-06
Posts: 8
|
Hmm, never mind the wallpaper, i've removed it and use group policy instead. What i really need up and running is printing on the first logon.
This is working:
IF NOT EXIST ("%USERPROFILE%\info.txt) COPY "\\hoftun\netlogon\info.txt" "%userprofile%" this line is not working:
SHELL "%COMSPEC% /c print %userprofile%\info.txt ENDIF
The file gets into the profile, but it won't be printed....
|
|
Top
|
|
|
|
#122226 - 2004-07-07 07:25 PM
Re: Need help
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Look at the end of your print line.. It needs a closing quote.
Hmm..
Try this..
Code:
cls
Break on
$profile=LEFT(READVALUE("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Desktop"),-7)
IF NOT EXIST($profile+'info.txt')
COPY @ldrive+'info.txt' $profile
SHELL '%COMSPEC% /c print "'+$profile+'"info.txt'
ENDIF
??'process is complete'
GET $
HTH,
Kent
Edited by kdyer (2004-07-07 07:27 PM)
|
|
Top
|
|
|
|
#122228 - 2004-07-07 07:40 PM
Re: Need help
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Les,
You are correct.. This works - Code:
IF NOT EXIST("%userprofile%\info.txt") SLEEP 1 COPY @ldrive+'info.txt' "%userprofile%" SLEEP 1 SHELL '%COMSPEC% /c print "%userprofile%\info.txt"' ENDIF
??'process is complete' GET $
Kent
|
|
Top
|
|
|
|
#122229 - 2004-07-07 08:07 PM
Re: Need help
|
MacGyver84
Fresh Scripter
Registered: 2004-07-06
Posts: 8
|
I'm really sorry for bothering you guys with these "simple" questions, but it's still not printing.... But i think "we" are really close, because the script tell me that it is printing c:\documet..\info.txt. But it just stands still, and won't come out. If i open the task manager i can see the print.exe. But anyway nothing comes out. I don't know if it has anything to say but i'm running a 2003 server and a windows xp client. the code you gave me, is the last code in my script...if that got anything to do with it....
Thomas
|
|
Top
|
|
|
|
#122230 - 2004-07-07 08:12 PM
Re: Need help
|
MacGyver84
Fresh Scripter
Registered: 2004-07-06
Posts: 8
|
And the printer is connected to the server using a usb-port....
|
|
Top
|
|
|
|
#122231 - 2004-07-07 08:18 PM
Re: Need help
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
There is your problem..
If you do the following, you can work-around this, YMMV-
Quote:
Connect the USB Printer..
Have Windows Detect the printer..
Right-Click on the printer, and click the properties..
Go over to Advanced..
Now, go over to ports..
Ensure - Enable printer pooling is checked.
Make sure LPT1,
USB001, and BMFC: are all checked..
Over at that Sharing Tab, you set the above.. Click the Apply Button to create the Printer share
On the General Tab, rename to simply Brother..
Go to a command prompt (CMD) -
Get the Machine Name and issue the following:
net use lpt1: \\<machineid>\brother /persistent:yes
If you start Citrix <Application>, you should see the printer:
In the main screen of <Application> run a report as normal.
Otherwise, you can use - PrintTo() - Print any file to any printer UDF.
Kent
|
|
Top
|
|
|
|
#122232 - 2004-07-07 08:25 PM
Re: Need help
|
MacGyver84
Fresh Scripter
Registered: 2004-07-06
Posts: 8
|
I'm wondering. Since the printer i'm testing on is usb-printer, if i use a networkprinter istead, what do i have to do different then. Will the code above work then?? The reason you see, is that i'm home and testing. But at work we have a diffrent printer and it uses a print server to connect to the network...
Thanks for all you help
Thomas
|
|
Top
|
|
|
|
#122233 - 2004-07-07 09:22 PM
Re: Need help
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Probably the PrintTo() UDF will be your friend. Unless, you set LPT1 to go to the network printer.
Kent
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1046 anonymous users online.
|
|
|