Jump to content
Sign in to follow this  
sosimple

Help for Shellexecute for rainmeter skin not working?

Recommended Posts

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.

 

 

 

 

Share this post


Link to post
Share on other sites

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 by AdamUL
Missed include file.

Share this post


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

 

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites
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 by sosimple

Share this post


Link to post
Share on other sites

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


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

Share this post


Link to post
Share on other sites

use the Autoit Macro @DesktopDir instead of "C:\Users\Blets\Desktop\"

 

 


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


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

Share this post


Link to post
Share on other sites

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 by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites
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 by sosimple

Share this post


Link to post
Share on other sites

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 by Jos

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

Share this post


Link to post
Share on other sites

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:

image.png.f937477fdc7a36173af11ece6426b7be.png

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

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 by sosimple

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...