sosimple Posted June 12, 2019 Share Posted June 12, 2019 Hi. I have a rainmeter skin , named : BlackScreen . It is in directory C:\Users\blets\Documents\Rainmeter\Skins\Black Screen\BlackScreen.ini Rainmeter app is in directory C:\Program Files\Rainmeter\Rainmeter.exe I run the blackscreen skin through a desktop shortcut with those: Target "C:\Program Files\Rainmeter\Rainmeter.exe" !ToggleConfig "Black Screen" "BlackScreen.ini" Start "C:\Program Files\Rainmeter" The shortcut works fine. I just want to run it through autoit, but nothing work. I tried this: ShellExecute("C:\Program Files\Rainmeter\Rainmeter.exe" , "!ToggleConfig" ,"C:\Users\blets\Documents\Rainmeter\Skins\Black Screen\BlackScreen.ini") No error but do nothing. I also tried to call the shortcut: (the name of the shortcut is config.lnk) ShellExecute("C:\Users\blets\Desktop\" & "config.lnk") It do nothing. If I try to run another shortcut in desktop it works: shellExecute("C:\Users\blets\Desktop\" & "google earth.lnk") Any help? Thanks. Link to comment Share on other sites More sharing options...
AdamUL Posted June 12, 2019 Share Posted June 12, 2019 (edited) Give the following a try. This is based on what you give for the shortcut. Also, do you have 64-bit OS, and running you script as 32-bit? Using ShellExecute #include <WinAPIFiles.au3> ;Turn off redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) ShellExecute("C:\Program Files\Rainmeter\Rainmeter.exe", '!ToggleConfig "Black Screen" "BlackScreen.ini"', "C:\Program Files\Rainmeter") Using Run #include <WinAPIFiles.au3> ;Turn off redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) Run('"C:\Program Files\Rainmeter\Rainmeter.exe" !ToggleConfig "Black Screen" "BlackScreen.ini"', "C:\Program Files\Rainmeter") Adam Edited June 13, 2019 by AdamUL Missed include file. sosimple 1 Link to comment Share on other sites More sharing options...
sosimple Posted June 13, 2019 Author Share Posted June 13, 2019 12 hours ago, AdamUL said: Give the following a try. This is based on what you give for the shortcut. Also, do you have 64-bit OS, and running you script as 32-bit? Using ShellExecute ;Turn off redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) ShellExecute("C:\Program Files\Rainmeter\Rainmeter.exe", '!ToggleConfig "Black Screen" "BlackScreen.ini"', "C:\Program Files\Rainmeter") Using Run ;Turn off redirection for a 32-bit script on 64-bit system. If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) Run('"C:\Program Files\Rainmeter\Rainmeter.exe" !ToggleConfig "Black Screen" "BlackScreen.ini"', "C:\Program Files\Rainmeter") Adam Many thanks man, but it doesn't work. I do use windows 10 64bit. And I think i run the script as 32 bit as you said.. both of them when i run them, gives me error: "C:\Users\blets\Desktop\??? AutoIt v3 Script.au3" (56) : ==> Unknown function name.: If @OSArch = "X64" And Not @AutoItX64 Then _WinAPI_Wow64EnableWow64FsRedirection(False) If @OSArch = "X64" And Not @AutoItX64 Then ^ ERROR if i run them without the first line, no error but do nothing. I compiled them both to x86 and 64 to try as exe, If i compile as 64 , do nothing If I compile as x86 , when i run, it gives me error : Error: Unknown function name.. Link to comment Share on other sites More sharing options...
Nine Posted June 13, 2019 Share Posted June 13, 2019 you need this line at the very beginning of your script : #include <WinAPIFiles.au3> sosimple 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
sosimple Posted June 13, 2019 Author Share Posted June 13, 2019 (edited) 52 minutes ago, Nine said: you need this line at the very beginning of your script : #include <WinAPIFiles.au3> Thanks. Now the error message gone, but still do nothing both ways. I have also posted a mistake, I don't know if it helps. When I tried: ShellExecute("C:\Users\blets\Desktop\config.lnk") I take the message: C:\Users\blets\Desktop\config.lnk the directory doesn't exist Edited June 13, 2019 by sosimple Link to comment Share on other sites More sharing options...
Developers Jos Posted June 13, 2019 Developers Share Posted June 13, 2019 Try something like this: $aDetails = FileGetShortcut(@DesktopDir & "\config.lnk") ConsoleWrite("Path: " & $aDetails[0] & @CRLF & _ "Working directory: " & $aDetails[1] & @CRLF & _ "Arguments: " & $aDetails[2] & @CRLF & _ "Description: " & $aDetails[3] & @CRLF & _ "Icon filename: " & $aDetails[4] & @CRLF & _ "Icon index: " & $aDetails[5] & @CRLF & _ "Shortcut state: " & $aDetails[6] & @CRLF) ShellExecute($aDetails[0],$aDetails[2],$aDetails[1]) and run that form SciTE and tell us what the result is in the Outputpane. Jos sosimple 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
rudi Posted June 13, 2019 Share Posted June 13, 2019 use the Autoit Macro @DesktopDir instead of "C:\Users\Blets\Desktop\" sosimple 1 Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
sosimple Posted June 13, 2019 Author Share Posted June 13, 2019 22 minutes ago, Jos said: Try something like this: $aDetails = FileGetShortcut(@DesktopDir & "\config.lnk") ConsoleWrite("Path: " & $aDetails[0] & @CRLF & _ "Working directory: " & $aDetails[1] & @CRLF & _ "Arguments: " & $aDetails[2] & @CRLF & _ "Description: " & $aDetails[3] & @CRLF & _ "Icon filename: " & $aDetails[4] & @CRLF & _ "Icon index: " & $aDetails[5] & @CRLF & _ "Shortcut state: " & $aDetails[6] & @CRLF) ShellExecute($aDetails[0],$aDetails[2],$aDetails[1]) and run that form SciTE and tell us what the result is in the Outputpane. Jos >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\blets\Desktop\bbb.au3" Path: C:\Program Files (x86)\Rainmeter\Rainmeter.exe Working directory: C:\Program Files\Rainmeter Arguments: !ToggleConfig "Black Screen" "BlackScreen.ini" Description: Icon filename: Icon index: 0 Shortcut state: 1 Also windows gives me the error message windows can't fint the directory C:\Program Files (x86)\Rainmeter\Rainmeter.exe Link to comment Share on other sites More sharing options...
rudi Posted June 13, 2019 Share Posted June 13, 2019 (edited) That's what @AdamUL has mentioned above. Either disable WOW redirection, or you also can compile your script for 64 bit environment Pls. have a look at the Autoit Helpfile Macro Reference, search for @AppDataCommonDir Edited June 13, 2019 by rudi sosimple 1 Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
sosimple Posted June 13, 2019 Author Share Posted June 13, 2019 (edited) 3 minutes ago, rudi said: That's what @AdamUL has mentioned above. Either disable WOW redirection, or you also can compile your script for 64 bit environment How can i do that? If you meant to complile it in 64 bit, i have write , i already try it without succes. edit.. No the last script, if i compile it in 64 it does work.. Thanks to all, although i can't understand why this is happening, and why i cant run it successfuly without compile, but i can probably do what i want with this. many many thanks to all.. I have spend many hours trying before post.. Edited June 13, 2019 by sosimple Link to comment Share on other sites More sharing options...
Developers Jos Posted June 13, 2019 Developers Share Posted June 13, 2019 (edited) The easy way is to install the Full version of SciTE4AutoIt3 first and then add this at the top of your script: #AutoIt3Wrapper_UseX64=y .. and then simply hit Run (F5) again in SciTE. :-) Jos Edited June 13, 2019 by Jos sosimple 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
rudi Posted June 13, 2019 Share Posted June 13, 2019 (edited) As @Jos mentioned, use the Autoit Customized SciTE Editor, if not done so far. With almost 100 postings I think you might have done that already? Many of the compiler options are accessible by the GUI that's showing, when you press CTRL+F7 in SciTE with the script open in the editor. That way you don't need to know that directive by heart: Edited June 13, 2019 by rudi sosimple 1 Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
sosimple Posted June 13, 2019 Author Share Posted June 13, 2019 (edited) OK, I'll do that, thanks to all. It does work now the way I needed. (The almost 100 post are actually almost in 10 years, so i am actually... almost newbie ) Edited June 13, 2019 by sosimple 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