|
#1
| ||||
| ||||
| A script. A script for fun I say. Help me write it. I would like to write a script. Either AppleScript or a Shell Script. Whichever is more convenient. That will be run at login. What it will do is randomly pick a file from a specified folder, copy it to a certain directory and rename it to a certain name. To clarify, it will pick a JPG file from a folder of JPG's at random, and copy it to the "Desktop Pictures" folder and rename it "Aqua Blue.jpg". What this will do is every time I log out, I will have a different login desktop picture. I'd probably use AppleScript but I'd be calling Shell commands from it for stuff like the copy and rename part. All I need to know basically is how do I randomly pick a file via AppleScript or the such? This Script will only run once per login then quit when it's done obviously. I just need the one critical part. The file selection. I wanna do it all without having to have the script open folders and select files. I want it all in the background at the beginning of my session. One time thing. Thanks.
__________________ Confucious Say: Jasoco, change your gosh darn SIGNATURE! it's been like that forever! Never disobey Confucious. Jasoco.net - GeekPub Forums |
|
#2
| |||
| |||
| Erm - what version of OS X are you running? You can do this in the prefs on Jaguar - you can set how often the bg image rotates - from once every 5secs (!) to once per login. Is that what you want?
__________________ PowerMac G5 Dual 2ghz + PowerMac G3 300mhz + iBook 800mhz + 15gb iPod + OS X 10.4.x + Me = Happy |
|
#3
| ||||
| ||||
| If you want to use AppleScript, that would be simple, wouldn't it? Just record it! Oooohh, I forgot about that 'random' part... hmmmm
__________________ < Also Known As aeromusek in places > < PowerBook | 1.67GHz | 1024MB RAM | 120GB | 17" High Res > < iPod | 20GB | 3rd gen > "the show must go on" - the artists of the world |
|
#4
| ||||
| ||||
| well, from a shell script point of view: set num_files = `ls | wc -l` set the_file = `jot -r 1 1 ${num_files}` set the_file_name = `ls | sed -n ${the_file}p` ln -s ${the_file_name} "Desktop Pictures/Aqua Blue.jpg" would do it
__________________ What is the robbing of a bank compared to the founding of a bank? -- Bertold Brecht |
|
#5
| ||||
| ||||
| NO NO NO. Goynag. The LOGIN screen. Not the Desktop! I already have my desktop rotating. I want the Login to do it too and I wanted to do it in a fun way. So I wanna make a script. Hone my scripting skillz. I just need to be able to randomly choose a file at random. Randomly. That's the only part I need to know. How do I create a Shell Script, scruffy? Just make a file with the text? What do I do? You can give me code, but I need to know where to put it. And can I call it from AppleScript? Thanks.
__________________ Confucious Say: Jasoco, change your gosh darn SIGNATURE! it's been like that forever! Never disobey Confucious. Jasoco.net - GeekPub Forums |
|
#6
| ||||
| ||||
| Well, the shell scripts are easy to make, but you can't have them running automatically at login via the login items, so an Applescript would probably be easier to do. Well, you could make the shell script then write an applescript to run that shell script, then you could have that applescript run when you log in, but that seems overkill to me. ![]()
__________________ I am but a lonely shadow, Doomed forever to roam and wander. But if you allow me to pause before I must go, I'll spin you tales of mystery and wonder. Site: Night Productions |
|
#7
| |||
| |||
| no you can make it run automatically at login via login items!! i read it somewhere. it is possible. |
|
#8
| ||||
| ||||
| Either way, what do I use to create the shell script? Where do I save it and how do I call it from AppleScript, if it can't be run at login? If it can, even better. I just need to know how to create the script. Pico or something?
__________________ Confucious Say: Jasoco, change your gosh darn SIGNATURE! it's been like that forever! Never disobey Confucious. Jasoco.net - GeekPub Forums |
![]() |
| Thread Tools | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [HOWTO] - Use niutil | gatorparrots | HOWTO & FAQs | 6 | December 10th, 2002 04:24 PM |
| Proper way to write and execute a terminal script? | michaelsanford | Unix & X11 | 2 | November 8th, 2002 08:24 AM |
| Getting a CGI script to work locally on my Mac | simX | Mac OS X System & Mac Software | 11 | July 12th, 2002 02:43 PM |
| HOW TO STOP SPAM -- join the fight! | GadgetLover | Apple News, Rumors & Discussion | 11 | April 11th, 2002 03:52 PM |
| AppleScript front end to a shell script? | meancode | Mac OS X System & Mac Software | 0 | March 17th, 2002 09:25 PM |