Page 1 of 1

German / Austrian to English help appreciated!

Posted: Thu Jan 31, 2008 11:03 pm
by Rook Zimbabwe
Can someone translate the German / Austrian portions of this?

Code: Select all

; German forum: http://www.purebasic.fr/german/archive/viewtopic.php?t=669&highlight=
; Author: Manne
; Date: 19. April 2003
; OS: Windows
; Demo: No

; Beispiel wie man Clients im LAN remote herunterfahren oder neustarten kann. 
; Optional kann auch eine Nachricht gesendet werden. 
; Logischerweise muß der Initiator auf dem Client Adminrechte haben

#ERROR_SUCCESS = 0 
#MAX_PATH = 260 
#CSIDL_NETWORK = $12 
#BIF_BROWSEFORCOMPUTER = $1000 

Structure BROWSEINFOS 
   hwndOwner.l 
   pidlRoot.l 
   pszDisplayName.s 
   lpszTitle.s 
   ulFlags.l 
   lpfn.l 
   lParam.l 
   iImage.l 
EndStructure 

Procedure.l ShutDownComputer(CompName.s, MessageToUser.s, SecondsUntilShutdown.l, ForceAppsClosed.l, RebootAfter.l) 
  ShutDown = InitiateSystemShutdown_(CompName, MessageToUser, SecondsUntilShutdown, ForceAppsClosed, RebootAfter) 
  ProcedureReturn ShutDown 
EndProcedure 

Procedure.l AbortShutdown(CompName.s) 
     AbortShutDown = AbortSystemShutdown_(CompName) 
     ProcedureReturn AbortShutDown 
EndProcedure 


; PureBasic Visual Designer v3.62 


;- Window Constants 
; 
#Window_0 = 0 

;- Gadget Constants 
; 
#Gadget_0 = 0 
#Gadget_1 = 1 
#Gadget_2 = 2 
#Gadget_3 = 3 
#Gadget_4 = 4 
#Gadget_5 = 5 
#Gadget_6 = 6 
#Gadget_7 = 7 
#Gadget_8 = 8 
#Gadget_9 = 9 
#Gadget_10 = 10 
#Gadget_11 = 11 
#Gadget_12 = 12 

Procedure.s GetBrowseNetworkWorkstation() 
    BI.BROWSEINFOS 
    pidl.l 
    sPath.s 
    pos.l 
    hwnd = WindowID(#Window_0) 
    
    If SHGetSpecialFolderLocation_(hwnd, #CSIDL_NETWORK, @pidl) = #ERROR_SUCCESS 
        BI\hwndOwner = hwnd 
        BI\pidlRoot = pidl 
        BI\pszDisplayName = Space(256) 
        BI\lpszTitle = "Select a network computer." 
        BI\ulFlags = #BIF_BROWSEFORCOMPUTER 
        
        If SHBrowseForFolder_(BI) <> 0 
            Name.s = "\\"+ BI\pszDisplayName 
            ProcedureReturn Name 
        EndIf 
        CoTaskMemFree_(@pidl) 
    EndIf 
EndProcedure 


Procedure Open_Window_0() 
  If OpenWindow(#Window_0, 216, 0, 302, 365, "ShutGUI",  #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar ) 
    If CreateGadgetList(WindowID(#Window_0)) 
      TextGadget(#Gadget_0, 20, 20, 80, 20, "ComputerName:") 
      StringGadget(#Gadget_1, 110, 20, 120, 20, "") 
      ButtonGadget(#Gadget_2, 250, 20, 30, 20, "...") 
      Frame3DGadget(#Gadget_3, 30, 60, 250, 80, "Optionen") 
      CheckBoxGadget(#Gadget_4, 60, 80, 190, 20, "Anwendungen forciert beenden") 
      CheckBoxGadget(#Gadget_5, 60, 110, 190, 20, "Neustart nach Herunterfahren") 
      TextGadget(#Gadget_6, 30, 160, 220, 20, "zu sendende Nachricht (127 Zeichen max)") 
      StringGadget(#Gadget_7, 30, 190, 250, 80, "", #ES_MULTILINE|#ES_AUTOVSCROLL) 
      TextGadget(#Gadget_8, 60, 280, 80, 20, "Delay (Sek.):") 
      StringGadget(#Gadget_9, 150, 277, 30, 20, "30") 
      ButtonGadget(#Gadget_10, 20, 310, 80, 30, "Herunterfahren") 
      ButtonGadget(#Gadget_11, 120, 310, 80, 30, "OPEN") 
      ButtonGadget(#Gadget_12, 210, 310, 80, 30, "QUIT") 
      
    EndIf 
  EndIf 
EndProcedure 


Open_Window_0() 

SetGadgetState(#Gadget_5, 1) 

Repeat 
  Event = WaitWindowEvent() 
  If Event = #PB_Event_CloseWindow 
    quit = 1 
  ElseIf Event = #PB_Event_Gadget 
    Select EventGadget() 
      Case 2 
        SetGadgetText(#Gadget_1, GetBrowseNetworkWorkstation()) 
      Case 10 
        Name.s = GetGadgetText(#Gadget_1) 
        message.s = GetGadgetText(#Gadget_7) 
        pause.s = GetGadgetText(#Gadget_9) 
        chkKillApps.l = GetGadgetState(#Gadget_4) 
        chkReboot.l = GetGadgetState(#Gadget_5) 
        If Name = "" 
          MessageRequester("Client wählen", "Es wurde kein Client ausgewählt.  ", #MB_ICONEXCLAMATION) 
        Else 
          goShutdown = ShutDownComputer(Name, message, Val(pause), chkKillApps, chkReboot) 
        If goShutdown = 1 
          MessageRequester("Kommando erfolgreich", "Herunterfahren erfolgreich eingeleitet für  " + Name + ".  " + Chr(13) + "Der Client wird heruntergefahren in " + pause + " Sekunden.  ", #MB_ICONINFORMATION) 
        ElseIf goShutdown = 0 
            MessageRequester("Fehler", "Herunterfahren nicht möglich für  " + Name + ".  Mögliche Ursachen:  " + Chr(13) + Chr(13) + "1. ClientName falsch geschrieben." + Chr(13) + "2. Der Computer ist kein Window NT-Client." + Chr(13) + "3. Sie haben nicht die erforderlichen Rechte." + Chr(13) + "4. Der Client kann im Netz nicht gefunden werden.", #MB_ICONEXCLAMATION) 
        EndIf 
    EndIf 
      Case 11 
        Name.s = GetGadgetText(#Gadget_1) 
        If Name = "" 
          MessageRequester("Client wählen", "Es wurde kein Client ausgewählt", #MB_ICONSTOP) 
        Else 
          cancelShutdown = AbortShutdown(Name) 
          If cancelShutdown = 1 
            MessageRequester("Abbruch erfolgreich", "Herunterfahren erfolgreich abgebrochen für  " + Name + ".", #MB_ICONINFORMATION) 
          ElseIf cancelShutdown = 0 
            MessageRequester("Abbruch unmöglich", "Abbruch nicht möglich für  " + Name + ".  Mögliche Ursachen:  " + Chr(13) + Chr(13) + "1. ClientName falsch geschrieben." + Chr(13) + "2. Der Computer ist kein Window NT-Client." + Chr(13) + "3. Sie haben nicht die erforderlichen Rechte." + Chr(13) + "4. Der Client kann im Netz nicht gefunden werden." + Chr(13) + "5. Zu spät.", #MB_ICONEXCLAMATION) 
          EndIf 
       EndIf 
      Case 12 
        quit = 1 
    EndSelect 
  EndIf 
Until quit 
End 
I can't make sense of it! :D

Posted: Fri Feb 01, 2008 12:22 am
by Character
I'm not German but I'll give it a try:
(germans do not laugh!)
; Beispiel wie man Clients im LAN remote herunterfahren oder neustarten kann.
; Optional kann auch eine Nachricht gesendet werden.
; Logischerweise muß der Initiator auf dem Client Adminrechte haben
; Example of how to download or restart clients remotely in a LAN.
; Optional it is also possible to send a message.
; It is obvious that the client's initiator needs admin rights.

Code: Select all

Procedure Open_Window_0() 
  If OpenWindow(#Window_0, 216, 0, 302, 365, "ShutGUI",  #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar ) 
    If CreateGadgetList(WindowID(#Window_0)) 
      TextGadget(#Gadget_0, 20, 20, 80, 20, "ComputerName:") 
      StringGadget(#Gadget_1, 110, 20, 120, 20, "") 
      ButtonGadget(#Gadget_2, 250, 20, 30, 20, "...") 
      Frame3DGadget(#Gadget_3, 30, 60, 250, 80, "Optionen")  ;options
      CheckBoxGadget(#Gadget_4, 60, 80, 190, 20, "Anwendungen forciert beenden")  ; forced shutdown processes (or applications?)
      CheckBoxGadget(#Gadget_5, 60, 110, 190, 20, "Neustart nach Herunterfahren") ; restart after download
      TextGadget(#Gadget_6, 30, 160, 220, 20, "zu sendende Nachricht (127 Zeichen max)") ; send message (max. 127 characters)
      StringGadget(#Gadget_7, 30, 190, 250, 80, "", #ES_MULTILINE|#ES_AUTOVSCROLL) 
      TextGadget(#Gadget_8, 60, 280, 80, 20, "Delay (Sek.):") 
      StringGadget(#Gadget_9, 150, 277, 30, 20, "30") 
      ButtonGadget(#Gadget_10, 20, 310, 80, 30, "Herunterfahren") ;download
      ButtonGadget(#Gadget_11, 120, 310, 80, 30, "OPEN") 
      ButtonGadget(#Gadget_12, 210, 310, 80, 30, "QUIT")

Code: Select all

 
        If Name = "" 
          MessageRequester("Client wählen", "Es wurde kein Client ausgewählt.  ", #MB_ICONEXCLAMATION)
          ;choose client, no client selected 
        Else 
          goShutdown = ShutDownComputer(Name, message, Val(pause), chkKillApps, chkReboot) 
        If goShutdown = 1 
          MessageRequester("Kommando erfolgreich", "Herunterfahren erfolgreich eingeleitet für  " + Name + ".  " + Chr(13) + "Der Client wird heruntergefahren in " + pause + " Sekunden.  ", #MB_ICONINFORMATION) 
          ; command succeeded, download successful started for + the client is downloadeded in + seconds
        ElseIf goShutdown = 0 
            MessageRequester("Fehler", "Herunterfahren nicht möglich für  " + Name + ".  Mögliche Ursachen:  " + Chr(13) + Chr(13) + "1. ClientName falsch geschrieben." + Chr(13) + "2. Der Computer ist kein Window NT-Client." + Chr(13) + "3. Sie haben nicht die erforderlichen Rechte." + Chr(13) + "4. Der Client kann im Netz nicht gefunden werden.", #MB_ICONEXCLAMATION) 
          ;error, dowload not possible for + possible causes + misspelled client name + computer is not a NT-client + you don' have the appropriate userrights + client cannot be found in network 
        EndIf 
    EndIf 
      Case 11 
        Name.s = GetGadgetText(#Gadget_1) 
        If Name = "" 
          MessageRequester("Client wählen", "Es wurde kein Client ausgewählt", #MB_ICONSTOP) 
          ; choose client, no client selected
        Else 
          cancelShutdown = AbortShutdown(Name) 
          If cancelShutdown = 1 
            MessageRequester("Abbruch erfolgreich", "Herunterfahren erfolgreich abgebrochen für  " + Name + ".", #MB_ICONINFORMATION)
            ;abort succeeded, download successful aborted for
          ElseIf cancelShutdown = 0 
            MessageRequester("Abbruch unmöglich", "Abbruch nicht möglich für  " + Name + ".  Mögliche Ursachen:  " + Chr(13) + Chr(13) + "1. ClientName falsch geschrieben." + Chr(13) + "2. Der Computer ist kein Window NT-Client." + Chr(13) + "3. Sie haben nicht die erforderlichen Rechte." + Chr(13) + "4. Der Client kann im Netz nicht gefunden werden." + Chr(13) + "5. Zu spät.", #MB_ICONEXCLAMATION) 
            ;abort impossible, abort impossible for + possible causes + misspelled client name + computer is not a NT-client + you don' have the appropriate userrights  + client cannot be found in network
          EndIf 

Posted: Fri Feb 01, 2008 12:51 am
by traumatic
Character wrote:(germans do not laugh!)
Absolutely nothing to laugh about!

Posted: Fri Feb 01, 2008 3:06 am
by thorax
Can someone translate the German / Austrian portions of this?
Maybe this helps:

Code: Select all


;Example how to shutdown or reboot LAN clients remotely 
;Optional you can send also a message.
;Needs Administrator rights on client side.

#ERROR_SUCCESS = 0
#MAX_PATH = 260
#CSIDL_NETWORK = $12
#BIF_BROWSEFORCOMPUTER = $1000

Structure BROWSEINFOS
   hwndOwner.l
   pidlRoot.l
   pszDisplayName.s
   lpszTitle.s
   ulFlags.l
   lpfn.l
   lParam.l
   iImage.l
EndStructure

Procedure.l ShutDownComputer(CompName.s, MessageToUser.s, SecondsUntilShutdown.l, ForceAppsClosed.l, RebootAfter.l)
  ShutDown = InitiateSystemShutdown_(CompName, MessageToUser, SecondsUntilShutdown, ForceAppsClosed, RebootAfter)
  ProcedureReturn ShutDown
EndProcedure

Procedure.l AbortShutdown(CompName.s)
     AbortShutDown = AbortSystemShutdown_(CompName)
     ProcedureReturn AbortShutDown
EndProcedure


; PureBasic Visual Designer v3.62


;- Window Constants
;
#Window_0 = 0

;- Gadget Constants
;
#Gadget_0 = 0
#Gadget_1 = 1
#Gadget_2 = 2
#Gadget_3 = 3
#Gadget_4 = 4
#Gadget_5 = 5
#Gadget_6 = 6
#Gadget_7 = 7
#Gadget_8 = 8
#Gadget_9 = 9
#Gadget_10 = 10
#Gadget_11 = 11
#Gadget_12 = 12

Procedure.s GetBrowseNetworkWorkstation()
    BI.BROWSEINFOS
    pidl.l
    sPath.s
    pos.l
    hwnd = WindowID(#Window_0)
    If SHGetSpecialFolderLocation_(hwnd, #CSIDL_NETWORK, @pidl) = #ERROR_SUCCESS
        BI\hwndOwner = hwnd
        BI\pidlRoot = pidl
        BI\pszDisplayName = Space(256)
        BI\lpszTitle = "Select a network computer."
        BI\ulFlags = #BIF_BROWSEFORCOMPUTER
        If SHBrowseForFolder_(BI) <> 0
            Name.s = "\\"+ BI\pszDisplayName
            ProcedureReturn Name
        EndIf
        CoTaskMemFree_(@pidl)
    EndIf
EndProcedure

Procedure Open_Window_0()
  If OpenWindow(#Window_0, 216, 0, 302, 365, "ShutGUI",  #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
    If CreateGadgetList(WindowID(#Window_0))
      TextGadget(#Gadget_0, 20, 20, 80, 20, "Computer Name:")
      StringGadget(#Gadget_1, 110, 20, 120, 20, "")
      ButtonGadget(#Gadget_2, 250, 20, 30, 20, "...")
      Frame3DGadget(#Gadget_3, 30, 60, 250, 80, "Options")
      CheckBoxGadget(#Gadget_4, 60, 80, 190, 20, "Force close applications")
      CheckBoxGadget(#Gadget_5, 60, 110, 190, 20, "Reboot after shutdown")
      TextGadget(#Gadget_6, 30, 160, 220, 20, "Message to send (max 127 Chars)")
      StringGadget(#Gadget_7, 30, 190, 250, 80, "", #ES_MULTILINE|#ES_AUTOVSCROLL)
      TextGadget(#Gadget_8, 60, 280, 80, 20, "Delay (Sec.):")
      StringGadget(#Gadget_9, 150, 277, 30, 20, "30")
      ButtonGadget(#Gadget_10, 20, 310, 80, 30, "Shutdown")
      ButtonGadget(#Gadget_11, 120, 310, 80, 30, "Open")
      ButtonGadget(#Gadget_12, 210, 310, 80, 30, "Quit")
    EndIf
  EndIf
EndProcedure

Open_Window_0()

SetGadgetState(#Gadget_5, 1)

Repeat
  Event = WaitWindowEvent()
  If Event = #PB_Event_CloseWindow
    quit = 1
  ElseIf Event = #PB_Event_Gadget
    Select EventGadget()
      Case 2
        SetGadgetText(#Gadget_1, GetBrowseNetworkWorkstation())
      Case 10
        Name.s = GetGadgetText(#Gadget_1)
        message.s = GetGadgetText(#Gadget_7)
        pause.s = GetGadgetText(#Gadget_9)
        chkKillApps.l = GetGadgetState(#Gadget_4)
        chkReboot.l = GetGadgetState(#Gadget_5)
        If Name = ""
          MessageRequester("Select Client", "No client choiced.", #MB_ICONEXCLAMATION)
        Else
          goShutdown = ShutDownComputer(Name, message, Val(pause), chkKillApps, chkReboot)
        If goShutdown = 1
          MessageRequester("Command successfull", "Shutdown successfull started for  " + Name + ".  " + Chr(13) + "Shutdown of client in " + pause + " seconds.  ", #MB_ICONINFORMATION)
        ElseIf goShutdown = 0
            MessageRequester("Error", "Shutdown not possible for  " + Name + ".  Reasons:  " + Chr(13) + Chr(13) + "1. Bad client name." + Chr(13) + "2. The Computer is not a Window NT-Client." + Chr(13) + "3. You don't have the needed access rights." + Chr(13) + "4. Client not found in network.", #MB_ICONEXCLAMATION)
        EndIf
    EndIf
      Case 11
        Name.s = GetGadgetText(#Gadget_1)
        If Name = ""
          MessageRequester("Select Client", "No client choiced.", #MB_ICONSTOP)
        Else
          cancelShutdown = AbortShutdown(Name)
          If cancelShutdown = 1
            MessageRequester("Abort successfull", "Shutdown aborted for  " + Name + ".", #MB_ICONINFORMATION)
          ElseIf cancelShutdown = 0
            MessageRequester("Abort impossible", "Abort not possible for  " + Name + ".  Reasons:  " + Chr(13) + Chr(13) + "1. Bad client name." + Chr(13) + "2. The Computer is not a Window NT-Client." + Chr(13) + "3. You don't have the needed access rights." + Chr(13) + "4. Client not found in network.", #MB_ICONEXCLAMATION)
          EndIf
       EndIf
      Case 12
        quit = 1
    EndSelect
  EndIf
Until quit
End

Posted: Fri Feb 01, 2008 4:32 am
by Rook Zimbabwe
Thank you all... now I just have to translate it from English to Texan and all will be good! :wink:

Posted: Fri Feb 01, 2008 12:24 pm
by Thalius
How about a chinese Version ? :lol:

Posted: Fri Feb 01, 2008 5:21 pm
by Rook Zimbabwe
I could have that for you in no time... but I doubt you could read it.

UNICODE makes my computer mean!!!

And you have to wait till the wife gets home to check my grammar! 8)