add alternative scripts

Signed-off-by: pengzhile <pengzhile@gmail.com>
pull/1/head
pengzhile 2020-06-05 17:05:52 +08:00
parent faa9c83e58
commit 778f7625c1
3 changed files with 84 additions and 1 deletions

View File

@ -4,3 +4,9 @@
2. Click `Help` or `Get Help` -> `Reset IDE Eval` menu. 2. Click `Help` or `Get Help` -> `Reset IDE Eval` menu.
3. Restart your IDE. 3. Restart your IDE.
4. Now you have another 30 days eval time :) 4. Now you have another 30 days eval time :)
------------------------------------------
### Alternative
* Or run script in the `reset_eval` folder directly.

View File

@ -0,0 +1,34 @@
#!/bin/sh
# reset jetbrains ide evals
OS_NAME=$(uname -s)
JB_PRODUCTS="IntelliJIdea CLion PhpStorm GoLand PyCharm WebStorm Rider DataGrip RubyMine AppCode"
if [ $OS_NAME == "Darwin" ]; then
echo 'macOS:'
for PRD in $JB_PRODUCTS; do
rm -rf ~/Library/Preferences/${PRD}*/eval
rm -rf ~/Library/Application\ Support/JetBrains/${PRD}*/eval
done
plutil -remove "/.JetBrains\.UserIdOnMachine" ~/Library/Preferences/com.apple.java.util.prefs.plist >/dev/null
plutil -remove "/.jetbrains/.user_id_on_machine" ~/Library/Preferences/com.apple.java.util.prefs.plist >/dev/null
plutil -remove "/.jetbrains/.device_id" ~/Library/Preferences/com.apple.java.util.prefs.plist >/dev/null
elif [ $OS_NAME == "Linux" ]; then
echo 'Linux:'
for PRD in $JB_PRODUCTS; do
rm -rf ~/.${PRD}*/config/eval
rm -rf ~/.config/JetBrains/${PRD}*/eval
done
sed -i '/key="JetBrains\.UserIdOnMachine"/d' ~/.java/.userPrefs/prefs.xml
sed -i '/key="device_id"/d' ~/.java/.userPrefs/jetbrains/prefs.xml
sed -i '/key="user_id_on_machine"/d' ~/.java/.userPrefs/jetbrains/prefs.xml
else
echo 'unsupport'
exit
fi
echo 'done.'

View File

@ -0,0 +1,43 @@
Set oShell = CreateObject("WScript.Shell")
Set oFS = CreateObject("Scripting.FileSystemObject")
sHomeFolder = oShell.ExpandEnvironmentStrings("%USERPROFILE%")
sJBDataFolder = oShell.ExpandEnvironmentStrings("%APPDATA%") + "\JetBrains"
Set re = New RegExp
re.Global = True
re.IgnoreCase = True
re.Pattern = "\.?(IntelliJIdea|GoLand|CLion|PyCharm|DataGrip|RubyMine|AppCode|PhpStorm|WebStorm|Rider).*"
Sub removeEval(ByVal file, ByVal sEvalPath)
bMatch = re.Test(file.Name)
If Not bMatch Then
Exit Sub
End If
If oFS.FolderExists(sEvalPath) Then
oFS.DeleteFolder sEvalPath, True
End If
End Sub
If oFS.FolderExists(sHomeFolder) Then
For Each oFile In oFS.GetFolder(sHomeFolder).SubFolders
removeEval oFile, sHomeFolder + "\" + oFile.Name + "\config\eval"
Next
End If
If oFS.FolderExists(sJBDataFolder) Then
For Each oFile In oFS.GetFolder(sJBDataFolder).SubFolders
removeEval oFile, sJBDataFolder + "\" + oFile.Name + "\eval"
Next
End If
On Error Resume Next
oShell.RegDelete "HKEY_CURRENT_USER\Software\JavaSoft\Prefs\/Jet/Brains./User/Id/On/Machine"
oShell.RegDelete "HKEY_CURRENT_USER\Software\JavaSoft\Prefs\jetbrains\device_id"
oShell.RegDelete "HKEY_CURRENT_USER\Software\JavaSoft\Prefs\jetbrains\user_id_on_machine"
oFs.DeleteFile sJBDataFolder + "\bl"
oFs.DeleteFile sJBDataFolder + "\crl"
oFs.DeleteFile sJBDataFolder + "\PermanentUserId"
oFs.DeleteFile sJBDataFolder + "\PermanentDeviceId"
MsgBox "done"