Announcement

Collapse
No announcement yet.

Login with USB Device

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Login with USB Device

    Hello everyone.
    I would like to create on AMS 8.5 a script that when it reads any USB device scrolls to the next page, can anyone help me?
    Sorry about my bad English, but I’m Italian!

  • #2
    On our first page in the project, in the On Show event script, start a timer which fires every second or every two seconds, like this:

    Code:
    [FONT=Courier New]Page.StartTimer(2000);[/FONT]
    In the On Timer event script, which will be executed every two seconds, you would look for an USB stick. You can do this by first getting a list of all detected drives, and then testing each drive if it is a removable drive. If you found a removable drive, this device is most likely a USB stick, and you would jump to the desired page. Something like this in the On Timer event script should work:

    Code:
    l[FONT=Courier New]ocal bFound = false;
    local tDrives = Drive.Enumerate();
    
    for i = 1, Table.Count(tDrives) do
       local nType = Drive.GetType(tDrives[i]);
       if (nType == DRIVE_REMOVABLE) then
          bFound = true;
          break;
       end
    end
    
    if bFound then
       Page.Jump("Page2");
    end[/FONT]
    If this is unclear, then attach your exported project file as an *.apz file, so we can see how far you got. (File > Export > Project Archive (*.apz))

    Ulrich

    Comment


    • #3
      Originally posted by Ulrich View Post
      On our first page in the project, in the On Show event script, start a timer which fires every second or every two seconds, like this:

      Code:
      [FONT=Courier New]Page.StartTimer(2000);[/FONT]
      In the On Timer event script, which will be executed every two seconds, you would look for an USB stick. You can do this by first getting a list of all detected drives, and then testing each drive if it is a removable drive. If you found a removable drive, this device is most likely a USB stick, and you would jump to the desired page. Something like this in the On Timer event script should work:

      Code:
      l[FONT=Courier New]ocal bFound = false;
      local tDrives = Drive.Enumerate();
      
      for i = 1, Table.Count(tDrives) do
      local nType = Drive.GetType(tDrives[i]);
      if (nType == DRIVE_REMOVABLE) then
      bFound = true;
      break;
      end
      end
      
      if bFound then
      Page.Jump("Page2");
      end[/FONT]
      If this is unclear, then attach your exported project file as an *.apz file, so we can see how far you got. (File > Export > Project Archive (*.apz))

      Ulrich

      thank you so much! it works perfectly!

      Comment

      Working...
      X