Skip to content

Instantly share code, notes, and snippets.

View m0pfin's full-sized avatar
:octocat:
Working from home

m0pfin

:octocat:
Working from home
View GitHub Profile
@m0pfin
m0pfin / setNameProfile
Created May 6, 2020 01:30
AppleScript
-- Устанавливаем название и копируем в буффер обмена
set nameProfile to "Auto_"
set numberProfile to (current date) as text
set the clipboard to nameProfile & numberProfile
@m0pfin
m0pfin / copyTextToFile
Last active May 6, 2020 01:36
AppleScript
-- Выбираем файл
-- И копирует содержимое файла
set fileCards to "~/applescript/acc.txt"
set theText to read fileCards
set theTextList to paragraphs of theText
@m0pfin
m0pfin / keyEmulator
Last active May 6, 2020 10:08
AppleScript
-- Эмулятор клавиатуры на AppleScript: CMD+T
-- В данном примере запускает Хром и открываем новую вкладку
tell application "Google Chrome" to activate
tell application "System Events" to key code 17 using command down
delay 0.9
@m0pfin
m0pfin / tokenExtractSafari
Created May 8, 2020 08:18
AppleScript (P.S - Thx Adam JS love))
tell application "Safari"
tell window 1
set current tab to make new tab with properties {URL:"https://facebook.com/adsmanager"}
delay 5
end tell
do JavaScript "var re = new RegExp('access_token\"?:\"(.*?)\"');
var m = document.documentElement.innerHTML.match(re);
function copyToClipboard(text){
var copytext=document.createElement('input')
@m0pfin
m0pfin / tokenExtractIndigo
Created May 8, 2020 11:28
AppleScript - на автомате достаём токен в буффер обмена из INDIGO на MacOS
-- Достаём токен из AdsManager FB, в INIDGO
set myLink to "https://facebook.com/adsmanager"
tell application "Chromium"
activate
open location myLink
delay 5
execute active tab of window 1 javascript "var re = new RegExp('access_token\"?:\"(.*?)\"');
var m = document.documentElement.innerHTML.match(re);
@m0pfin
m0pfin / readFileInLine
Created May 14, 2020 00:11
AppleScript - читаем файл построчно и копируем в буффер обмена
# Determine the input file's path.
set srcFile to ((path to desktop) as text) & "myFile.txt"
# Read lines from file.
set lns to paragraphs of (read file srcFile as «class utf8»)
# Loop over lines read and copy each to the clipboard.
repeat with ln in lns
set the clipboard to ln
display alert (the clipboard)
@m0pfin
m0pfin / addAccFBtool
Created May 18, 2020 17:45
AppleScript
-- Добавляем токен в ФБтул
set token to (the clipboard)
do shell script "curl --location --request POST 'https://fbtool.pro/api/add-account?key=API_KEI_FBTOOL' --form 'token=" & token & "' --form 'name=Auto' --form 'group=ID_GOUP'"
-- Достаём токен из AdsManager FB, в INIDGO
set myLink to "https://facebook.com/adsmanager"
tell application "Chromium"
activate
open location myLink
delay 5
execute active tab of window 1 javascript "var re = new RegExp('access_token\"?:\"(.*?)\"');
var m = document.documentElement.innerHTML.match(re);
@m0pfin
m0pfin / alertOffInIndigo
Created May 18, 2020 21:06
AppleScript
-- Отключаем уведомления в аккаунте
set myLink to "https://facebook.com/adsmanager"
tell application "Chromium"
activate
delay 2
execute active tab of window 1 javascript "var rsa = new RegExp('selected_account_id\"?:\"(.*?)\"');
var msa = document.documentElement.innerHTML.match(rsa);
@m0pfin
m0pfin / createAd.php
Created June 9, 2020 14:29
FbCreateAd
<?php
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* You are hereby granted a non-exclusive, worldwide, royalty-free license to
* use, copy, modify, and distribute this software in source code or binary
* form for use in connection with the web services and APIs provided by
* Facebook.
*
* As with any software that integrates with the Facebook platform, your use