iam4x / pokemongo-webspoof

👾 Play Pokémon Go from your Mac
2.14k stars 228 forks source link

[POC] Enhance autoclick.applescript #292

Open 0xWDG opened 7 years ago

0xWDG commented 7 years ago

Hi,

I'm not good with AppleScript, but enhancing it seems almost necessary

-- enhanced autoclick.applescript
-- Proof of concept
-- the script below this lines are not working.

tell application "System Events" to tell process "Xcode"    
    -- if the app is not running anymore, restart it!
    if (menu items of menu 1 of menu item "Simulate Location" of menu 1 of menu bar item "Debug" of menu bar 1) contains "pokemonLocation" then
        -- Click the "pokemonLocation" for updating the location
        click menu item "pokemonLocation" of menu 1 of menu item "Simulate Location" of menu 1 of menu bar item "Debug" of menu bar 1
        -- ^ this code works (original code) ^ --
    else
        -- Run (on iOS device)
        if available menu item "Run" of menu "Product" of menu bar item "Product" of menu bar 1 then
            click menu item "Run" of menu "Product" of menu bar item "Product" of menu bar 1
            -- ^ this code works ^ --
        end if
    end if
end tell

or

-- enhanced autoclick.applescript
-- Proof of concept
-- the script below this lines are not working.

tell application "System Events" to tell process "Xcode"    
    -- if the app is not running anymore, restart it!
    if (menu items of menu 1 of menu item "Simulate Location" of menu 1 of menu bar item "Debug" of menu bar 1) contains "pokemonLocation" then
        -- Click the "pokemonLocation" for updating the location
            click menu item "pokemonLocation" of menu 1 of menu item "Simulate Location" of menu 1 of menu bar item "Debug" of menu bar 1
    else
        -- Run (on iOS device)
        click menu item "Run" of menu "Product" of menu bar item "Product" of menu bar 1
    end if
end tell

-- do NOT stop building, just dismiss that window
tell application "System Events" to tell process "Xcode"
    if window contains "Stop “pokemon-webspoof”?" then
        click "Cancel"
    end if
end tell
iam4x commented 7 years ago

Thank's @wdg 🙏

I have no knowledge into AppleScript, make me a PR I will be pleased to merge it with any improvements 👍