Jump to content

Can not open an EXE


Recommended Posts

I've been at this for about two weeks now.  I can not for the life of me open an exe!

Here is the function that calls the exe:

Func scite4au3_model_update_context_menu_entries(Const $this, Const ByRef $context_menu_selections)
  Local Const $autoit_directory = ' ' & $this.GetAutoItDirectory() & ' '

  local const $definition = $this.GetLoadedDefinition() & ' '

  Local Const $command = $autoit_directory & $definition & $this.EnableDisableContextMenuItems($context_menu_selections)

  Switch IsAdmin()
    Case True
      RunWait($this.StorageDirectory & "SciTE4AutoIt3\ContextMenuAdmin.exe" & $command, '', @sw_hide)

    Case False
      RunWait($this.StorageDirectory & "SciTE4AutoIt3\ContextMenuNonAdmin.exe" & $command, '', @sw_hide)
  EndSwitch
EndFunc

Here is the code in the exe:

#AutoIt3Wrapper_testing=y

#NoTrayIcon

#RequireAdmin

Run(@ScriptDir & "\ContextMenu.exe " & command(), '', @sw_show)

func command()
  local $command = ''

  for $argument in $CmdLine
    $command &= $argument
  next

  return $command
endfunc

I've confirmed that the paths are correct.  I can click on the exe and it will execute.  Any ideas?

Edit: Windows 7 x64.  AutoIt Production and Beta.

Edit: More Iinfo

I know the $this object is good because the script wouldn't run at all.

$autoit_directory =  C:\Program Files (x86)\AutoIt3\

$definition = BETA

$command =  C:\Program Files (x86)\AutoIt3\ BETA "Compile" "True" "CompileX86" "True" "CompileX64" "True" "CompileWithOptions" "True" "Edit" "True" "Run" "True" "RunX86" "True" "RunX64" "True" "Tidy" "False"

D:\Programming\AutoIt\My Scripts\SciTE4AutoIt3 Customizer\SciTE Customization GUI\SciTE4AutoIt3\ContextMenuNonAdmin.exe C:\Program Files (x86)\AutoIt3\ BETA "Compile" "True" "CompileX86" "True" "CompileX64" "True" "CompileWithOptions" "True" "Edit" "True" "Run" "True" "RunX86" "True" "RunX64" "True" "Tidy" "False"
Edited by jaberwocky6669
Link to comment
Share on other sites

jaberwocky6669,

This is going to sound stupid but, have you verified that "$autoit_directory", "$command" and "$definition" all have valid values?  These look like they are derived from an object ($this) but I don't see any error checking that a valid object was passed.

Secondly, you might try putting parm #1 of your runwait command in a variable and dumping it to make sure that it is formatted correctly.

Apologies if I'm just wasting your time!!!

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

Who dares disturb my brain fog?  Oh, for it it tis only kylomas.  :muttley:  Heh.

I know the object is good because the script wouldn't run at all.

$autoit_directory =  "C:Program Files (x86)AutoIt3"

$command = "Compile" "True" "CompileX86" "True" "CompileX64" "True" "CompileWithOptions" "True" "Edit" "True" "Run" "True" "RunX86" "True" "RunX64" "True" "Tidy" "False"

$definition = BETA

D:ProgrammingAutoItMy ScriptsSciTE4AutoIt3 CustomizerSciTE Customization GUISciTE4AutoIt3ContextMenuNonAdmin.exe "C:Program Files (x86)AutoIt3" Beta "Compile" "True" "CompileX86" "True" "CompileX64" "True" "CompileWithOptions" "True" "Edit" "True" "Run" "True" "RunX86" "True" "RunX64" "True" "Tidy" "False"

Edited by jaberwocky6669
Link to comment
Share on other sites

Is it that Run() cannot open an exe that requires admin rights without already having admin escalation?

 

I have been working on a problem with admin rights for a while now. It concerns Cisco VPN software on Win7 (I never had this problem in XP). Not joined to the domain, AutoIt can launch my program and everything works fine. Joined to the domain (even using a Domain Admin account), Cisco VPN hangs for a long time to and never works properly. Even using RunAs with local or domain admin credentials does not help.

However, when I create an executable to launch it with just a normal Run command and launch that executable using local admin rights, everything works perfectly. I have tried so many things to make this work, but the only one that produces good results is the two executable scenario where the first one runs the second one with local admin rights.

It took me months to figure this much out. I'm just glad I got something working because I have to change everyone out from XP to Win7 soon. Failure is not an option.

Hope this helps.

Link to comment
Share on other sites

Beast!  It works doing that manually!  So, I guess that means my runwait string is properly formatted.  Must be an autoit issue?  I noticed that when I run the main script with #requireadmin then I get auac prompt but no GUI.

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