Sign in to follow this  
Followers 0
marko29

Something doesnt work with Run, Runas and ShellEx and my exe

9 posts in this topic

#1 ·  Posted (edited)

So i am using Run, RunAs, Shell(tried all of them) that opens some program which can then open some .type of files for reading.

What happens is that each time i open it with specified commands it complains "cant open file for reading"(note:autoit commands open my exe, but exe cant open its file types). If i open program normally trough windows(vista, 7) it normally reads, processes the file...

I tried the following

If Not isAdmin() then msgbox("maybe you are not admin") ; i am running those commands as admin so this falls of as the cause.

I also tried

RunAs("windowsuserwhichisalsoadminaccount", @ComputerName, 'mywindowspass', 0, GUICtrlRead($input_that_contains_fullpath_to_file), @SystemDir)

Nothing works...

Edited by marko29

Share this post


Link to post
Share on other sites



marko29,

I would hazard a guess that the GUICtrlRead($input_that_contains_fullpath_to_file) parameter contains spaces. :P

Create a variable beforehand like this (the '"' things are single quote, double quote, single quote):

$sPath = '"' & GUICtrlRead($input_that_contains_fullpath_to_file) & '"'

and then try using that as a parameter to the Run command. :x

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Does your executable accept the file as an argument?

run(notepad.exe c:\thisfile.txt)


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

@Melba23

Didnt work :x

Its clean d:\dir\program.exe

Oh my, if this is unsolvable for you melba then i am worried, hehe

Share this post


Link to post
Share on other sites

marko29,

What is "clean"? Is it some form of console command? :x

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

marko29,

What is "clean"? Is it some form of console command? :x

M23

I mean there are no spaces in the path like "d:\dir is this\program.exe", just d:\dir\prog.exe

I still tried what you posted and no i am not using any console commands

Also beside my exe not being able to read its file types it also can't read other windows pids(its feature) so it seems there is some access block on it, my guess

I did put admin rights on all accounts that use the exe btw, but then again autoit shows that i am running as admin anyway so what else could put this restriction then?

I am about to try the script on virutal machine(xp) and see what happens, unless someone understands this

Share this post


Link to post
Share on other sites

If the filetype is registered to the program you're trying to open them with, you could try sheellexecuting the file.

EG from helpfile:

ShellExecute("myfile.txt", "", @ScriptDir, "edit")

William

PS it might help if you showed some of the code you're using!

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

If the filetype is registered to the program you're trying to open them with, you could try sheellexecuting the file.

EG from helpfile:

ShellExecute("myfile.txt", "", @ScriptDir, "edit")

William

PS it might help if you showed some of the code you're using!

So that is opening txt from windows with edit parameter but what if the only way to open the file is trough file menu > open file > input file path > click ok button

I am automating this in a way that i first run the exe trough autoit then automate file menu click with SelectFileMenu(), then guictrlsendtext(), then guiclickbutton() and all goes well except that the program returns error "cant open the file for reading"

How can a shell help in this case?

I already posted code but i doubt this is about code really, more like i have no idea what to do actually:

Run(GUICtrlRead($input_that_contains_fullpath_to_file)) ;this is all i need to make sure it cant open the file for reading, afterwards i manually test the file opening

Edited by marko29

Share this post


Link to post
Share on other sites

Solved:

The problem was second parameter(working dir, which needed to be dir of the exe) Since it looked as -optional in help file i thought it was optional but guess it wasnt.

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  
Followers 0