Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Posted in: Widget Development

Hide the Dashboard, and other funky quirks associated

Author Message
Joel



Joined: 05 May 2005
Posts: 18

Posted: Thu May 05, 2005 - 9:16 pm    Post subject: Hide the Dashboard, and other funky quirks associated Reply with quote

Well, one of the functions of my developing widget is to automatically copy and paste a resulting output into whatever the open application is. I'm accomplishing this using applescript code, which has no problem. The thing is, the code to paste is a direct call to the application, which has to be active to recieve it. The dashboard being in the way stops that, so I am trying to find a way to dismiss the dashboard layer.

I figured, if I use widget.openApplication(current active app), that should work. It'll get rid of the dashboard, leaving me with whatever the old active app was, ready for paste. In order to get the current active app's bundle ID, I'm using another Applescript:
Code:
on run
   tell application "Finder"
      set Bundle to bundle identifier of (info for (path to frontmost application))
return quoted form of Bundle
   end tell
end run


I then set that output to my variable AppBundleID. Doing an alert(AppBundleID) gives me the correct result, for instance com.apple.TextEdit . Heres where my problems begin.

If I try to do then widget.openApplication(AppBundleID);, it fails. No errors int he console, widget doesn't crash, it simply doesn't open it. The rest of my code (the copying and pasting) sitll runs, just no hiding of the dashboard, so the pasting doesn't actually happen. But, check this out.

If I do widget.openApplication("com.apple.TextEdit"), it works fine. If I do
Code:
AppBundleID = "com.apple.TextEdit";
widget.openApplication(AppBundleID);
it also works fine. But, doing widget.openApplication(AppBundleID) with the result from my earlier bundle id fails. In every measure of it, that failing variable is a valid string. I can alert() it. I can set .values of my text boxes to it. I've tried counting the characters using the applescript before it returns it, theres nothing hidden. I've tried using a for loop to take each character and add it to a new blank string, failed. I'm really quite lost.

I was also looking at that aformentioned 4K limit. Though it doesn't apply here (this gives me output, just a bit funky), I definitely need to take that into account for another widget.system call I do.

So, in conclusion... anybody have any ideas what's causing this failure? Alternatively, if you have another better idea to just hide the dashboard, I'm all for it, though I am still curious why this doesn't work. Note, doing the manual widget.openApplication("com.apple.TextEdit") still works even if TextEdit is frontmost. It doesn't have to do with the fact that it wouldn't be changing frontmost processes.

PS: If my explanation is a bit too confusing, or you can't reproduce it, I'll post some more complete code, if people ask.
View user's profile Send private message Send e-mail Widgets
Chris



Joined: 27 Jan 2005
Posts: 344
Location: Durham, UK

Posted: Fri May 06, 2005 - 7:08 am    Post subject: Reply with quote

When things are echoed back from widget.system there's a trailing newline character - maybe that's what's causing the problem?
View user's profile Send private message Send e-mail Visit poster's website AIM Address Widgets
Joel



Joined: 05 May 2005
Posts: 18

Posted: Fri May 06, 2005 - 8:14 am    Post subject: Reply with quote

Great, that seems to fix it. Funny how such a frustrating problem can be caused be a hidden newline character at the end. Also funny how every other method I used to display it doesn't show newlines.
View user's profile Send private message Send e-mail Widgets
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

 
Powered by phpBB © 2001, 2002 phpBB Group