Jump to content
Sign in to follow this  
TonyF

Newbie fell at first hurdle!

Recommended Posts

I'd like to create a script to open programme, log in, select a data source then click a start button.

I've watched an online tutorial series showing a series of videos installing Malwarebytes and from that thought it would be enough to get started!

Apparently not as my first line of code isn't doing what I was hoping for, I was expecting the code below to open the programme but what it does is ask if I'd like AutoIT.v3 to make changes to my computer?

A pop up displays "Do you Want To Allow This App To Make Changes To Your Computer"

The App quoted is AutoIT.v3

Clicking Yes does nothing

The window under the editor shows the following

>"Full Path\autoit3.exe" /ErrorStdOut "Full Path\GHB.au3"    
>Exit code: 0    Time: 2.786

I understand Exit code: 0 is success and presumably the time which varies on each run is the time taken by the operation.

The script code I am using is

#RequireAdmin
Global $username, $password

$username = "Username"
$password = "Password"

Run (@ScriptFullPath & "Full Path\Myscript.exe", @SW_MAXIMIZE)

I'm not sure where this is going wrong so any help would be much appreciated.

 

Thanks

 

Tony

 

Share this post


Link to post
Share on other sites
36 minutes ago, TonyF said:

A pop up displays "Do you Want To Allow This App To Make Changes To Your Computer"

This is what #RequireAdmin does. It asks before it actually runs as admin.

Also, you skipped a parameter in the Run function. You used the show_flag parameter in place of the workingdir parameter.

As per the documentation it's:

Run ( "program" [, "workingdir" [, show_flag [, opt_flag]]] )

Also also, @ScriptFullPath is defined as 'Equivalent to @ScriptDir & "\" & @ScriptName'. So you're calling something like 'C:\ScriptDir\script.au3Full Path\Myscript.exe' which as you can see is not right.

Use this, if the exe is in the same folder as the script your are running. (also don't forget to add the backslash after the ampersand)

Run(@ScriptDir & "\Myscript.exe", "", @SW_MAXIMIZE)

Or simply define the full path, if the exe is in a completely different folder:

Run("C:\TheExeFolder\Myscript.exe", "", @SW_MAXIMIZE)

 

Edited by Seminko

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...