errors
cmd: python roblox-script.py model.fbx
Traceback (most recent call last):
File "D:\Users\soubhagya\Desktop\aws-vdm\roblox-script.py", line 43, in <module>
insX, insY = pyautogui.locateCenterOnScreen('name-input.png', confidence=0.9)
File "D:\Users\soubhagya\AppData\Local\Programs\Python\Python310\lib\site-packages\pyautogui\__init__.py", line 175, in wrapper
return wrappedFunction(*args, **kwargs)
File "D:\Users\soubhagya\AppData\Local\Programs\Python\Python310\lib\site-packages\pyautogui\__init__.py", line 207, in locateCenterOnScreen
return pyscreeze.locateCenterOnScreen(*args, **kwargs)
File "D:\Users\soubhagya\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreeze\__init__.py", line 413, in locateCenterOnScreen
coords = locateOnScreen(image, **kwargs)
File "D:\Users\soubhagya\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreeze\__init__.py", line 372, in locateOnScreen
screenshotIm = screenshot(region=None) # the locateAll() function must handle cropping to return accurate coordinates, so don't pass a region here.
File "D:\Users\soubhagya\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreeze\__init__.py", line 145, in wrapper
return wrappedFunction(*args, **kwargs)
File "D:\Users\soubhagya\AppData\Local\Programs\Python\Python310\lib\site-packages\pyscreeze\__init__.py", line 457, in _screenshot_win32
im = ImageGrab.grab()
File "D:\Users\soubhagya\AppData\Local\Programs\Python\Python310\lib\site-packages\PIL\ImageGrab.py", line 46, in grab
offset, size, data = Image.core.grabscreen_win32(
OSError: screen grab failed
Python code
import pyautogui
import time
import tkinter as tk
import random, string
import requests
root = tk.Tk()
root.withdraw()
# print("mode_name", sys.argv[1])
def randomword(length):
letters = string.ascii_lowercase
return ''.join(random.choice(letters) for i in range(length))
gameName = randomword(10)
screenWidth, screenHeight = pyautogui.size()
currentMouseX, currentMouseY = pyautogui.position()
pyautogui.FAILSAFE=False
print('trying to open roblox studio...')
pyautogui.moveTo(41, 224, duration=2, tween=pyautogui.easeInOutQuad, )
pyautogui.doubleClick()
print('waiting for roblox to open')
time.sleep(15)
print('opening boilerplate...')
pyautogui.moveTo(410, 148, duration=2, tween=pyautogui.easeInOutQuad)
pyautogui.doubleClick()
time.sleep(15)
print('publish the sh...')
pyautogui.hotkey('alt', 'p')
time.sleep(5)
print('Add name...', gameName)
insX, insY = pyautogui.locateCenterOnScreen('name-input.png', confidence=0.9)
pyautogui.moveTo(insX, insY, duration=2, tween=pyautogui.easeInOutQuad)
pyautogui.doubleClick()
time.sleep(3)
pyautogui.hotkey('ctrl', 'a')
pyautogui.press('backspace')
pyautogui.typewrite(gameName)
time.sleep(15)
print('Click create...')
crtX, crtY = pyautogui.locateCenterOnScreen('create-btn.PNG', confidence=0.9)
pyautogui.moveTo(crtX, crtY, duration=2, tween=pyautogui.easeInOutQuad)
pyautogui.click()
time.sleep(15)
print('Set permissions...')
shrX, shrY = pyautogui.locateCenterOnScreen('share-btn.PNG', confidence=0.9)
pyautogui.moveTo(shrX, shrY, duration=2, tween=pyautogui.easeInOutQuad)
pyautogui.click()
time.sleep(3)
shrX, shrY = pyautogui.locateCenterOnScreen('game-settings.png', confidence=0.9)
pyautogui.moveTo(shrX, shrY, duration=2, tween=pyautogui.easeInOutQuad)
pyautogui.click()
time.sleep(10)
shrX, shrY = pyautogui.locateCenterOnScreen('permission.PNG', confidence=0.9)
pyautogui.moveTo(shrX, shrY, duration=2, tween=pyautogui.easeInOutQuad)
pyautogui.click()
time.sleep(10)
shrX, shrY = pyautogui.locateCenterOnScreen('save-btn.PNG', confidence=0.9)
pyautogui.moveTo(shrX, shrY, duration=2, tween=pyautogui.easeInOutQuad)
pyautogui.click()
time.sleep(10)
shrX, shrY = pyautogui.locateCenterOnScreen('share-btn.PNG', confidence=0.9)
pyautogui.moveTo(shrX, shrY, duration=2, tween=pyautogui.easeInOutQuad)
pyautogui.click()
time.sleep(3)
shrX, shrY = pyautogui.locateCenterOnScreen('copy-btn.png', confidence=0.9)
pyautogui.moveTo(shrX, shrY, duration=2, tween=pyautogui.easeInOutQuad)
pyautogui.click()
time.sleep(3)
I have written one script which will automaticall open roblox application and run the model
When i run the script manually it is working fine when i run using cronjob It is giving avove error.
please take a look.
It is giving OS error maybe some permission issue or something. Please check