Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Русский
    3. ioBroker
    4. Скрипты
    5. ioBroker скрипты
    6. Как организовать управление компьютером

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    Как организовать управление компьютером

    This topic has been deleted. Only users with topic management privileges can see it.
    • I
      instalator last edited by

      @Bluefox:

      Многообещающий пакет https://github.com/octalmage/robotjs `
      Не могу установить, выдает ошибку

      c:\iobroker\node_modules\robotjs>node "C:\Program Files\nodejs\node_modules\npm\
      bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
      gyp ERR! configure error
      gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
      HON env variable.
      gyp ERR! stack     at failNoPython (C:\Program Files\nodejs\node_modules\npm\nod
      e_modules\node-gyp\lib\configure.js:103:14)
      gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node
      -gyp\lib\configure.js:64:11
      gyp ERR! stack     at Object.oncomplete (evalmachine.<anonymous>:108:15)
      gyp ERR! System Windows_NT 6.1.7601
      gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu
      les\\node-gyp\\bin\\node-gyp.js" "rebuild"
      gyp ERR! cwd c:\iobroker\node_modules\robotjs
      gyp ERR! node -v v0.10.35
      gyp ERR! node-gyp -v v1.0.1
      gyp ERR! not ok
      
      npm ERR! robotjs@0.2.1 install: `node-gyp rebuild`
      npm ERR! Exit status 1
      npm ERR!
      npm ERR! Failed at the robotjs@0.2.1 install script.
      npm ERR! This is most likely a problem with the robotjs package,
      npm ERR! not with npm itself.
      npm ERR! Tell the author that this fails on your system:
      npm ERR!     node-gyp rebuild
      npm ERR! You can get their info via:
      npm ERR!     npm owner ls robotjs
      npm ERR! There is likely additional logging output above.
      npm ERR! System Windows_NT 6.1.7601
      npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
      ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "robotjs"
      npm ERR! cwd c:\iobroker
      npm ERR! node -v v0.10.35
      npm ERR! npm -v 1.4.28
      npm ERR! code ELIFECYCLE
      npm ERR! not ok code 0</anonymous>
      
      1 Reply Last reply Reply Quote 0
      • Bluefox
        Bluefox last edited by

        Ну тут немного сложнее, чем с другими пакетами:

        Нужно установить Python (2.7), VS 2013 express.

        тогда должно заработать.

        Здесь написано, что надо сделать:

        https://github.com/TooTallNate/node-gyp/#installation

        1 Reply Last reply Reply Quote 0
        • aurodionov
          aurodionov last edited by

          @Bluefox:

          Нужно установить Python (2.7), VS 2013 express. `
          То есть он только под окна получается 😮 😞

          1 Reply Last reply Reply Quote 0
          • Bluefox
            Bluefox last edited by

            Нет. На линксе (debian) он сам собирается. нужно только до этого вызвать:

            sudo apt-get update
            sudo apt-get install build-essential
            
            
            1 Reply Last reply Reply Quote 0
            • I
              instalator last edited by

              @Bluefox:

              или просто так, если не нужно знать, что там батник говорит:

              require('child_process').spawn('cmd.exe', ['/c', 'c:/myBatchFile.bat']);
              ```` `  
              

              Не получается запустить файлик таким способом. Какие еще варианты есть?

              По первому варианту получилось. Единственный момент от какого имени запускается cmd?

              1 Reply Last reply Reply Quote 0
              • I
                instalator last edited by

                Если запускаю через radmin батник то удаленный комп отключается, если через iobroker то пишет что отказано в доступе.

                ! javascript-0 2015-08-22 19:29:10 info script.js.Scenes: child process exited with code 5
                ! javascript-0 2015-08-22 19:29:10 info
                ! javascript-0 2015-08-22 19:29:10 info script.js.Scenes: stderr: 192.168.1.10: �⪠���� � ����㯥.(5)
                ! javascript-0 2015-08-22 19:29:10 info
                ! javascript-0 2015-08-22 19:29:10 info script.js.Scenes: stdout: shutdown /s /t 00 /m \192.168.1.10
                ! javascript-0 2015-08-22 19:29:10 info C:\Windows\system32>
                ! javascript-0 2015-08-22 19:29:10 info script.js.Scenes: stdout:

                1 Reply Last reply Reply Quote 0
                • I
                  instalator last edited by

                  Запускаю батник скриптом:

                  require('child_process').spawn('cmd.exe', ['', 'c:/compoff.bat']);
                              var spawn = require('child_process').spawn;
                                      function startBat(filename) {
                                         var ls = spawn('cmd.exe', ['/c', filename]);
                                         ls.stdout.on('data', function (data) {
                                            log('stdout: ' + data);
                                         });
                                         ls.stderr.on('data', function (data) {
                                            log('stderr: ' + data);
                                         });
                                         ls.on('exit', function (code) {
                                            log('child process exited with code ' + code);
                                         });
                                      }  
                              startBat('c:/compoff.bat');
                  

                  Содержимое батника:

                  net use \\192.168.1.10 /user:instalator 
                  shutdown /s /t 3600 /f /m \\192.168.1.10
                  net use /delete \\192.168.1.10
                  

                  Вот что выдает в лог:

                  ! javascript.0 2015-11-05 21:39:54 info javascript.0 script.js.Scenes: child process exited with code 0
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout:
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: \192.168.1.10 �ᯥ譮 㤠���.
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: use /delete \192.168.1.10
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: net
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: C:\Windows\system32>
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout:
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stderr: 192.168.1.10: �⪠���� � ����㯥.(5)
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout:
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: /s /t 3600 /f /m \192.168.1.10
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: shutdown
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: C:\Windows\system32>
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout:
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: ������� �믮����� �ᯥ譮.
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout:
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: use \192.168.1.10 /user:instalator
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: net
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout: C:\Windows\system32>
                  ! javascript.0 2015-11-05 21:39:53 info javascript.0 script.js.Scenes: stdout:
                  Я так понимаю он рвет команды?

                  1 Reply Last reply Reply Quote 0
                  • Bluefox
                    Bluefox last edited by

                    Он рвёт вывод. А команды нормальные

                    Тебе отказано в доступе

                    shutdown (5) access is denied
                    
                    1 Reply Last reply Reply Quote 0
                    • I
                      instalator last edited by

                      @Bluefox:

                      Он рвёт вывод. А команды нормальные

                      Тебе отказано в доступе

                      shutdown (5) access is denied
                      ```` `  
                      

                      Как то читал эту кодировку не помню как), в какой он отдает?

                      Вот не пойму почему отказано, в безопасности добавил группу Все, если руками запускаю батник то все отрабатывает, а чз брокера нехотит.

                      1 Reply Last reply Reply Quote 0
                      • Bluefox
                        Bluefox last edited by

                        Эту проблему можно решить так:

                        require('child_process').spawn('chcp 866 | cmd.exe', ['', 'c:/compoff.bat']);
                                    var spawn = require('child_process').spawn;
                                            function startBat(filename) {
                                               var ls = spawn('cmd.exe', ['/c', filename]);
                                               ls.stdout.on('data', function (data) {
                                                  log('stdout: ' + data);
                                               });
                                               ls.stderr.on('data', function (data) {
                                                  log('stderr: ' + data);
                                               });
                                               ls.on('exit', function (code) {
                                                  log('child process exited with code ' + code);
                                               });
                                            }  
                                    startBat('c:/compoff.bat');
                        
                        

                        Кодировка либо 866 либо 65001. Надо просто попробовать

                        1 Reply Last reply Reply Quote 0
                        • I
                          instalator last edited by

                          http://forum.iobroker.net/viewtopic.php?f=29&t=1783

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          Support us

                          ioBroker
                          Community Adapters
                          Donate

                          472
                          Online

                          31.8k
                          Users

                          80.0k
                          Topics

                          1.3m
                          Posts

                          3
                          15
                          3191
                          Loading More Posts
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes
                          Reply
                          • Reply as topic
                          Log in to reply
                          Community
                          Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                          The ioBroker Community 2014-2023
                          logo