Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

15
LINES

< > BotCompany Repo | #555 // Stefan's tablet detect

Lua code

-- detects if tablet is connected to notebook (run on notebook)

get("#515") -- splitLines

bla = os_backtick('usb-devices')
lines = splitLines(bla)

for _, line in ipairs(lines) do
  if line:match("S:%s+Manufacturer=SurfTab") then
    print("Tablet connected!")
    return
  end
end

print("Tablet not connected!")

Author comment

Began life as a copy of #554

test run  test run with input  download  show line numbers   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, znullqslnikg

Comments [hide]

ID Author/Program Comment Date
968 #1000604 (pitcher) 2015-08-20 15:28:24
967 #1000610 Edit suggestion:
!636
!629

main {
static Object androidContext;
static String programID;

public static void main(String[] args) throws Exception {
-- detects if tablet is connected to notebook (run on notebook)

get("#515") -- splitLines

bla = os_backtick('usb-devices')
lines = splitLines(bla)

for _, line in ipairs(lines) do
if line:match("S:%s+Manufacturer=SurfTab") then
print("Tablet connected!")
return
end
end

print("Tablet not connected!")
}}
2015-08-20 08:47:39  delete 
52 stefan Works.

run -power -offline 555
2015-04-01 21:00:43

add comment

Snippet ID: #555
Snippet name: Stefan's tablet detect
Eternal ID of this version: #555/1
Text MD5: d926cf09205cca1d8fc4c2568fa60447
Author: stefan
Category:
Type: Lua code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-04-01 20:49:33
Source code size: 329 bytes / 15 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 1085 / 314
Referenced in: #1003263 - Stylesheet for Blog
#1003349 - Output of Google Video Search
#1025977 - bootstrap.min.css v3.3.0
#1029819 - intTelInput.min.css
#1030222 - hPopDownButton - HTML triangle pop-down menu
#1030975 - HTMLPopDownButton - HTML triangle pop-down menu v2
#1032366 - HPopDownButton - generalized hPopDownButton
#1032794 - HTMLPopDownButton - HTML triangle pop-down menu v2 (backup)
#1032795 - HTMLPopDownButton_v2
#3000189 - Answer for stefanreich(>> t bla)
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)