Jump to content

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


marko29
 Share

Recommended Posts

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
Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

Does your executable accept the file as an argument?

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

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

Link to comment
Share on other sites

  • Moderators

marko29,

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

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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

Link to comment
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!

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