marko29 Posted January 13, 2011 Share Posted January 13, 2011 (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 January 13, 2011 by marko29 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 13, 2011 Moderators Share Posted January 13, 2011 marko29,I would hazard a guess that the GUICtrlRead($input_that_contains_fullpath_to_file) parameter contains spaces. 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. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
iamtheky Posted January 13, 2011 Share Posted January 13, 2011 Does your executable accept the file as an argument? run(notepad.exe c:\thisfile.txt) ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
marko29 Posted January 13, 2011 Author Share Posted January 13, 2011 @Melba23 Didnt work Its clean d:\dir\program.exe Oh my, if this is unsolvable for you melba then i am worried, hehe Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 13, 2011 Moderators Share Posted January 13, 2011 marko29,What is "clean"? Is it some form of console command? M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
marko29 Posted January 13, 2011 Author Share Posted January 13, 2011 marko29,What is "clean"? Is it some form of console command? M23I mean there are no spaces in the path like "d:\dir is this\program.exe", just d:\dir\prog.exeI still tried what you posted and no i am not using any console commandsAlso 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 More sharing options...
saywell Posted January 13, 2011 Share Posted January 13, 2011 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! Link to comment Share on other sites More sharing options...
marko29 Posted January 13, 2011 Author Share Posted January 13, 2011 (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 January 13, 2011 by marko29 Link to comment Share on other sites More sharing options...
marko29 Posted January 13, 2011 Author Share Posted January 13, 2011 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now