Jump to content
Sign in to follow this  
Datus

Server 2008 Run as Administrator

Recommended Posts

Datus

My code wont work (opening files etc) unless i run as administrator by right clicking the .exe

I remember this being an issue with Vista and Autoit removed the need.

I have put #RequireAdmin at the top of my code but doesnt work.

I am logging in as a Domain Admin user.

Any Ideas for a work arround? or am I missing something.


We live as we dream alone!

Share this post


Link to post
Share on other sites
BrettF
Datus

Bits relevant here.

I run the program from Program Files.

#RequireAdmin
#region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_run_tidy=y
#AutoIt3Wrapper_run_obfuscator=y
#endregion;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIListBox.au3>
#include <file.au3>
#include <Array.au3>
#include <GUIConstants.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <Date.au3>
Global $LastUpdatedFile
$LastUpdatedFile = @WorkingDir & "\_LastUpdatedFile.txt"
$CheckOk = FileOpen($LastUpdatedFile, 1);Section Open Files Note: Open synopsis text files if requested later!
    If $CheckOk = -1 Then
        MsgBox(0, $CheckOk & ":Open error with file:", $LastUpdatedFile)
        Exit
        EndIf
    EndIf

comes back with -1


We live as we dream alone!

Share this post


Link to post
Share on other sites
SmOke_N

On Vista and Windows 2008 the Program Files directory is protected, and applications cannot write/open files in it unless ran as administrator.

I don't use either OS purposely, but others I work with avoid the program files directory purposely because of the restriction(s).


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
DCCD

i don't like vista ^_^

#RequireAdmin
#region;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_run_tidy=y
#AutoIt3Wrapper_run_obfuscator=y
#endregion;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIListBox.au3>
#include <file.au3>
#include <Array.au3>
#include <GUIConstants.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <Date.au3>
Global $LastUpdatedFile
$LastUpdatedFile = FileOpenDialog("OpenFile", @WindowsDir & "", "TXT (*.txt;*.inf)|INF (*.txt;*.inf)", 1 + 4 )
;
$CheckOk = FileOpen($LastUpdatedFile, 1);Section Open Files Note: Open synopsis text files if requested later!
MsgBox(0, $CheckOk & ":XXXOpen error with file:", $LastUpdatedFile)
If $CheckOk = -1 Then
    MsgBox(0, $CheckOk & ":Open error with file:", $LastUpdatedFile)
    Exit
EndIf
Edited by DCCD

Share this post


Link to post
Share on other sites
Datus

Ive put it in public documents and it works fine.

Thanks for the replies.

I will look at FileOpenDialog at a later date.

Cheers again.


We live as we dream alone!

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.