Jump to content

Recommended Posts

Posted (edited)

I am trying to pass some parameters to another script using ShellExecute, thisworks fine on Win10 but not on Win7.

I have cut the code down to the bare minimum to illustrate the problem. This is the code with ShellExecute

$test_Params = "a b"
ShellExecute("shellexecute_test.au3", $test_Params)

This is the code that is being called (shellexecute_test.au3):

msgbox(0,"",$CmdLine[0])

The win7 PC reports 0, Win10 reports 2

Could there be a permissions issue?
Is there another way to make this work?

Edited by weirddave
Posted

Can you confirm that if you double click "shellexecute_test.au3" on Windows 7 that it executes, opens in Scite or does nothing?  It sounds like file associations aren't added.

Posted

It runs, I get a message box with 0 in it (which would be correct when launching it this way). If it wasn't launching correctly I wouldn't get the msgbox at all with the shellexecute method :) 

I'm actually double-clicking the au3 with the shellExecute in it as it happens.
If I compile shellexecute_test it works, but this isn't convenient for debugging :( 

Posted

Sorry was a little confused by your first post, I've tested on Windows 7 and Windows 10 and I get MsgBox with 2 on both systems, I do have UAC switched off on Windows 7.

Windows Enterprise 7/10 64 bit with AutoIT 3.3.14.2

Posted

Thanks for trying it. The Win7 PC is somewhat locked down, which is why my first suspect is a permissions issue.

I could do with a workaround, debugging without line numbers in the error is a pain, lol

 

Posted

Try running the *.exe script "as administrator" .  If that solves the problem, it could be the particular AnitVirus program installed on the PC that is interfering with program operation or it could be the security settings of Windows itself.

-pete

 

 

Posted

@weirddave hi

did you checked the ps restriction ?

do you execute the powershell command in the rigth directory ? 

Is powershell installed on w7 computer also ? 

If no you have to import powershell module 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Posted

@weirddave - Can you check the value of RegRead('HKEY_CLASSES_ROOT\AutoIt3Script\Shell\Run\Command', '')

Just wondering if its missing parameters on the command line e.g.
"C:\Program Files (x86)\AutoIt3\AutoIt3.exe" "%1" %*

 

Posted

Regedit told me that the key was set to  "C:\engsys\AutoIt\AutoIt3.exe" "%1"

I have changed it to "C:\engsys\AutoIt\AutoIt3.exe" "%1" %*

which seems to have fixed it. 

Interestingly, my key name was HKEY_CLASSES_ROOT\Applications\AutoIt3.exe\shell\open\command

I suspect what I've done is associate au3 files with the exe rather than install autoit on this particular PC. It's coming back to me now, the admin doesn't want to see "random" installs that aren't on the approved list and C:\engsys is ignored by the virus protection here ;) 

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
  • Recently Browsing   0 members

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