LeonardS

I'm new to this...

14 posts in this topic

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? :(

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

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

BeatsPlayer - Music player.

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

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.

Firefox Profile Backup - Backup/restore previously saved profile.

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

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

 

Share this post


Link to post
Share on other sites

I compiled the .au3 file to an .exe file, I just thought that when I put the USB in the PC it would launch the exe file but it doesn't launch it, but when the script is running on my pc and then put the usb in my pc, it does work...

 

lol

Share this post


Link to post
Share on other sites

Here is a video to explain:

 

Share this post


Link to post
Share on other sites

I dunno, but I'm going to hazard a guess at this. No new drive was added when when running the executable from the memory stick, so no message appeared. It's probably something else, but it's worth a guess. :'(

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

I just want a compiled autoin script on my USB, and when I put it in any pc it runs the script. See it as a autorun.inf?

Share this post


Link to post
Share on other sites

Already tried that, that didn't work :/

 

I read on another forum that this automatically runs itselfs, but if you say it doesn't have that option, I know now. Thanks

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

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

Share this post


Link to post
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.


Make yourself sheep and the wolves will eat you - Benjamin Franklin

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

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

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

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

BeatsPlayer - Music player.

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

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.

Firefox Profile Backup - Backup/restore previously saved profile.

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

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

 

Share this post


Link to post
Share on other sites

So confused... I just made a new script with only this code:

Run("notepad.exe")

I compiled it to .exe and put it on my USB, took the USB out of my pc and then back in, nothing happens...

 

Share this post


Link to post
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

Share this post


Link to post
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