Sign in to follow this  
Followers 0
Snicker

Help! Unable to parse line

4 posts in this topic

why does it not work? i'm newbie!! thx for help

rem Mapping der Laufwerke, die allen zur Verfuegung stehen 
net use m: \\172.16.68.12\daten /persistent:no
net use n: \\172.16.68.12\freigabe2 /persistent:no
 
rem [ Auswahl, des Sprungziels nach Gruppenzugehoerigkeit ]
 
rem **  Auswahl der Gruppe ueber ifmember.exe, wenn Uebereinstimmung, **
rem **  dann Sprungziel Auswahl **
 
\\172.16.68.12\netlogon\ifmember Werbeteam
if errorlevel 1 goto GR_l
\\172.16.68.12\netlogon\ifmember Administration
if errorlevel 1 goto GR_2
\\172.16.68.12\netlogon\ifmember Buchhaltung
if errorlevel 1 goto GR_3
\\172.16.68.12\netlogon\ifmember Geschäftsleitung
if errorlevel 1 goto GR_4
 
rem ** weitere Abfragen möglich **
rem **  Abgeschlossen wird das Ganze durch ein GOTO END, damit bei keiner Übereinstimmung **
rem **  der Gruppenzugehörigkeit, keine weitere Aktiion durchgeführt wird.

 
rem [ Sprungziel Verwaltung ]
 
:GR_WERBETEAM
rem **  Drucker im Buero/Werbeteam, es wird noch kein Standarddrucker zugewiesen **
rem **  innerhalb dieser Gruppe kann widerum nach Benutzernamen oder Computernamen **
rem **  unterschieden werden **
 
rem **  diese Drucker stehen allen Mitgleidern zur Verfügung **
rem **  con2prt Optionen: /c = connect; /cd= connect default; /f = lösche vorhandene

 
rem **  durch den Parameter /i wird nicht in Klein-/Großschreibung unterschieden **
if /i %username%==Dieter.Meier goto Dieter
if /i %username%==Heiner.Geier goto Heiner
if /i %username%==Hans.Werner goto Hans
if /i %username%==Andreas.Fischer goto Andreas
if /i %username%==Patrick.Krause goto Patrick
if /i %username%==Roland.Stucki goto Roland
if /i %username%==Romano.Jenzer goto Romano
if /i %username%==Samuel.Gruter goto Samuel
if /i %username%==Erich.Vogel goto Erich
 
:DIETER
%logonserver%\netlogon\con2prt /cd "\\172.16.68.12\HPLaserJet3"
%logonserver%\netlogon\con2prt /c "Plotter"
goto END
 
: HEINER
%logonserver%\netlogon\con2prt /cd "\\172.16.68.12\HPLaserJet3"
%logonserver%\netlogon\con2prt /c "Plotter"
goto END

:HANS
%logonserver%\netlogon\con2prt /cd "\\172.16.68.12\HPLaserJet3"
%logonserver%\netlogon\con2prt /c "Plotter"
goto END

:ANDREAS
%logonserver%\netlogon\con2prt /cd "\\172.16.68.12\HPLaserJet3"
%logonserver%\netlogon\con2prt /c "Plotter"
goto END

:PATRICK
%logonserver%\netlogon\con2prt /cd "\\172.16.68.12\HPLaserJet3"
%logonserver%\netlogon\con2prt /c "Plotter"
goto END

:ROLAND
%logonserver%\netlogon\con2prt /cd "\\172.16.68.12\HPLaserJet3"
%logonserver%\netlogon\con2prt /c "Plotter"
goto END

:ROMANO
%logonserver%\netlogon\con2prt /cd "\\172.16.68.12\HPLaserJet3"
%logonserver%\netlogon\con2prt /c "Plotter"
goto END
 
:SAMUEL
%logonserver%\netlogon\con2prt /cd "\\172.16.68.12\HPLaserJet3"
%logonserver%\netlogon\con2prt /c "Plotter"
goto END
 
:ERICH
%logonserver%\netlogon\con2prt /cd "\\172.16.68.12\HPLaserJet3"
%logonserver%\netlogon\con2prt /c "Plotter"
goto END

:GR_ADMINISTRATION

rem [ Sprungziel Administration ]

%logonserver%\netlogon\con2prt /c "\\172.16.68.12\HPLaserjet3"
%logonserver%\netlogon\con2prt /c "\\172.16.68.12\Plotter"

if %username%==Heinz.Schmid goto Heinz
if %username%==Rainer.Salzgeber goto Rainer

:HEINZ
%logonserver%\netlogon\con2prt /cd "\\172.16.68.12\HPLaserjet6P"
goto End

:RAINER
%logonserver%\netlogon\con2prt /cd "\\172.16.68.12\HPLaserjet6P"
goto END

:GR_BUCHHALTUNG

%logonserver%\netlogon\con2prt /c "\\172.16.68.12\HPLaserjet3"
%logonserver%\netlogon\con2prt /c "\\172.16.68.12\Plotter"

if %username%==Franz.Stausee goto Franz
%logonserver%\netlogon\con2prt /cd "\\172.16.68.12\HPLaserjet4Plus"
goto END

:GR_GESCHÄFTSLEITUNG

%logonserver%\netlogon\con2prt /c "\\172.16.68.12\HPLaserjet3"
%logonserver%\netlogon\con2prt /c "\\172.16.68.12\Plotter"

if %username%==Peter.Kaufmann goto Peter
%logonserver%\netlogon\con2prt /cd "\\172.16.68.12\HPLaserjet4Plus"
goto END



:END

why does it not work? i'm newbie!! thx for help

Share this post


Link to post
Share on other sites



Welcome to the AutoIt forum,

The AutoIt interpreter will not like that code. The code that you show is used in the divine Microsoft language interpreted by ComSpec. It belongs in a bat/cmd filetype rather then an au3 filetype. The language is normally regarded as the DOS programming language. Perhaps you chose the wrong forum for help with this script?

This forum here maybe more suitable unless you are interested to try to convert it to AutoIt syntax.

:whistle:

Share this post


Link to post
Share on other sites

Welcome to the AutoIt forum,

The AutoIt interpreter will not like that code. The code that you show is used in the divine Microsoft language interpreted by ComSpec. It belongs in a bat/cmd filetype rather then an au3 filetype. The language is normally regarded as the DOS programming language. Perhaps you chose the wrong forum for help with this script?

This forum here maybe more suitable unless you are interested to try to convert it to AutoIt syntax.

:whistle:

how would this code be in AutoIt Syntax ?;)

Share this post


Link to post
Share on other sites

It would be easier if your script made sense. Missing labels etc seems to be missing from it so I have taken a guess with fixing it. If it becomes a workable script then converting it maybe possible using RunWait, a Switch statement and a few functions.

Removed comments as I cannot understand them. Report back if this works for you.

Net Use m: \\172.16.68.12\daten /persistent:no
Net Use n: \\172.16.68.12\freigabe2 /persistent:no

\\172.16.68.12\netlogon\ifmember Werbeteam
if errorlevel 1 Goto GR_WERBETEAM
\\172.16.68.12\netlogon\ifmember Administration
if errorlevel 1 Goto :GR_ADMINISTRATION
\\172.16.68.12\netlogon\ifmember Buchhaltung
if errorlevel 1 Goto GR_BUCHHALTUNG
\\172.16.68.12\netlogon\ifmember Geschäftsleitung
if errorlevel 1 Goto GR_GESCHÄFTSLEITUNG

:GR_WERBETEAM
If /i %username%==Dieter.Meier (
        Goto HPLaserJet3
) Else If /i %username%==Heiner.Geier (
        Goto HPLaserJet3
) Else If /i %username%==Hans.Werner (
        Goto HPLaserJet3
) Else If /i %username%==Andreas.Fischer (
        Goto HPLaserJet3
) Else If /i %username%==Patrick.Krause (
        Goto HPLaserJet3
) Else If /i %username%==Roland.Stucki (
        Goto HPLaserJet3
) Else If /i %username%==Romano.Jenzer (
        Goto HPLaserJet3
) Else If /i %username%==Samuel.Gruter (
        Goto HPLaserJet3
) Else If /i %username%==Erich.Vogel (
        Goto HPLaserJet3
) Else If %username%==Peter.Kaufmann (
        Goto HPLaserjet4Plus
) Else If %username%==Franz.Stausee (
        Goto HPLaserjet4Plus
) Else If %username%==Heinz.Schmid (
        Goto HPLaserjet6P
) Else If %username%==Rainer.Salzgeber (
        Goto HPLaserjet6P
)

:GR_ADMINISTRATION
%logonserver%\netlogon\con2prt /c "\\172.16.68.12\HPLaserjet3"
%logonserver%\netlogon\con2prt /c "\\172.16.68.12\Plotter"
Goto END

:GR_BUCHHALTUNG
%logonserver%\netlogon\con2prt /c "\\172.16.68.12\HPLaserjet3"
%logonserver%\netlogon\con2prt /c "\\172.16.68.12\Plotter"
Goto END

:GR_GESCHÄFTSLEITUNG
%logonserver%\netlogon\con2prt /c "\\172.16.68.12\HPLaserjet3"
%logonserver%\netlogon\con2prt /c "\\172.16.68.12\Plotter"
Goto END

:HPLaserjet4Plus
%logonserver%\netlogon\con2prt /cd "\\172.16.68.12\HPLaserjet4Plus"
Goto END

:HPLaserJet3
%logonserver%\netlogon\con2prt /cd "\\172.16.68.12\HPLaserJet3"
%logonserver%\netlogon\con2prt /c "Plotter"
Goto END

:HPLaserjet6P
%logonserver%\netlogon\con2prt /cd "\\172.16.68.12\HPLaserjet6P"
Goto END

:END

An AutoIt equivalent could be (with a lot of uncertainty of success)

RunWait('net use m: \\172.16.68.12\daten /persistent:no')
RunWait('net use n: \\172.16.68.12\freigabe2 /persistent:no')

If _CMD('\\172.16.68.12\netlogon\ifmember Werbeteam') Then
    _Werbeteam()
ElseIf _CMD('\\172.16.68.12\netlogon\ifmember Administration') Then
    _HPLaserJet3()
ElseIf _CMD('\\172.16.68.12\netlogon\ifmember Buchhaltung') Then
    _HPLaserJet3()
ElseIf _CMD('\\172.16.68.12\netlogon\ifmember Geschäftsleitung') Then
    _HPLaserJet3()
EndIf

Exit

Func _Werbeteam()
    Switch @UserName
        Case 'Dieter.Meier'
            _HPLaserJet3()
        Case 'Heiner.Geier'
            _HPLaserJet3()
        Case 'Hans.Werner'
            _HPLaserJet3()
        Case 'Andreas.Fischer'
            _HPLaserJet3()
        Case 'Patrick.Krause'
            _HPLaserJet3()
        Case 'Roland.Stucki'
            _HPLaserJet3()
        Case 'Romano.Jenzer'
            _HPLaserJet3()
        Case 'Samuel.Gruter'
            _HPLaserJet3()
        Case 'Erich.Vogel'
            _HPLaserJet3()
        Case 'Heinz.Schmid'
            _HPLaserjet6P()
        Case 'Rainer.Salzgeber'
            _HPLaserjet6P()
        Case 'Franz.Stausee'
            _HPLaserjet4Plus()
        Case 'Peter.Kaufmann'
            _HPLaserjet4Plus()
    EndSwitch
EndFunc

Func _HPLaserJet3()
    _CMD(@LogonServer & '\netlogon\con2prt /cd "\\172.16.68.12\HPLaserJet3"')
    _CMD(@LogonServer & '\netlogon\con2prt /c "Plotter"')
EndFunc

Func _HPLaserjet6P()
    _CMD(@LogonServer & '\netlogon\con2prt /cd "\\172.16.68.12\HPLaserjet6P"')
EndFunc

Func _HPLaserjet4Plus()
    _CMD(@LogonServer & '\netlogon\con2prt /cd "\\172.16.68.12\HPLaserjet4Plus"')
EndFunc

Func _CMD($command, $workingdir = '')
    Return RunWait('"' & @ComSpec & '" /c ' & $command, $workingdir, @SW_HIDE)
EndFunc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0