Jump to content

Recommended Posts

Posted (edited)

I want to run this code on only my computer, if anyone copy this script file and trying to run it on his computer then don't run.

#include <IE.au3>
Local $oIE = _IEAttach ("Home")

$Dprintdetails1 = _IEGetObjById($oIE, "printdetails") ; get first object
$Dprintdetails1.id = "printdetails1" ; change it's id
$Dprintdetails = _IEGetObjById($oIE, "printdetails") ; get second object
$Dprintdetails.RemoveNode(True) ; remove it

exit

its possible ?

Edited by naru
Posted (edited)

Yes it is possible from multiple ways. 

 

You can implemente a password inside your script and ask the password when running the script. 

Something like 

$Key = "123456"

$Password = GuiCtrlCreateInput (..... 

GUICtrlRead ($Password)

If $Password = $Key Then
    ....MyStuff
EndIf

You can also restrict computer privilege and put at the top of your script #requireAdmin if you got the control of the computer. 

 

 

Edit: you need to explain the context a bit more. 

Will be on one computer with multiple users ? 

Will be on multiple computer with one user ?

...

 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Posted (edited)

So you're not clear enouth, I am sorry.

22 hours ago, naru said:

I want to run this code on only my computer,

 

20 minutes ago, naru said:

Computer name can change.

What the ... ?

 

Your computer name can change one time two time maybe but always changing ? Nop.

 

Get a good statement. And then we will be able to help you, explain everything in one time. 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Posted
11 minutes ago, caramen said:

So you're not clear enouth, I am sorry.

 

What the ... ?

 

Your computer name can change one time two time maybe but always changing ? Nop.

 

Get a good statement. And then we will be able to help you, explain everything in one time. 

@caramen

This script should run in my computer only, 

If someone tries to copy it and try to run it in his computer, It should be not run in his computer.

(The computer name is not mine, but if someone can copy this file, He was also able to read my computer name and set as same.)

*I hope you will understand my bad english

Posted (edited)

Now it's better yeah. 

 

So we have to find what wont change. Or make somthing that will be missing from other computer. 

 

I got a solution for you. If you know how to manipulate the registry. You can simply make a key on your computer manually. 

You can do it yourself with:

W + R Then CMD Then Regedit

Or with AutoIT

With RegWrite 

 

And then check with your script if the key exists. If it does not exists then your script exit. 

And you wont need to enter a password. And also if you are alone to know where the script is checking this is pretty safe for you.

 

This is the logic help. 

If you need help with some code post the code of what you tryed first. 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Posted

@caramen, How to do it ? I don't know about its,

i think one another way is verify the serial number of computer then run the code, can you tell me how to check computer serial number using autoit?

Posted

It is also in the registry so you 're lucky. Let me prepare a code to learn you the registry basics.

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Posted

If i remember @Subz but i am  not sure made this little code for me some time ago. 

ConsoleWrite(_RegKeyExists("HKCU\Control Panel\Accessibility\Off") & @CRLF)
ConsoleWrite(_RegKeyExists("HKCU\Control Panel\Accessibility\On") & @CRLF)
ConsoleWrite(_RegKeyExists("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Au3Info.exe") & @CRLF)

Func _RegKeyExists($_sRegKey)
    Local $sDefault = RegRead($_sRegKey, "") ;~ Try to read default value
    Switch @error
        Case 1, 2
            ;~ Unable to open requested key | Unable to open requested main key
            Return SetError(@error, 0, 'Error: Registry Key: "' & $_sRegKey & '" does not exist.')
        Case Else
            ; Registry Key Exists | Return (Default) value
            Return SetError(0, 0, $sDefault)
    EndSwitch
EndFunc

Now look how to work with this already made code and your goal. Let's see my next answer. 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Posted
3 minutes ago, FrancescoDiMuro said:
If @ComputerName = "NameOfYourComputer" Then
    ; Execute script
Else
    Exit
EndIf

:)

He dont want to do it with computer name 😕

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Posted (edited)

Ok mate, @naru I made 3 little script for you but i wont make your script for you. I say you that. If you understand everything inside this : You can do what you want to do : 

 

First script :  (Making custom Registry Key : ) Each computer that will run this script WILL be able to execute your script. 

RegWrite ("HKCU\Software\MyScript" , "ScriptWontWorkWithoutThisKEy", "REG_SZ" , "1234" )
If @error Then MsgBox (0 , "Not Copied" , @Error )

Second script : (Deleting custom key) Each computer that will run this script WONT be able to execute your script. 

RegDelete ("HKCU\Software\MyScript" , "ScriptWontWorkWithoutThisKEy" )
If @error Then MsgBox (0 , "Registry SubKey is NOT Deleted" , @Error )
RegDelete ("HKCU\Software\MyScript" )
If @error Then MsgBox (0 , "Registry Key is NOT Deleted" , @Error )

Third script : (You verify the presence of the registry key and you act depend of the check result

$DoesMyKeyExists = _RegKeyExists( "HKCU\Software\MyScript" )

If $DoesMyKeyExists = "" Then
   $DoesMyKeyExists = "My Key exists" ; if $DoesMyKeyExists = "" That mean the key is here and exists so i change $DoesMyKeyExists value to make it human readable.
Else
   $DoesMyKeyExists = "My Key does NOT exists"
EndIf

MsgBox (0 , "Key ?" , $DoesMyKeyExists )

If $DoesMyKeyExists = "My Key exists" Then ;If $DoesMyKeyExists = "My Key exists" Then key exists
   MsgBox (0 , "Key is here" ,  "My script will now continu" )
;~    ...Here is your script if the regkey is detected
Else
   MsgBox (0 , "Key is not here" ,  "My script will now Stop and Exit" )
;~    ...The Script Stop if the key isn't detected
   Exit
EndIf

Func _RegKeyExists($_sRegKey)
    Local $sDefault = RegRead($_sRegKey, "") ;~ Try to read default value
    Switch @error
        Case 1, 2
            ;~ Unable to open requested key | Unable to open requested main key
            Return SetError(@error, 0, 'Error: Registry Key: "' & $_sRegKey & '" does not exist.')
        Case Else
            ; Registry Key Exists | Return (Default) value
            Return SetError(0, 0, $sDefault)
    EndSwitch
EndFunc

 

 

Cannot do more than that for you... I can add there is a lot of other ways to do that. 

 

Edited by caramen

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Posted

Or run in cmd and StandOutRead 

wmic bios get serialnumber
;Or
wmic csproduct get identifyingnumber

 

My video tutorials : ( In construction )  || My Discord : https://discord.gg/S9AnwHw

How to Ask Help ||  UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote

Spoiler

 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Posted

First - the computer you are running it on - Does the owner of this computer KNOW this script is going to run on his computer? 

Second - if this is a networked PC, then why not simply use group policy? 

Third - How would someone get access to your PC?

Forth - if for a company and you are NOT the system admin or someone who is allowed to do this - Do you have permission? 

I'm asking all this for what you are asking for is rather odd for some of the details are missing that would make helping you much easier. 

Posted (edited)
14 hours ago, Bert said:

First - the computer you are running it on - Does the owner of this computer KNOW this script is going to run on his computer? 

Second - if this is a networked PC, then why not simply use group policy? 

Third - How would someone get access to your PC?

Forth - if for a company and you are NOT the system admin or someone who is allowed to do this - Do you have permission? 

I'm asking all this for what you are asking for is rather odd for some of the details are missing that would make helping you much easier. 

My right question is I want to sell my complied autoit script, But i don't know it legal or inlegal. 

if selling complied script is legal i have more questions about this :

1) Is complied Script is Secure ? (Anbody can De-complie it ?)

2) How to add licence Key/Activation Key to my script ? (For Run it only 1 pc, don't run if someone get copied)

3) How do I make my script to expire ? (Run it only limited period not for lifetime, Ex. 6 months or 2 Years).

 

 

Edited by naru

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...