Page 1 of 1

Change Desktop Background

Posted: Sun Sep 04, 2011 11:04 pm
by sanoski
I asked this question on another category but no one ever answered. Maybe I'll have more luck here. Is there a way to change my computer's desktop background image from LiveCode? I can probably write a Python script to do this pretty easily, but I'd like to actually use LiveCode instead of having to use Python every time run into a dead end like this.

Re: Change Desktop Background

Posted: Mon Sep 05, 2011 1:21 am
by Mark
Hi,

Probably, you don't get any answers because you provide too little information. I think it is possible on Mac and Windows, but it'll require an additional scripting tool such as.... Python :-)

Kind regards,

Mark

Re: Change Desktop Background

Posted: Mon Sep 05, 2011 6:54 am
by jacque
LiveCode doesn't have any control outside of its own app space, but it can communicate in a couple of OS languages. If you want to change the desktop pattern on a Mac, you could look into using AppleScript. LiveCode can run AppleScripts using the "do as AppleScript" command. On Windows, there may be a shell command that will do it. For that, you'd use the "shell" function.

Re: Change Desktop Background

Posted: Mon Sep 05, 2011 9:17 am
by Mark
Jacque,

Since OP says he has a Python script, I'd recommend compiling that Pything script and running it from the shell or with a launch command.

Kind regards,

Mark

Re: Change Desktop Background

Posted: Mon Sep 05, 2011 11:45 am
by Klaus
Hi sanoski,

you can use an AppleScript on OS X:

Code: Select all

tell application "Finder"
    set desktop picture to POSIX file "/your/filename.jpg"
end tell
Put this into a field or custom property, replace the filename with the one you need and:
...
put fld "applescript" into AScript
do AScript as applescript
...
No idea about Windows 8)

Best

Klaus

Re: Change Desktop Background

Posted: Wed Sep 07, 2011 4:40 am
by sanoski
Thanks for your help, everyone. I plan on using this for my Mac, but it might be a good idea to use a strategy for Windows too. I'm intimately familiar with Python. I know I can get that to work the way I want regardless if it's for Mac or Windows. LiveCode makes it easy to work with external resources, so I'm thinking Python is the best bet here. Thanks again. As long as we're talking Python, I got it handled.