コード例 #1
0
int WinTrackEventListener::DoubleClickMouse()
{
	if (state == OFF)
		return 0;

	ClickMouse();
	ClickMouse();
	return 1;
}
コード例 #2
0
ファイル: HumanMouse.cpp プロジェクト: CynicRus/HumanMouse
extern "C" _declspec(dllexport) void __cdecl Mouse( int mousex, int mousey, int ranx, int rany, TClickType button )
{
  MMouse( mousex, mousey, ranx, rany );
  Sleep( 60 + rand()% 30);
  ClickMouse( button );
  Sleep( 50 + rand()% 50 );
}
コード例 #3
0
ファイル: MQ2Mouse.cpp プロジェクト: isxGames/ISXEQ
VOID Click(PSPAWNINFO pChar, PCHAR szLine) 
{ 
	if(GetGameState()!=GAMESTATE_INGAME) {
		MacroError("Dont /click stuff(%s) when not in game... Gamestate is %d",szLine,GetGameState());
		return;
	}
    CHAR szArg1[MAX_STRING] = {0}; 
    PCHAR szMouseLoc; 
    MOUSE_DATA_TYPES mdType = MD_Unknown; 
    DWORD RightOrLeft = 0; 

    GetArg(szArg1, szLine, 1); //left or right 
    szMouseLoc = GetNextArg(szLine, 1); //location to click 

    //parse location for click location (szMouseLoc) here 
    if (szMouseLoc && szMouseLoc[0]!=0) { 
        if (!strnicmp(szMouseLoc, "target", 6)) {
            if (!pTarget) { 
                WriteChatColor("You must have a target selected for /click x target.",CONCOLOR_RED); 
                return; 
            } 
            if (!strnicmp(szArg1, "left", 4)) { 
                pEverQuest->LeftClickedOnPlayer(pTarget); 
                gMouseEventTime = GetFastTime();
            } else if (!strnicmp(szArg1, "right", 5)) { 
                pEverQuest->RightClickedOnPlayer(pTarget, 0); 
                gMouseEventTime = GetFastTime();
            } 
            return;
        } else if(!strnicmp(szMouseLoc,"center",6)) {
            sprintf(szMouseLoc,"%d %d",ScreenXMax/2,ScreenYMax/2);
        } else if (!strnicmp(szMouseLoc, "item", 4)) {
			if(pGroundTarget) {
				if (!strnicmp(szArg1, "left", 4)) {
					if(EnviroTarget.Name[0]!=0) {
						if(DistanceToSpawn(pChar,&EnviroTarget)<=20.0f) {
							//do stuff
							if(PEQSWITCH pSwitch = (PEQSWITCH)pGroundTarget->pSwitch) {
								*((DWORD*)__LMouseHeldTime)=((PCDISPLAY)pDisplay)->TimeStamp-0x45;
								//we "click" at -1000,-1000 because we know the user doesnt have any windows there...
								//if its possible, i would like to figure out a pixel
								//on the users screen that isnt covered by a window...
								//the click need to be issued on the main UI...
								//but for now this will work -eqmule 8 mar 2014
								pEverQuest->LMouseUp(-1000,-1000);
							}
						} else {
							WriteChatf("You are to far away from the item, please move closer before issuing the /click left item command.");
						}
					} else {
						WriteChatf("No Item targeted, use /itemtarget <theid> before issuing a /click left item command.");
					}
				} else {
					WriteChatf("Invalid click args, use \"/click left item\", aborting: %s",szMouseLoc);
				}
			} else {
				WriteChatf("No Item targeted, use /itemtarget <theid> before issuing a /click left item command.");
			}
			return;
        } else if (!strnicmp(szMouseLoc, "door", 4)) {
			// a right clicked door spawn does nothing
			if(pDoorTarget) {
				if (!strnicmp(szArg1, "left", 4)) {
					if(DoorEnviroTarget.Name[0]!=0) {
						if(DistanceToSpawn(pChar,&DoorEnviroTarget)<20.0f) {
							EQSwitch *pSwitch = (EQSwitch *)pDoorTarget;
							srand((unsigned int)time(0));
							int randclickY = rand() % 5;
							int randclickX = rand() % 5;
							int randclickZ = rand() % 5;
							PSWITCHCLICK pclick = new SWITCHCLICK;
							if(pclick) {
								pclick->Y=pDoorTarget->Y+randclickY;
								pclick->X=pDoorTarget->X+randclickX;
								pclick->Z=pDoorTarget->Z+randclickZ;
								randclickY = rand() % 5;
								randclickX = rand() % 5;
								randclickZ = rand() % 5;
								pclick->Y1=pclick->Y+randclickY;
								pclick->X1=pclick->X+randclickX;
								pclick->Z1=pclick->Z+randclickZ;
								pSwitch->UseSwitch(GetCharInfo()->pSpawn->SpawnID,0xFFFFFFFF,0,(DWORD)pclick);
								delete pclick;
							}
							//DoorEnviroTarget.Name[0]='\0';
							if (pTarget==(EQPlayer*)&DoorEnviroTarget) {//this should NEVER happen
								pTarget=NULL;
							}
							return;
						} else {
							WriteChatf("You are to far away from the door, please move closer before issuing the /click left door command.");
						}
					} else {
						WriteChatf("No Door targeted, use /doortarget <theid> before issuing a /click left door command.");
					}
				} else {
					WriteChatf("Invalid click args, use \"/click left door\", aborting: %s",szMouseLoc);
				}
			} else {
				WriteChatf("No Door targeted, use /doortarget <theid> before issuing a /click left door command.");
			}
			return;;
		} 
        ClickMouseLoc(szMouseLoc, szArg1);
        return;
    }

    if (szArg1[0]!=0) { 
        if (!strnicmp(szArg1, "left", 4)) { 
            ClickMouse(0);
        } else if (!strnicmp(szArg1, "right", 5)) { 
            ClickMouse(1);
        } else { 
            WriteChatColor("Usage: /click <left|right>",USERCOLOR_DEFAULT); 
            DebugSpew("Bad command: %s",szLine); 
            return; 
        } 
    } 
}
コード例 #4
0
void App::Go()
{
    ofstream log("Log.txt");

    string defaultTitle = "Model name unknown";
    string defaultTags = "Component";

    vector<string> modelList = Utility::GetFileLines("StanfordSceneDBModels.txt", 3);
    for(const string &id : modelList)
    {
        string description = "This is a model re-uploaded to 3D Warehouse for the Stanford Scene Database.\nIf still available, the original model can be found at: http://sketchup.google.com/3dwarehouse/details?mid=" + id + "\nSee http://graphics.stanford.edu/projects/scenesynth/ for more information.";
        _skpFiles[id] = SkpFileInfo(id, "C:\\SceneModeling\\Database\\SketchUp\\" + id + ".skp", defaultTitle + ". ID=" + id, description, defaultTags);
    }

    vector<string> modelNames = Utility::GetFileLines("names.txt", 3);
    vector<string> modelTags = Utility::GetFileLines("tags.txt", 3);

    for(const string &s : modelNames)
    {
        vector<string> parts = Utility::PartitionString(s, "|");
        string id = parts[0];
        if(_skpFiles.find(id) != _skpFiles.end())
        {
            if(parts[1] == "*") parts[1] = "Unnammed model";
            _skpFiles[id].title = parts[1] + ". ID=" + parts[0];
        }
    }

    for(const string &s : modelTags)
    {
        vector<string> parts = Utility::PartitionString(s, "|");
        string id = parts[0];
        if(_skpFiles.find(id) != _skpFiles.end())
        {
            string tags;
            for(UINT i = 1; i < parts.size(); i++)
            {
                tags += parts[i] + ",";
            }
            if(tags.length() > 0)
            {
                tags.pop_back();
                _skpFiles[id].tags = tags;
            }
        }
    }

    //PartitionString(const string &s, const string &separator)

    //_skpFiles.push_back(SkpFileInfo("C:\\SceneModeling\\Database\\SketchUp\\1a0c94a2e3e67e4a2e4877b52b3fca7.skp", "TITLE A!!!! AN OBJECT!!!", "DESCRIPTION!!! Here is some stuff that is sort of long and convoluted.", "TAGS!!!! APPLE ORANGE COUCH POTATO RUBIK'S CUBE"));
    //_skpFiles.push_back(SkpFileInfo("C:\\SceneModeling\\Database\\SketchUp\\1a1a7da3b8028d19cb98ab132d4b77f1.skp", "TITLE B!!!! AN OBJECT!!!", "DESCRIPTION!!! Here is some stuff that is sort of long and convoluted.", "TAGS!!!! APPLE ORANGE COUCH POTATO RUBIK'S CUBE"));
    //_skpFiles.push_back(SkpFileInfo("C:\\SceneModeling\\Database\\SketchUp\\1a1cfc219ddbae7f86e0b9bedd915f08.skp", "TITLE C!!!! AN OBJECT!!!", "DESCRIPTION!!! Here is some stuff that is sort of long and convoluted.", "TAGS!!!! APPLE ORANGE COUCH POTATO RUBIK'S CUBE"));
    //_skpFiles.push_back(SkpFileInfo("C:\\SceneModeling\\Database\\SketchUp\\1a1ec1cfe633adcdebbf11b1629fc16a.skp", "TITLE D!!!! AN OBJECT!!!", "DESCRIPTION!!! Here is some stuff that is sort of long and convoluted.", "TAGS!!!! APPLE ORANGE COUCH POTATO RUBIK'S CUBE"));

    BlockOnKey(KEY_NUMPADADD);

    for(const auto &pair : _skpFiles)
    {
        const auto &s = pair.second;
        if(Utility::FileExists("uploaded/" + s.id + ".dat"))
        {
            log  << "Skipping " << s.id << endl;
            cout << "Skipping " << s.id << endl;
        }
        else
        {
            ofstream uploadFile(("uploaded/" + s.id + ".dat").c_str());
            //
            // TODO: check if already exported (probably by creating a dummy file when we successfully upload?
            //
            log  << "Uploading " << s.id << endl;
            cout << "Uploading " << s.id << endl;

            //
            // Load the filename to load onto the clipboard
            //
            CopyStringToClipboard(s.filename);
            SendKey(KEY_O, true, false);
            SendKey(KEY_V, true, false);
            SendKey(KEY_ENTER, false, false);
            Sleep(1000);

            log  << "Clearing annoying save dialog" << endl;
            cout << "Clearing annoying save dialog" << endl;
            SendKey(KEY_ENTER, false, false);

            log  << "Waiting for file load to finish" << endl;
            cout << "Waiting for file load to finish" << endl;
            Sleep(5000);

            SendKey(KEY_F, false, true);
            SendKey(KEY_3, false, false);
            SendKey(KEY_ENTER, false, false);
            SendKey(KEY_S, false, false);

            log  << "Clearing remove unused objects window" << endl;
            cout << "Clearing remove unused objects window" << endl;
            Sleep(1000);
            SendKey(KEY_ENTER, false, false);

            log  << "Saving model" << endl;
            cout << "Saving model" << endl;
            Sleep(1000);

            SendKey(KEY_S, true, false);

            SendKey(KEY_ENTER, false, false);

            log  << "Waiting for upload page to load" << endl;
            cout << "Waiting for upload page to load" << endl;
            Sleep(1000);

            log  << "Clicking to set focus on title" << endl;
            cout << "Clicking to set focus on title" << endl;
            ClickMouse(mouseXTitle, mouseYTitle);
            Sleep(1000);

            log  << "Inputting fields" << endl;
            cout << "Inputting fields" << endl;

            CopyStringToClipboard(s.title);
            SendKey(KEY_V, true, false);
            SendKey(KEY_TAB, false, false);

            CopyStringToClipboard(s.description);
            SendKey(KEY_V, true, false);
            SendKey(KEY_TAB, false, false);

            CopyStringToClipboard(s.tags);
            SendKey(KEY_V, true, false);
            SendKey(KEY_TAB, false, false);
            SendKey(KEY_TAB, false, false);

            Sleep(500);
            SendKey(KEY_ENTER, false, false);

            log  << "Waiting for upload to finish" << endl;
            cout << "Waiting for upload to finish" << endl;
            Sleep(30000);

            log  << "Exiting browser" << endl;
            cout << "Exiting browser" << endl;
            ClickMouse(mouseXClose, mouseYClose);
            Sleep(1000);

            if(GetAsyncKeyState(VK_ESCAPE))
            {
                BlockOnKey(KEY_NUMPADADD);
            }
        }
    }
}