Jump to content

I'm new to this...


LeonardS
 Share

Recommended Posts

I just copied this script from a website:

 $DBT_DEVICEARRIVAL = "0x00008000"
  $WM_DEVICECHANGE = 0x0219
  GUICreate("")
  GUIRegisterMsg($WM_DEVICECHANGE , "MyFunc")
  Func MyFunc($hWndGUI, $MsgID, $WParam, $LParam)
  If $WParam == $DBT_DEVICEARRIVAL Then
 MsgBox(4096, "Info", "My Drive has been      Inserted, Backup My Files!")
  EndIf
  EndFunc
  While 1
 $GuiMsg = GUIGetMsg()
 WEnd

 

compiled it to .exe and dragged it to my USB.

 

Now I noticed that when the program isn't running, and I mount the USB in, it doesn't work. But when I run AutoIt <name>.au3 it does work?

That means I have to run the program on my PC otherwise the script won't even work? :(

Link to comment
Share on other sites

Huh, what? So you have an exe that isn't running, and you want it to work?

PS: you need a sleep in the loop, that's pushing the cpu harder than it needs.

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

I don't know why it would not work. I also can't verify what you say right now. I suggest you use a very simple program for testing this. Compile the 'hello world' example, from the help file, and see if you can autorun that. I'm sure it should be possible - if not by this method, then by some other method. Is your PC set to allow autorun?

Edited by czardas
Link to comment
Share on other sites

The script was never meant to run on the inserted device -- only on the PC.
When the script is run, it will detect if a usb device is inserted.

Which it does. I tested it, and it does what it was designed to do.

If you want a script to popup with a msgbox, then make a script and
then compile it and use autorun.inf to initiate it.

But...
Most security conscious users have autorun disabled on their PC.

I do.

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
Share on other sites

8 hours ago, LeonardS said:

I meant: Do I have to run test.au3(autoin logo on my desktop) on my PC to make the test.exe on my USB to work?

 

Because this way, every PC I put my USB in, I first need to run the autoin program first... Thats weird.

You don't have to run the .au3, you can run the compiled exe, but one of them has to be running to detect the usb event.

Even if you place it in the autorun, once the usb is in, and the application starts, it will only catch events from there on, not the actual usb that got in, that has the application.

As far as running the au3 to make the exe work, no. The exe runs independently. exe and au3 do the same, but the exe runs alone, and the au3 needs another application to run, ex. autoit.

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

12 hours ago, czardas said:

I don't know why it would not work. I also can't verify what you say right now. I suggest you use a very simple program for testing this. Compile the 'hello world' example, from the help file, and see if you can autorun that. I'm sure it should be possible - if not by this method, then by some other method. Is your PC set to allow autorun?

Autorun.inf is disabled for windows 7 and up. And I'm using windows 10. So I guess that won't work

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...