Kaba Posted September 3, 2011 Share Posted September 3, 2011 Hi, I'm very new to Autoit and I regret asking a such certainly simple question. But as after a long research I didn't find an answer to my question I decided to ask it here in the forum. What I would like to know is if it is possible to store sevaral values parallelly in the clipboard as one can do with arrays. Array example: Dim $Array[3] $Array[0] = 100 $Array[1] = 200 $Array[2] = 200 Can the clipboard be used that way as well? Kaba Link to comment Share on other sites More sharing options...
somdcomputerguy Posted September 3, 2011 Share Posted September 3, 2011 I am using code like this to copy to the clipboard several, actually 3, times. I think this is what you want, maybe this'll help. For $n = 0 To 2 While 1 Switch $n Case 0 ToolTip(" Copy the Username ") If ClipGet() <> "" Then $ClipVar[0] = ClipGet() ClipPut("") ExitLoop ; from the While, to the Next $n EndIf Case 1 ToolTip(" Copy the Email address ") If ClipGet() <> "" Then $ClipVar[1] = ClipGet() ClipPut("") ExitLoop ; from the While, to the Next $n EndIf Case 2 ToolTip(" Copy the IP ") If ClipGet() <> "" Then $ClipVar[2] = ClipGet() ClipPut("") ExitLoop ; from the While, to the Next $n EndIf EndSwitch Sleep(50) WEnd Next - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Kaba Posted September 3, 2011 Author Share Posted September 3, 2011 Hi Bruce thank you very much for your quick reply. Hm, actually what I would like to use the cipboard for is to share information between two different applications. That means that I would like to make application A read a clipboard "array" filled with information by application B. At the same time I would like to let to application B the possibility to put information to the clipboard without overwriting the information from application B. Kind of as if evey application has its own channel that is read by the other one. Sorry, I should have been more precise in my initial post. Kaba Link to comment Share on other sites More sharing options...
somdcomputerguy Posted September 3, 2011 Share Posted September 3, 2011 After I ClipGet() to (in my case) three distinct variables, then I ControlSend() those variables into another app. I'm certain what you're trying to accomplish can be done, I am having some difficulty seeing your picture though. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Kaba Posted September 3, 2011 Author Share Posted September 3, 2011 Yes, an example will make it more clear. I'm trying to figure out the best way to trigger from application A an action in application B. My trigger: expandcollapse popupHotKeySet("{ESC}", "MyExit") ;;TRIGGER #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $GUI = GUICreate("Trigger", 250, 200) $ButtonTrigger = GUICtrlCreateButton("Trigger Job", 10, 10, 150) $Radio1 = GUICtrlCreateRadio ( "Feed your hamster.", 25, 50, 150 ) $Radio2 = GUICtrlCreateRadio ( "Help an old lady.", 25, 90, 150 ) $Radio3 = GUICtrlCreateRadio ( "Clean the cat litter pin.", 25, 130, 150 ) GUICtrlSetState($radio2, $GUI_CHECKED) $Label = GUICtrlCreateLabel("Jobs to do: ",10,200,500) GUISetState(@SW_SHOW) $TaskNb = 1 $Line = 1 IniWrite("Trigger.ini","Tasks", "ToDo", "0") While 1 $Msg = GUIGetMsg() Select Case $Msg = $GUI_EVENT_CLOSE IniWrite("Trigger.ini","Tasks", "ToDo", "0") IniWrite("Trigger.ini","Tasks", "Done", "0") IniDelete("Jobs.ini", "Job") Exit Case $Msg = $ButtonTrigger WriteIniTaskNb() WriteIniJob() $ReadIniTodo = IniRead("Trigger.ini", "Tasks", "ToDo", "") guictrlsetdata($Label, "Jobs to do: " & $ReadIniTodo) EndSelect WEnd Func WriteIniTaskNb() IniWrite("Trigger.ini","Tasks", "ToDo", $TaskNb) $TaskNb = $TaskNb + 1 EndFunc Func WriteIniJob() $Job1 = GUICtrlRead($radio1) $Job2 = GUICtrlRead($radio2) $Job3 = GUICtrlRead($radio3) If $Job1 = $GUI_CHECKED Then IniWrite("Jobs.ini", "Job", $Line, "Feed your hamster.") ElseIf $Job2 = $GUI_CHECKED Then IniWrite("Jobs.ini", "Job", $Line, "Help an old lady.") ElseIf $Job3 = $GUI_CHECKED Then IniWrite("Jobs.ini", "Job", $Line, "Clean the cat litter pin.") EndIf $Line = $Line + 1 EndFunc Func MyExit() Exit EndFunc and my Executor: expandcollapse popupHotKeySet("{ESC}", "MyExit") ;;EXECUTOR #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $GUI = GUICreate("Executor", 370, 150) $Label = GUICtrlCreateLabel("Jobs to do: " & " Jobs done: ",10,10,350) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Select Case $Msg = $GUI_EVENT_CLOSE Exit EndSelect $ReadIniTodo = IniRead("Trigger.ini", "Tasks", "ToDo", "") $ReadIniDone = IniRead("Trigger.ini", "Tasks", "Done", "") $Done = $ReadIniDone $Todo = $ReadIniTodo guictrlsetdata($Label, "Jobs to do: " & $ReadIniTodo & " Jobs done: " & $ReadIniDone) If $Done < $ReadIniTodo Then While $Done < $ReadIniTodo $ReadIniTodo = IniRead("Trigger.ini", "Tasks", "ToDo", "") $ReadIniDone = IniRead("Trigger.ini", "Tasks", "Done", "") guictrlsetdata($Label, "Jobs to do: " & $ReadIniTodo & " Jobs done: "&$ReadIniDone) $Line = $ReadIniDone + 1 $Job = IniRead("Jobs.ini", "Job", $Line, "") MsgBox(262144,"Doing job","I'm doing job " & $Line & " = "& $Job) $Done = $Done +1 IniWrite("Trigger.ini","Tasks", "Done", $Done) WEnd EndIf sleep(200) WEnd Func WriteIni() IniWrite("Trigger.ini","Tasks", "ToDo", $TaskNb) $TaskNb = $TaskNb + 1 EndFunc Func MyExit() Exit EndFunc At the moment I'm using Ini files in order to send the jobs from application A to B. But this seems to be at bit risky to me. That's why I would like to use the clipboard but without the risk that is could be overwritten by an othher application in the meantime. Kaba Link to comment Share on other sites More sharing options...
somdcomputerguy Posted September 3, 2011 Share Posted September 3, 2011 Oh, the picture becomes fuzzier.. I think I misunderstood your intended objective here. See, I use my code to manually copy to the clibboard three different pieces of information from one app and paste it all into another app. Technically, I use ControlSend, not ClipPut(), so I'm not really 'pasting', I'm just using that word. But I can do this all at once, without having to switch back and forth three times. Try searching thru the forums, with 'pass information' as keywords. Also, using the Command Line parameters comes to mind as a way to pass information from one app to another. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Kaba Posted September 4, 2011 Author Share Posted September 4, 2011 Ok, I'll do that. Thank you for your help. Link to comment Share on other sites More sharing options...
somdcomputerguy Posted September 4, 2011 Share Posted September 4, 2011 (edited) You bet, sorry I couldn't do more though. Good luck! Edited September 4, 2011 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. 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