New topic: AppleScripting for WINDOWS?
<http://forums.realsoftware.com/viewtopic.php?t=29416> Page 1 of 1 [ 10 posts ] Previous topic | Next topic Author Message Jonathon Post subject: AppleScripting for WINDOWS?Posted: Wed Aug 05, 2009 7:47 pm Joined: Fri Sep 30, 2005 5:54 pm Posts: 1929 Location: Great Falls, Montana USA I am on Windows but I need to write an AppleScript into my project code. This is for a Backup/Restore method. This is in the Restore function as this will let the computer Auto-Restart! I have no clue as to AppleScripting. Here is the original post. joshmax wrote: wrote:Create an AppleScript file "Relaunch.scpt" with the following code: Code:tell application "Finder" delay 0.5 open container of container of container of (path to me) end tell Put the file in your app's resources folder. Put this is your code: Code:App.ExecutableFile.Parent.Parent.Child("Resources").Child("Relaunch.scpt").Launch Quit ________________ My other computer is a Mac Pro Any ideas on this one Mac dudes? _________________ Jonathon Software Devlopement: http://www.medalertpc.com Surplus Hardware: http://www.semielectronics.com RB2005 R4 Pro for Windows XP Pro/SP2 Top computerfreaker Post subject: Re: AppleScripting for WINDOWS?Posted: Wed Aug 05, 2009 7:56 pm Joined: Thu Mar 05, 2009 1:03 pm Posts: 1199 Location: USA Simple. Mac systems have a scripting app that will let you either A. create an AppleScript or B. record an AppleScript (tracks your actions, then generates appropriate AppleScript code). No Windows equivalent though, AFAIK... _________________ Learn something new every day, and the rest will take care of itself. Life is a journey, not a destination. Enjoy the trip! Top Jonathon Post subject: Re: AppleScripting for WINDOWS?Posted: Wed Aug 05, 2009 8:06 pm Joined: Fri Sep 30, 2005 5:54 pm Posts: 1929 Location: Great Falls, Montana USA computerfreaker wrote:Simple. Mac systems have a scripting app that will let you either A. create an AppleScript or B. record an AppleScript (tracks your actions, then generates appropriate AppleScript code). No Windows equivalent though, AFAIK...CF, I need this file so the Auto-Restart will work in Mac mode! Ahh... So now what will I do? double bummer _________________ Jonathon Software Devlopement: http://www.medalertpc.com Surplus Hardware: http://www.semielectronics.com RB2005 R4 Pro for Windows XP Pro/SP2 Top lenpartico Post subject: Re: AppleScripting for WINDOWS?Posted: Wed Aug 05, 2009 8:24 pm Joined: Fri Sep 30, 2005 10:49 pm Posts: 128 Hi Jonathon, VBscript is the Windows equivalent for Applescript Check this out http://snippets.dzone.com/posts/show/4431 Lennox Top Jason_Adams Post subject: Re: AppleScripting for WINDOWS?Posted: Wed Aug 05, 2009 8:56 pm Joined: Fri Nov 10, 2006 4:10 pm Posts: 489 I'm curious as to why you're asking this, Jonathan, would you mind elaborating on your purpose? I get the feeling you're going about something in a way that's more complicated then necessary. Are you saying you want to include Apple Script in your code, but you're compiling from a Windows machine? Or are you trying to find a Windows equivalent of what a particular snippet of Apple Script would accomplish? _________________ Vista Home Premium RB Pro 2009r3 "Christianity has not been tried and found wanting; it has been found difficult and not tried." - G.K. Chesterton Top Jonathon Post subject: Re: AppleScripting for WINDOWS?Posted: Wed Aug 05, 2009 9:12 pm Joined: Fri Sep 30, 2005 5:54 pm Posts: 1929 Location: Great Falls, Montana USA Jason_Adams wrote:I'm curious as to why you're asking this, Jonathan, would you mind elaborating on your purpose? I get the feeling you're going about something in a way that's more complicated then necessary. Are you saying you want to include Apple Script in your code, but you're compiling from a Windows machine? Or are you trying to find a Windows equivalent of what a particular snippet of Apple Script would accomplish?Jason, If you look at my original post, the mac code by joshmax shows how to do an auto-restart for macs. But I need to code that into my windows version of RB. The progam when compiled will work on all platforms. _________________ Jonathon Software Devlopement: http://www.medalertpc.com Surplus Hardware: http://www.semielectronics.com RB2005 R4 Pro for Windows XP Pro/SP2 Top dglass Post subject: Re: AppleScripting for WINDOWS?Posted: Wed Aug 05, 2009 11:47 pm Joined: Fri Sep 30, 2005 9:29 am Posts: 545 Location: California I'm having a hard time figuring out how the AppleScript code you provided would restart the computer. Seems like it would be simpler to do: Code: tell application "Finder" restart end tell Given that, you need to do one of the following: 1. Get somebody with a Mac to create the AppleScript .scpt file containing the above code and send it to you. Then, you should be able to include it in your app, and call it as a method (inside a #Target block, of course). 2. Figure out the actual AppleEvents generated by the AppleScript above, and use Rb's built-in AppleEvent class to send the AppleEvents directly. 3. Use the MBS REALbasic Mac Plugin's functions to compile the above code (which you would provide as text) and execute it directly from within your application. Top timhare Post subject: Re: AppleScripting for WINDOWS?Posted: Thu Aug 06, 2009 12:14 am Joined: Fri Jan 06, 2006 3:21 pm Posts: 6009 Location: Portland, OR USA I think he meant "restart the app", not the computer. Top dglass Post subject: Re: AppleScripting for WINDOWS?Posted: Thu Aug 06, 2009 12:23 am Joined: Fri Sep 30, 2005 9:29 am Posts: 545 Location: California His post says 'computer auto-restart', but even if it was restart the app, the original AppleScript doesn't seem to do that. Top timhare Post subject: Re: AppleScripting for WINDOWS?Posted: Thu Aug 06, 2009 12:32 am Joined: Fri Jan 06, 2006 3:21 pm Posts: 6009 Location: Portland, OR USA Whether it works or not, I cannot say, but it certainly looks like that is its intent. It waits half a second (to give the original process time to quit) and launches the app bundle. Besides, I recall the discussion it came from. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 10 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
