Jump to content

#Include oddities


Recommended Posts

I know there are a number of issues posted about #Include however I am not finding any that mirror what I am seeing.

The Scenario:
I have a program that has a number of these types of functions and they all seem to be acting oddly.
(Note: I have isolated this small example to have executable code for people to test with)

#Include <reset_view.au3>
$x = WinActivate("MyWindow")

reset_view()

The contents of Reset_View.au3 are as follows.

Func reset_view()
   MouseClick("left",3075+Random(1,7),77+Random(1,7),1,1)
      Sleep(200)
   MouseClick("left",3075+Random(1,7),77+Random(1,7),1,1)
   Send("{PGDN down}")
   Send("{UP down}")
   Sleep(Random(2000,2500))
   Send("{Up up}")
   Sleep(Random(500,750))
   Send("{PGDN up}")
EndFunc


The function works fine on my primary computer, even as described above with the #Include method.
     Windows 10 Pro 64-bit (10.0,Build 18363)

I moved my AutoIT scripts from my PC to a VM and now I am having my issue.
     Windows 7 Ultimate 64-bit (6.1,Build 7601)

The Issue:

If I call reset_view() from within Reset_View.au3 it works exactly as expected.
If I call reset_view() from within Test.au3 using the #Include method it 'wigs out' on me.
If I put the full Function into Test.au3 and run I get an error indicating the function already exists.
               Test Scripts\Test.au3"(5,18) : error: reset_view() already defined.

Definitions:

'wigs out':

  • Mouse movement does not occur
  • Mouse click does occur outside of ("MyWindow")
  • Mouse click does not occur inside of ("MyWindow")
  • PGDN and UP do not work inside of ("MyWindow")

Notes:

I know I already said it but I believe it bears repeating; This is ONLY an issue when I do it from an #Include call. I DO NOT have the issue when I call the function directly from with Reset_View.au3

This is happening to all of my "Universal_Functions" that are in the full program, I have just isolated reset_view() as it is a good simple example. There are about 30 total Universal_Functions.

Yes, I have created new files outside of "Universal_Functions" and done isolated testing, reset_view() was one such test.

I have tried $x = WinAct... with and without the $x =.

Yes, I have uninstalled and reinstalled AutoIT.

There is a weird thing that happens when the script finishes, I have included a screen cap of this. It shows up about 1/2 way up and about 1/5 from the left side of the screen. This only happens at the end of the script and only on the VM.

Conclusion:

TL:DR, #Include is called but the functions do not work properly.
Finally, I would like to thank anyone who can provide any useful assistance.

SciTE.png

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...