BrakeZ Posted October 20, 2018 Share Posted October 20, 2018 Hi. I have some trouble figuring out how to launch an application when my profile goes live. I have made it so my profiles switch when i open games. I also want to execute an .exe file and have it play a sound so i know, with the profile. However the 'Launch application' option wants me to bind it to a key and not my profile. Is there a way to bind it to a profile instead? Thanks for any help in advance. Link to comment Share on other sites More sharing options...
hastegag Posted October 21, 2018 Share Posted October 21, 2018 Icue without the sdk running only can play sounds and run an Exe on keypress unless I am missing something?? You can setup a single play through lighting effect on profile start. If you really need it I can walk you through setting up the sdk to do something on profile change? It uses processor cycles as you need to poll for the color of a key and wrote some logic to do something when it changes. An easier method may be what solarity wrote, a power shell script that polls for an xml file someplace in the cue folders which I think gets the active profile as well. The ps script can certainly run an exe and playing a sound can get done several ways. Link to comment Share on other sites More sharing options...
solarity Posted October 22, 2018 Share Posted October 22, 2018 Icue without the sdk running only can play sounds and run an Exe on keypress unless I am missing something?? You can setup a single play through lighting effect on profile start. If you really need it I can walk you through setting up the sdk to do something on profile change? It uses processor cycles as you need to poll for the color of a key and wrote some logic to do something when it changes. An easier method may be what solarity wrote, a power shell script that polls for an xml file someplace in the cue folders which I think gets the active profile as well. The ps script can certainly run an exe and playing a sound can get done several ways. The script I wrote didn't sync directly to iCUE it would watch for the same process to run that icue monitors for changing the profile. Then it would load up RGB Profile for RGB Fusion. Link to comment Share on other sites More sharing options...
hastegag Posted October 23, 2018 Share Posted October 23, 2018 The script I wrote didn't sync directly to iCUE it would watch for the same process to run that icue monitors for changing the profile. Then it would load up RGB Profile for RGB Fusion. Ahh, cool I think I understand it better now, it would effect your motherboards RGB headers by matching running processes. Cool beans! PS I see you are in Rottenchester - I grew up there, I'm a couple hundred miles from you, but next time I am invited to a lan i'll pm you! I just tried to take a stab at helping this OP out by taking my highly specific approach and making it more abstract and dynamic allowing arguments to pass in and then poll for the active profile, but I realized that's ... more complex than just walking someone through coding their own logic to get it done. here is a dumbed down version of the register callback example from the SDK which works to poll the active profile in icue but would require a single key someplace be a solid, static color: // register_callback.cpp : Defines the entry point for the console application. // #ifdef __APPLE__ #include <CUESDK/CUESDK.h> #else #include <CUESDK.h> #endif #include <cstdio> #include <iostream> #include <fstream> #include <string> #include <chrono> #include <thread> #include <windows.h> #include <unordered_map> #include <WinBase.h> extern int currentProfile; int currentProfile = 999; struct Context { CorsairKeyId m_lastPressedKey; }; const std::unordered_map<CorsairKeyId, std::string> keyIdStrings = { {CorsairKey_Invalid, "CorsairKey_Invalid"}, {CorsairKeyKb_G1, "CorsairKeyKb_G1"}, {CorsairKeyKb_G2, "CorsairKeyKb_G2"}, {CorsairKeyKb_G3, "CorsairKeyKb_G3"}, {CorsairKeyKb_G4, "CorsairKeyKb_G4"}, {CorsairKeyKb_G5, "CorsairKeyKb_G5"}, {CorsairKeyKb_G6, "CorsairKeyKb_G6"}, {CorsairKeyKb_G7, "CorsairKeyKb_G7"}, {CorsairKeyKb_G8, "CorsairKeyKb_G8"}, {CorsairKeyKb_G9, "CorsairKeyKb_G9"}, {CorsairKeyKb_G10, "CorsairKeyKb_G10"}, {CorsairKeyKb_G11, "CorsairKeyKb_G11"}, {CorsairKeyKb_G12, "CorsairKeyKb_G12"}, {CorsairKeyKb_G13, "CorsairKeyKb_G13"}, {CorsairKeyKb_G14, "CorsairKeyKb_G14"}, {CorsairKeyKb_G15, "CorsairKeyKb_G15"}, {CorsairKeyKb_G16, "CorsairKeyKb_G16"}, {CorsairKeyKb_G17, "CorsairKeyKb_G17"}, {CorsairKeyKb_G18, "CorsairKeyKb_G18"}, {CorsairKeyMouse_M1, "CorsairKeyMouse_M1"}, {CorsairKeyMouse_M2, "CorsairKeyMouse_M2"}, {CorsairKeyMouse_M3, "CorsairKeyMouse_M3"}, {CorsairKeyMouse_M4, "CorsairKeyMouse_M4"}, {CorsairKeyMouse_M5, "CorsairKeyMouse_M5"}, {CorsairKeyMouse_M6, "CorsairKeyMouse_M6"}, {CorsairKeyMouse_M7, "CorsairKeyMouse_M7"}, {CorsairKeyMouse_M8, "CorsairKeyMouse_M8"}, {CorsairKeyMouse_M9, "CorsairKeyMouse_M9"}, {CorsairKeyMouse_M10, "CorsairKeyMouse_M10"}, {CorsairKeyMouse_M11, "CorsairKeyMouse_M11"}, {CorsairKeyMouse_M12, "CorsairKeyMouse_M12"} }; const std::unordered_map<CorsairKeyId, CorsairLedId> keyIdToLedId = { {CorsairKey_Invalid, CLI_Invalid}, {CorsairKeyKb_G1, CLK_G1}, {CorsairKeyKb_G2, CLK_G2}, {CorsairKeyKb_G3, CLK_G3}, {CorsairKeyKb_G4, CLK_G4}, {CorsairKeyKb_G5, CLK_G5}, {CorsairKeyKb_G6, CLK_G6}, {CorsairKeyKb_G7, CLK_G7}, {CorsairKeyKb_G8, CLK_G8}, {CorsairKeyKb_G9, CLK_G9}, {CorsairKeyKb_G10, CLK_G10}, {CorsairKeyKb_G11, CLK_G11}, {CorsairKeyKb_G12, CLK_G12}, {CorsairKeyKb_G13, CLK_G13}, {CorsairKeyKb_G14, CLK_G14}, {CorsairKeyKb_G15, CLK_G15}, {CorsairKeyKb_G16, CLK_G16}, {CorsairKeyKb_G17, CLK_G17}, {CorsairKeyKb_G18, CLK_G18}, {CorsairKeyMouse_M1, CLM_1}, {CorsairKeyMouse_M2, CLM_2}, {CorsairKeyMouse_M3, CLM_3}, {CorsairKeyMouse_M4, CLM_4}, {CorsairKeyMouse_M5, CLM_5}, {CorsairKeyMouse_M6, CLM_6}, {CorsairKeyMouse_M7, CLK_A}, {CorsairKeyMouse_M8, CLK_B}, {CorsairKeyMouse_M9, CLK_C}, {CorsairKeyMouse_M10, CLK_D}, {CorsairKeyMouse_M11, CLK_E}, {CorsairKeyMouse_M12, CLK_F} }; const char* toString(CorsairError error) { switch (error) { case CE_Success : return "CE_Success"; case CE_ServerNotFound: return "CE_ServerNotFound"; case CE_NoControl: return "CE_NoControl"; case CE_ProtocolHandshakeMissing: return "CE_ProtocolHandshakeMissing"; case CE_IncompatibleProtocol: return "CE_IncompatibleProtocol"; case CE_InvalidArguments: return "CE_InvalidArguments"; default: return "unknown error"; } } int profileGetter(CorsairLedColor ledColor) { if (ledColor.r == 20 && ledColor.b == 0) { currentProfile = 0; } else if (ledColor.r == 238 && ledColor.b == 255) { currentProfile = 1; } else if (ledColor.r == 155 && ledColor.g == 255 && ledColor.b == 0) { currentProfile = 2; } else if (ledColor.r == 43) { currentProfile = 3; } else if (ledColor.r == 98 && ledColor.g == 255) { currentProfile = 4; } else if (ledColor.b == 1) { currentProfile = 5; } else if (ledColor.g == 13 && ledColor.b == 60) { currentProfile = 6; } else if (ledColor.r == 53 && ledColor.b == 255) { currentProfile = 7; } else if (ledColor.r == 255 && ledColor.b == 165) { currentProfile = 8; } else if (ledColor.r == 255 && ledColor.g == 170 && ledColor.b == 0) { currentProfile = 9; } else if (ledColor.g == 255) { currentProfile = 10; } else { } return currentProfile; } void otherCallBack() { auto ledId = CLK_Q; CorsairLedColor ledColor = {ledId, 0, 0, 0}; CorsairGetLedsColors(1, &ledColor); currentProfile = profileGetter(ledColor); } //(int argc, char** argv) //that was the typical input for the function but i realized it is complicated depending on what users would need to do int main() { using namespace std::chrono_literals; currentProfile = 999; CorsairPerformProtocolHandshake(); std::ofstream myfilea; myfilea.open("Profile.txt"); myfilea << ¤tProfile; myfilea.close(); //the above allows you to poll it in autohotkey which does much magic if you like and prevents multiple harddrive writes if (const auto error = CorsairGetLastError()) { std::cout << "Handshake failed: " << toString(error) << "\nPress any key to quit." << std::endl; getchar(); return -1; } //std::cout << "Working... Press \"q\" to close program...\n"; //could do a q poll via getkeystate but op will have qs while (true) { std::this_thread::sleep_for(1s); //every one second check for the profile and then update the variable //int arg1 = std::stoi(argv[1]); //CorsairLedColor ledId = arg1; //even if we sort the enum, it gets complex since people would need to provide a lot of input accurately, give up //was going to pass in CorsairLedId ledId otherCallBack(); std::cout << "Profile is: " << currentProfile << std::endl; //std::cout << "First Argument sent in " << argv[1] << " second argument sent in: " << argv[2] << std::endl << std::endl; } return 0; } Users would need to install SDK, modify their logic in the profilegetter to match the color on a key and then they can either perform external effects immediately inside the logic or just save the current profile to a variable in memory and read it elsewhere (what i do) and then test for it or do something when it changes. Link to comment Share on other sites More sharing options...
Comet 1626864951 Posted October 30, 2018 Share Posted October 30, 2018 Hi. I have some trouble figuring out how to launch an application when my profile goes live. I have made it so my profiles switch when i open games. I also want to execute an .exe file and have it play a sound so i know, with the profile. However the 'Launch application' option wants me to bind it to a key and not my profile. Is there a way to bind it to a profile instead? Thanks for any help in advance. Create a batch file that opens your game AND executes your secondary file. Link to comment Share on other sites More sharing options...
hastegag Posted October 30, 2018 Share Posted October 30, 2018 That’s a great idea but op can’t run bat file in profile change as I understand it only once if they ran a game or application. What if they alt tabbed etc Link to comment Share on other sites More sharing options...
Recommended Posts