AutoHotkey Community

It is currently May 27th, 2012, 12:11 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Runas
PostPosted: April 13th, 2011, 11:13 am 
Offline

Joined: July 28th, 2010, 10:18 pm
Posts: 90
Location: vicenza - italia
I want to use runas to run a console application that gives me problems with user permissions.
the console application expect to work with relative paths from the point where it is launched

the problem is that launching the console application using AutoHotkey Run i can not set the correct path

This is the link of the image with the error generated from my console application:
https://docs.google.com/leaf?id=0B1-Ja5ucP5R5NjljYWVlOWYtN2FlOC00MjcyLThhNTUtMjZjODhiYTc5ZGYw&sort=name&layout=list&num=50
the highlight is a path that should not exist because the path must be relative and not absolute

also when i run the console application using runas, rather than a simple batch file, the console window closes too quickly prevent us from seeing any messages (autohotkey pause command ?)

sorry for my english and long-winded post.
tx, milko


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 13th, 2011, 4:20 pm 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
This method should work ok...

Application:
ConsoleApp.exe

Script:
Create (eg) ConsoleAppLauncher.ahk script
(see below for details)
Compile it into ConsoleAppLauncher.exe

Shortcut:
Create a shortcut to above ConsoleApp.exe
"Target": (path)\ConsoleApp.exe
--> add "(path)\ConsoleAppLauncher.exe"
to give: "(path)\ConsoleAppLauncher.exe" "(path)\ConsoleApp.exe"

. . . . . . . . ConsoleAppLauncher.ahk
Code:
SetKeyDelay, 50
pathname = %1%

; Extract program/file name & folder path
SplitPath, pathname, exename, Path,, exename_no_ext
ProgramName := exename_no_ext

; Invoke a DOS-Prompt window                                             (this way it doesn't immediately disappear, due to the app closing it,
Run, cmd.exe, %Path%   ;Path = working directory" (prompt starts at)                   as app doesn't "own" it, this script does!)
Sleep 1000

; "Type-in" name of console app & Run it
Send %ProgramName%
Sleep, 500
Send, {Enter}   ;Run program


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 22nd, 2011, 10:54 am 
Offline

Joined: July 28th, 2010, 10:18 pm
Posts: 90
Location: vicenza - italia
sorry if I have not told you before:
Superlativo !

:-D
tx


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 24th, 2011, 12:49 am 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
We aim to please...... :wink:


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher and 17 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group