Execute a script or program when USB flash drive is inserted
  • Order of the Butterfly
    Order of the Butterfly
    dake
    Posts: 204 from 2007/9/14
    From: The building p...
    Is it possible to automatically execute a script located on an USB flash drive when you insert it?




    [ Edited by dake on 2011/1/21 21:12 ]
  • »21.01.11 - 19:10
    Profile
  • Paladin of the Pegasos
    Paladin of the Pegasos
    Zylesea
    Posts: 1919 from 2003/6/4
    A very quick and dirty skript (I am definietly not a DOS expert)

    wait 10 ; put in here the time interval the skript should check for usbscsi0:
    if exists ram:env/myvar
    delete ram:env/myvar
    endif
    if exists "usbscsi0:" noreq >nil:
    execute usbscsi0:myskript ; put here the name of the skript
    echo "1" >ram:env/myvar
    endif
    if not exists "ram:env/myvar"
    execute ram:bla
    endif

    Well, definitely not too elegant and a one minute type work, but at least works for usbscsi0:. This skript finishes itselfs once usbscsi0: is inserted and the skript off that flash drive is executed. I am sure you can edit the skript that it works with any usbscsi and doesn't quit once usbscsi0: is inserted, but just pauses as long as usbscsi0: is present.






    [ Editiert durch Zylesea an 2011/1/22 18:15 ]
    --
    http://www.via-altera.de

    Whenever you're sad just remember the world is 4.543 billion years old and you somehow managed to exist at the same time as David Bowie.
    ...and Matthias , my friend - RIP
  • »22.01.11 - 16:10
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    dake
    Posts: 204 from 2007/9/14
    From: The building p...
    Thanks Zylesea, that would do the trick!
    It should be very nice to have this as an option in Poseidon.
    When MorphOS for Powerbook is released I can see some synchronize problems regarding wich data to use and maybe an USB flash drive is good to switch between systems but I'm not sure if this is the best solution. Hmmm I should check if there is some good synchronize program for MorphOS:)
  • »23.01.11 - 11:37
    Profile
  • Paladin of the Pegasos
    Paladin of the Pegasos
    jcmarcos
    Posts: 1178 from 2003/3/13
    From: Pinto, Madrid ...
    I proposed this idea long ago, but surely not to the right audience. My idea was some kind of "onmount" and "onunmount" tootltips in the disk's ".info" file. It would be interesting if it also worked on default icons (those on "ENV:Sys/DefIcons"), so one can have some default actions for evey disk not having specific actions.
  • »24.01.11 - 08:06
    Profile
  • Visitor
  • You might go into the MUI-Settings of the Window/Screen (which I assume would eiether be ShowGirls or MultiView) and change the screen there. Hit "Save" and it should work next time.
  • »02.04.15 - 12:47
  • MorphOS Developer
    geit
    Posts: 928 from 2004/9/23
    You can by installing "MagicBeacon", which provides this feature among of several others.

    MagicBeacon can be installed using Grunch.
  • »02.04.15 - 14:07
    Profile