gcue Posted November 10, 2010 Share Posted November 10, 2010 (edited) I am trying to monitor the clipboard on computer A and send it to computer B and vice versa. so im trying to monitor the clipboard and send it to the opposite pc... (image or text) im running across a problem with running a do until within the while loop. it never ends! id like to exit the do loop but stay within the while loop just in case something else is copied.. here's what i have so far: Local $iFormat, $iCount While 1 If Not _ClipBoard_Open(0) Then _WinAPI_ShowError("_ClipBoard_Open failed") Do $iFormat = _ClipBoard_EnumFormats($iFormat) If $iFormat <> 0 Then $iCount += 1 If StringInStr(_ClipBoard_FormatStr($iFormat), "Bitmap") <> 0 Then ClipboardIsImage() ExitLoop 1 EndIf If StringInStr(_ClipBoard_FormatStr($iFormat), "Text") <> 0 Then ClipboardIsText() ExitLoop 1 EndIf EndIf Until $iFormat = 0 _ClipBoard_Close() WEnd Edited November 10, 2010 by gcue Link to comment Share on other sites More sharing options...
supadodger Posted November 10, 2010 Share Posted November 10, 2010 (edited) Local $iFormat, $iCount While 1 If Not _ClipBoard_Open(0) Then _WinAPI_ShowError("_ClipBoard_Open failed") Do $iFormat = _ClipBoard_EnumFormats($iFormat) If $iFormat <> 0 Then $iCount += 1 If StringInStr(_ClipBoard_FormatStr($iFormat), "Bitmap") <> 0 Then ClipboardIsImage() $iFormat = 0 EndIf If StringInStr(_ClipBoard_FormatStr($iFormat), "Text") <> 0 Then ClipboardIsText() $iFormat = 0 EndIf EndIf Until $iFormat = 0 _ClipBoard_Close() WEnd seems like that should work... Edited November 10, 2010 by supadodger Link to comment Share on other sites More sharing options...
gcue Posted November 10, 2010 Author Share Posted November 10, 2010 unfortunately, it doesn't =/ Link to comment Share on other sites More sharing options...
MvGulik Posted November 11, 2010 Share Posted November 11, 2010 Why do you think the do..until loop is never exiting? The logic of your code combined with the behavior of _ClipBoard_EnumFormats() will not allow the do..until loop to NOT exit. Or: the problem your having has a other reason. "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now