Change Desktop Background

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
sanoski
Posts: 25
Joined: Sun Jan 25, 2009 10:09 am

Change Desktop Background

Post by sanoski » Sun Sep 04, 2011 11:04 pm

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.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Change Desktop Background

Post by Mark » Mon Sep 05, 2011 1:21 am

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7392
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Change Desktop Background

Post by jacque » Mon Sep 05, 2011 6:54 am

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Change Desktop Background

Post by Mark » Mon Sep 05, 2011 9:17 am

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Klaus
Posts: 14196
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Change Desktop Background

Post by Klaus » Mon Sep 05, 2011 11:45 am

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

sanoski
Posts: 25
Joined: Sun Jan 25, 2009 10:09 am

Re: Change Desktop Background

Post by sanoski » Wed Sep 07, 2011 4:40 am

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.

Post Reply